diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index d7d446a0..6299c22a 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -150,7 +150,7 @@ public class ShapesRenderer RenderedShape existing = shapes.computeIfAbsent(dim, d -> new Long2ObjectOpenHashMap<>()).get(key); if (existing != null) { // promoting previous shape - existing.expiryTick = rshape.expiryTick; + existing.promoteWith(rshape); } else { @@ -204,6 +204,11 @@ public class ShapesRenderer { return false; } + + public void promoteWith(RenderedShape rshape) + { + expiryTick = rshape.expiryTick; + } } public static class RenderedText extends RenderedShape @@ -293,6 +298,20 @@ public class ShapesRenderer { return true; } + + @Override + public void promoteWith(RenderedShape rshape) + { + super.promoteWith(rshape); + try + { + this.shape.value = ((ShapeDispatcher.Text) rshape.shape).value; + } + catch (ClassCastException ignored) + { + CarpetSettings.LOG.error("shape "+rshape.shape.getClass()+" cannot cast to a Label"); + } + } } public static class RenderedBox extends RenderedShape