ItemDisplayEntity nbt data #3938
Replies: 1 comment
-
Issue solved! For those who need this, use mixins and datatrackers. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
I was trying to make ItemDisplayEntity display item using writeNbt(NbtCompound nbt) but it wouldn't work. How can I write nbt to ItemDisplayEntity so it can display an item? My current code (version 1.20.1):
DisplayEntity.ItemDisplayEntity itemDisplayEntity = new DisplayEntity.ItemDisplayEntity(EntityType.ITEM_DISPLAY, serverWorld);
itemDisplayEntity.copyRotationAndPosition(this);
NbtCompound item = new NbtCompound();
NbtCompound nbtCompound = new NbtCompound();
nbtCompound.putByte("Count", (byte)1);
nbtCompound.putString("id", "minecraft:stone");
item.put("item", nbtCompound);
System.out.print(item);
itemDisplayEntity.writeNbt(item);
System.out.print(item);
serverWorld.spawnEntity(itemDisplayEntity);
Beta Was this translation helpful? Give feedback.
All reactions