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.client.models.Point;
9 import com.irtimaled.bbor.common.BoundingBoxType;
10 import net.minecraft.client.resource.language.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 Color safeAreaColor = ColorHelper.getColor(ConfigManager.colorAFKSpheresSafeArea);
21 renderSphere(point, BoundingBoxSpawningSphere.SAFE_RADIUS, safeAreaColor);
23 renderOuterSphere(boundingBox, point);
25 OffsetBox offsetBox = new OffsetBox(sphereCenter, sphereCenter).grow(0.5, 0, 0.5);
26 renderCuboid(offsetBox, safeAreaColor);
28 Integer spawnableSpacesCount = boundingBox.getSpawnableSpacesCount();
29 if (spawnableSpacesCount != null) {
30 renderText(sphereCenter, I18n.translate("bbor.renderer.spawningSphere.spawnable"),
31 spawnableSpacesCount == 0 ?
32 I18n.translate("bbor.renderer.spawningSphere.none") :
33 String.format("%,d", spawnableSpacesCount));
35 renderSphere(point, BoundingBoxSpawningSphere.SAFE_RADIUS, safeAreaColor);
37 if (ConfigManager.renderAFKSpawnableBlocks.get() && boundingBox.isWithinSphere(Player.getPoint())) {
38 renderSpawnableSpaces(boundingBox);
42 private void renderOuterSphere(BoundingBoxSpawningSphere boundingBox, Point point) {
43 Color color = BoundingBoxTypeHelper.getColor(boundingBox.getType());
44 renderSphere(point, BoundingBoxSpawningSphere.SPAWN_RADIUS, color);
47 private void renderSpawnableSpaces(BoundingBoxSpawningSphere boundingBox) {
48 Color color = BoundingBoxTypeHelper.getColor(BoundingBoxType.SpawnableBlocks);
49 boundingBox.getBlocks().forEach(c -> {
53 OffsetBox offsetBox = new OffsetBox(x, y, z, x + 1, y, z + 1);
54 renderCuboid(offsetBox, color);