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

@@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 17 Nov 2020 13:12:09 -0800
Subject: [PATCH] Set name visible when using a Name Tag on an Armor Stand
diff --git a/net/minecraft/world/item/NameTagItem.java b/net/minecraft/world/item/NameTagItem.java
index df9cdcb9544a171a5a07c65ba0150933fb70d5fc..793bd6392ca3c3792306a20538233e4d7fb69b86 100644
--- a/net/minecraft/world/item/NameTagItem.java
+++ b/net/minecraft/world/item/NameTagItem.java
@@ -23,6 +23,7 @@ public class NameTagItem extends Item {
if (!event.callEvent()) return InteractionResult.PASS;
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 (user.level().purpurConfig.armorstandFixNametags && entity instanceof net.minecraft.world.entity.decoration.ArmorStand) entity.setCustomNameVisible(true); // Purpur
if (event.isPersistent() && newEntity instanceof Mob mob) {
// Paper end - Add PlayerNameEntityEvent
mob.setPersistenceRequired();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 4efb19a627b3735fe2ded2108576d76296b605f3..c6f4b6e14616aed688269c56aa9ddf11f097abaf 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -99,9 +99,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;