Hologram trait bugfix

This commit is contained in:
fullwall 2024-06-22 12:21:44 +08:00
parent 0fc644b21f
commit ee9c67fc0c

View File

@ -694,6 +694,13 @@ public class HologramTrait extends Trait {
itemNPC = null;
}
@Override
public Collection<Entity> getEntities() {
return itemNPC != null && itemNPC.getEntity() != null
? ImmutableList.of(hologram.getEntity(), itemNPC.getEntity())
: Collections.emptyList();
}
@Override
protected void render0(NPC npc, Vector3d offset) {
hologram.getEntity().teleport(npc.getStoredLocation().clone().add(offset.x,
@ -743,7 +750,8 @@ public class HologramTrait extends Trait {
@Override
public void render(NPC npc, Vector3d offset) {
if (hologram == null) {
if (getEntities().isEmpty()) {
destroy();
spawnHologram(npc, offset);
}
render0(npc, offset);