+ private void renderFilledSphere(MatrixStack matrixStack, Point center, double radius, Color color) {
+ if (ConfigManager.fastRender.get() >= 1 && !RenderCulling.isVisibleCulling(new Box(new BlockPos(center.getX(), center.getY(), center.getZ())).expand(radius)))
+ return;
+
+// double offset = ((radius - (int) radius) == 0) ? center.getY() - (int) center.getY() : 0;
+
+ final ObjectArrayList<Point> top = new ObjectArrayList<>();
+ final ObjectArrayList<Point> bottom = new ObjectArrayList<>();
+ final Point topPoint = new Point(center.getX(), center.getY() + radius, center.getZ());
+ final Point bottomPoint = new Point(center.getX(), center.getY() - radius, center.getZ());
+ for (int i = 0; i < 360; i += 4) {
+ top.add(topPoint);
+ bottom.add(bottomPoint);
+ }
+
+// double stepModifier = Math.min(32.0 / radius, 3.5D);
+
+// int dyStep = radius < 64 ? 1 : MathHelper.floor(radius / 32);
+
+ final ObjectArrayList<ObjectArrayList<Point>> points = new ObjectArrayList<>();
+// renderCircle(matrixStack, center, 0.1D, color, offset + radius, top);
+ points.add(bottom);
+ for (int i = -90; i <= 90; i += 4) {
+ double phi = Math.PI / 180 * i;
+ double dy = Math.sin(phi) * radius;
+ double circleRadius = Math.cos(phi) * radius;
+ if (circleRadius == 0) circleRadius = Math.sqrt(2) / 2;
+ final ObjectArrayList<Point> pointsCache = new ObjectArrayList<>();
+ renderCircle(matrixStack, center, circleRadius, color, dy + 0.001F, pointsCache);
+ points.add(pointsCache);
+ }
+// for (double dy = offset + radius + 1; dy >= -radius; dy -= dyStep) {
+// double circleRadius = Math.sqrt((radius * radius) - (dy * dy));
+// if (circleRadius == 0) circleRadius = Math.sqrt(2) / 2;
+// final ObjectArrayList<Point> pointsCache = new ObjectArrayList<>();
+// renderCircle(matrixStack, center, circleRadius, color, dy + 0.001F, pointsCache);
+// points.add(pointsCache);
+// }
+// renderCircle(matrixStack, center, 0.1D, color, offset - radius, bottom);
+ points.add(top);
+
+ matrixStack.push();
+
+ RenderHelper.applyRegionalRenderOffset(matrixStack);
+ RenderSystem.setShader(GameRenderer::getPositionShader);
+
+ final Boolean doFill = ConfigManager.fill.get();
+
+ for (int i = 0; i < points.size() - 1; i++) {
+ final ObjectArrayList<Point> pointsCache1 = points.get(i);
+ final ObjectArrayList<Point> pointsCache2 = points.get(i + 1);
+ assert pointsCache1.size() == pointsCache2.size();
+ Point lastPoint1 = null;
+ Point lastPoint2 = null;
+ for (int j = 0, pointsCacheSize = pointsCache1.size(); j < pointsCacheSize; j++) {
+ Point point1 = pointsCache1.get(j);
+ Point point2 = pointsCache2.get(j);
+ if (ConfigManager.fastRender.get() >= 1 && RenderCulling.isVisibleCulling(new OffsetBox(point1, point2).toBox()))
+ RenderBatch.drawLine(matrixStack.peek(), point1, point2, color, 255);
+ if (doFill && lastPoint1 != null) {
+ if (ConfigManager.fastRender.get() >= 1 && RenderCulling.isVisibleCulling(new OffsetBox(lastPoint1, point2).toBox()))
+ RenderBatch.drawFilledFace(matrixStack.peek(), lastPoint1, lastPoint2, point2, point1, color, 127, false);
+ }
+ lastPoint1 = point1;
+ lastPoint2 = point2;
+ }
+ if (doFill && lastPoint1 != null) {
+ if (ConfigManager.fastRender.get() >= 1 && RenderCulling.isVisibleCulling(new OffsetBox(pointsCache1.get(0), lastPoint2).toBox()))
+ RenderBatch.drawFilledFace(matrixStack.peek(), pointsCache1.get(0), pointsCache2.get(0), lastPoint2, lastPoint1, color, 127, false);
+ }
+ }
+
+ matrixStack.pop();
+ }
+