1 package com.irtimaled.bbor.client.renderers;
3 import com.irtimaled.bbor.client.Player;
4 import com.irtimaled.bbor.client.config.BoundingBoxTypeHelper;
5 import com.irtimaled.bbor.client.config.ColorHelper;
6 import com.irtimaled.bbor.client.config.ConfigManager;
7 import com.irtimaled.bbor.client.models.BoundingBoxSpawningSphere;
8 import com.irtimaled.bbor.common.BoundingBoxType;
9 import com.irtimaled.bbor.common.models.Point;
10 import net.minecraft.client.resources.I18n;
14 public class SpawningSphereRenderer extends AbstractRenderer<BoundingBoxSpawningSphere> {
16 public void render(BoundingBoxSpawningSphere boundingBox) {
17 Point point = boundingBox.getPoint();
18 OffsetPoint sphereCenter = new OffsetPoint(point);
20 OffsetBox offsetBox = new OffsetBox(sphereCenter, sphereCenter).grow(0.5, 0, 0.5);
21 Color safeAreaColor = ColorHelper.getColor(ConfigManager.colorAFKSpheresSafeArea);
22 renderCuboid(offsetBox, safeAreaColor);
24 Integer spawnableSpacesCount = boundingBox.getSpawnableSpacesCount();
25 if (spawnableSpacesCount != null) {
26 renderText(sphereCenter, I18n.format("bbor.renderer.spawningSphere.spawnable"),
27 spawnableSpacesCount == 0 ?
28 I18n.format("bbor.renderer.spawningSphere.none") :
29 String.format("%,d", spawnableSpacesCount));
32 renderSphere(point, BoundingBoxSpawningSphere.SAFE_RADIUS, safeAreaColor, 5, 5);
34 renderOuterSphere(boundingBox, point);
36 if (ConfigManager.renderAFKSpawnableBlocks.get() && boundingBox.isWithinSphere(Player.getPoint())) {
37 renderSpawnableSpaces(boundingBox);
41 private void renderOuterSphere(BoundingBoxSpawningSphere boundingBox, Point point) {
42 Color color = BoundingBoxTypeHelper.getColor(boundingBox.getType());
43 renderSphere(point, BoundingBoxSpawningSphere.SPAWN_RADIUS, color, 5, 5);
46 private void renderSpawnableSpaces(BoundingBoxSpawningSphere boundingBox) {
47 Color color = BoundingBoxTypeHelper.getColor(BoundingBoxType.SpawnableBlocks);
48 boundingBox.getBlocks().forEach(c -> {
52 OffsetBox offsetBox = new OffsetBox(x, y, z, x + 1, y, z + 1);
53 renderCuboid(offsetBox, color);