mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 02:17:42 +01:00
Set name visible when using a Name Tag on an Armor Stand
This commit is contained in:
@@ -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;
|
|
||||||
@@ -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();
|
||||||
@@ -90,9 +90,11 @@ public class PurpurWorldConfig {
|
|||||||
|
|
||||||
public float armorstandStepHeight = 0.0F;
|
public float armorstandStepHeight = 0.0F;
|
||||||
public boolean armorstandSetNameVisible = false;
|
public boolean armorstandSetNameVisible = false;
|
||||||
|
public boolean armorstandFixNametags = false;
|
||||||
private void armorstandSettings() {
|
private void armorstandSettings() {
|
||||||
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
||||||
armorstandSetNameVisible = getBoolean("gameplay-mechanics.armorstand.set-name-visible-when-placing-with-custom-name", armorstandSetNameVisible);
|
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;
|
public boolean arrowMovementResetsDespawnCounter = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user