mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-12 13:41:06 +00:00
Fix holograms
This commit is contained in:
parent
2d3edc7dcc
commit
036d7f3bd2
@ -14,6 +14,8 @@ public class ArmorStandWrapper {
|
|||||||
private Class<?> worldClass = Utils.getNMSClass("World");
|
private Class<?> worldClass = Utils.getNMSClass("World");
|
||||||
private Class<?> worldServerClass = Utils.getNMSClass("WorldServer");
|
private Class<?> worldServerClass = Utils.getNMSClass("WorldServer");
|
||||||
private Class<?> dataWatcherClass = Utils.getNMSClass("DataWatcher");
|
private Class<?> dataWatcherClass = Utils.getNMSClass("DataWatcher");
|
||||||
|
private Class<?> iChatBaseComponentClass = Utils.getNMSClass("IChatBaseComponent");
|
||||||
|
private Class<?> chatMessageClass = Utils.getNMSClass("ChatMessage");
|
||||||
private Class<?> entityClass = Utils.getNMSClass("Entity");
|
private Class<?> entityClass = Utils.getNMSClass("Entity");
|
||||||
private Class<?> entityArmorStandClass = Utils.getNMSClass("EntityArmorStand");
|
private Class<?> entityArmorStandClass = Utils.getNMSClass("EntityArmorStand");
|
||||||
private Class<?> entityLivingClass = Utils.getNMSClass("EntityLiving");
|
private Class<?> entityLivingClass = Utils.getNMSClass("EntityLiving");
|
||||||
@ -45,7 +47,10 @@ public class ArmorStandWrapper {
|
|||||||
.newInstance(nmsWorld, location.getX(), location.getY(), location.getZ());
|
.newInstance(nmsWorld, location.getX(), location.getY(), location.getZ());
|
||||||
|
|
||||||
if (customName != null && !customName.trim().isEmpty()) {
|
if (customName != null && !customName.trim().isEmpty()) {
|
||||||
entityArmorStandClass.getMethod("setCustomName", String.class).invoke(entity, customName);
|
Object chatMessage = chatMessageClass.getConstructor(String.class, Object[].class)
|
||||||
|
.newInstance(customName, new Object[0]);
|
||||||
|
|
||||||
|
entityArmorStandClass.getMethod("setCustomName", iChatBaseComponentClass).invoke(entity, chatMessage);
|
||||||
entityArmorStandClass.getMethod("setCustomNameVisible", boolean.class).invoke(entity, true);
|
entityArmorStandClass.getMethod("setCustomNameVisible", boolean.class).invoke(entity, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +117,10 @@ public class ArmorStandWrapper {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (customName != null && !customName.isEmpty()) {
|
if (customName != null && !customName.isEmpty()) {
|
||||||
entityClass.getMethod("setCustomName", String.class).invoke(entity, customName);
|
Object chatMessage = chatMessageClass.getConstructor(String.class, Object[].class)
|
||||||
|
.newInstance(customName, new Object[0]);
|
||||||
|
|
||||||
|
entityClass.getMethod("setCustomName", iChatBaseComponentClass).invoke(entity, chatMessage);
|
||||||
entityClass.getMethod("setCustomNameVisible", boolean.class).invoke(entity, true);
|
entityClass.getMethod("setCustomNameVisible", boolean.class).invoke(entity, true);
|
||||||
} else {
|
} else {
|
||||||
entityClass.getMethod("setCustomName", String.class).invoke(entity, "");
|
entityClass.getMethod("setCustomName", String.class).invoke(entity, "");
|
||||||
|
Loading…
Reference in New Issue
Block a user