#spawn nametag at location [closed]
4 messages · Page 1 of 1 (latest)
You can't, nametags aren't entities. You may be able to spawn a display entity or an armor stand with a nametag though.
Take a look at Entity. I think there's instructions in the javadocs there.
Solved with
ArmorStandEntity entity = new ArmorStandEntity(EntityType.ARMOR_STAND, world);
entity.setCustomNameVisible(true);
if (axis == Direction.Axis.Z) {
entity.setPos(pos.getX() + 0.5, pos.getY() - 1.8, pos.getZ() - 0.4);
} else {
entity.setPos(pos.getX() - 0.5, pos.getY() - 1.8, pos.getZ() + 0.5);
}
entity.setCustomName(Text.literal(j+","+i));
entity.setInvisible(true);
entity.setNoGravity(true);
entity.setInvulnerable(true);
world.spawnEntity(entity);