Set name visible when using a Name Tag on an Armor Stand

This commit is contained in:
Jason Penilla
2025-01-09 20:32:24 -08:00
committed by granny
parent ef5f2bc21a
commit 5055e6adb9
3 changed files with 12 additions and 34 deletions

View File

@@ -0,0 +1,10 @@
--- a/net/minecraft/world/item/NameTagItem.java
+++ b/net/minecraft/world/item/NameTagItem.java
@@ -24,6 +_,7 @@
LivingEntity newEntity = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle();
newEntity.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null);
+ if (player.level().purpurConfig.armorstandFixNametags && target instanceof net.minecraft.world.entity.decoration.ArmorStand) target.setCustomNameVisible(true); // Purpur - Set name visible when using a Name Tag on an Armor Stand
if (event.isPersistent() && newEntity instanceof Mob mob) {
// Paper end - Add PlayerNameEntityEvent
mob.setPersistenceRequired();

View File

@@ -90,9 +90,11 @@ public class PurpurWorldConfig {
public float armorstandStepHeight = 0.0F;
public boolean armorstandSetNameVisible = false;
public boolean armorstandFixNametags = false;
private void armorstandSettings() {
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
armorstandSetNameVisible = getBoolean("gameplay-mechanics.armorstand.set-name-visible-when-placing-with-custom-name", armorstandSetNameVisible);
armorstandFixNametags = getBoolean("gameplay-mechanics.armorstand.fix-nametags", armorstandFixNametags);
}
public boolean arrowMovementResetsDespawnCounter = true;