1.17 dev: item frames are not populated with metadata packet
radiant-ai opened this issue ยท 1 comments
Describe the bug
Dev build for 1.17 does not allow to display maps inside of fake item frames.
To Reproduce
Send spawn entity itemframe to player and then populate it (using id) with an filled_map
ItemStack.
public static void populateItemFrame(Player p, int id, ItemStack map) {
PacketContainer pc = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
pc.getIntegers().write(0, id);
WrappedDataWatcher watcher = new WrappedDataWatcher();
watcher.setEntity(p);
watcher.setObject(7, WrappedDataWatcher.Registry.getItemStackSerializer(false), map);
pc.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(p, pc);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
Expected behavior
Item frame filled with a map.
Version Info
https://pastebin.com/rdpA8cb9
Additional context
Works as inteded with stable builds for 1.16.5.
The index was changed to 8 in 1.17: https://wiki.vg/Entity_metadata#Item_Frame