From 76861479e0df8c58da72e2615905d310aecfc329 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 20 Apr 2022 13:01:58 +0200 Subject: [PATCH] Add support for formatted names in `create_marker` (#1413) --- src/main/java/carpet/script/api/Auxiliary.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 19185ff9..7fc2b28b 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -341,11 +341,11 @@ public class Auxiliary { BlockState targetBlock = null; Vector3Argument pointLocator; boolean interactable = true; - String name; + Component name; try { Value nameValue = lv.get(0); - name = nameValue.isNull() ? "" : nameValue.getString(); + name = nameValue.isNull() ? null : FormattedTextValue.getTextByValue(nameValue); pointLocator = Vector3Argument.findIn(lv, 1, true, false); if (lv.size()>pointLocator.offset) { @@ -364,7 +364,7 @@ public class Auxiliary { ArmorStand armorstand = new ArmorStand(EntityType.ARMOR_STAND, cc.s.getLevel()); double yoffset; - if (targetBlock == null && name.isEmpty()) + if (targetBlock == null && name == null) { yoffset = 0.0; } @@ -395,9 +395,9 @@ public class Auxiliary { armorstand.addTag(MARKER_STRING); if (targetBlock != null) armorstand.setItemSlot(EquipmentSlot.HEAD, new ItemStack(targetBlock.getBlock().asItem())); - if (!name.isEmpty()) + if (name != null) { - armorstand.setCustomName(new TextComponent(name)); + armorstand.setCustomName(name); armorstand.setCustomNameVisible(true); } armorstand.setHeadPose(new Rotations((int)pointLocator.pitch,0,0));