there can be more than 3 dimensions

This commit is contained in:
gnembon committed 2020-06-20 09:01:49 -03:00
1 parent 273e324150
commit d838cfd32f
1 file changed
+2 -5
@@ -39,16 +39,13 @@ public class ShapesRenderer
{ {
this.client = minecraftClient; this.client = minecraftClient;
shapes = new HashMap<>(); shapes = new HashMap<>();
shapes.put(DimensionType.OVERWORLD, new Long2ObjectOpenHashMap<>());
shapes.put(DimensionType.THE_NETHER, new Long2ObjectOpenHashMap<>());
shapes.put(DimensionType.THE_END, new Long2ObjectOpenHashMap<>());
} }
public void render(Camera camera, float partialTick) public void render(Camera camera, float partialTick)
{ {
IWorld iWorld = this.client.world; IWorld iWorld = this.client.world;
DimensionType dimensionType = iWorld.getDimension().getType(); DimensionType dimensionType = iWorld.getDimension().getType();
if (shapes.get(dimensionType).isEmpty()) return; if (shapes.get(dimensionType) == null || shapes.get(dimensionType).isEmpty()) return;
long currentTime = client.world.getTime(); long currentTime = client.world.getTime();
RenderSystem.disableTexture(); RenderSystem.disableTexture();
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
@@ -130,7 +127,7 @@ public class ShapesRenderer
long key = rshape.key(); long key = rshape.key();
synchronized (shapes) synchronized (shapes)
{ {
RenderedShape<?> existing = shapes.get(dim).get(key); RenderedShape<?> existing = shapes.computeIfAbsent(dim, d -> new Long2ObjectOpenHashMap<>()).get(key);
if (existing != null) if (existing != null)
{ // promoting previous shape { // promoting previous shape
existing.expiryTick = rshape.expiryTick; existing.expiryTick = rshape.expiryTick;