Implemented a better synchronisation system for left hand item and projectile item, similar to main hand and armor items system for vanilla

This commit is contained in:
Goodbird committed 2023-12-08 09:47:18 +03:00
1 parent 8aa9d16d8e
commit 21c16e5341
5 files changed
+30 -2

No files matched your search

@@ -358,5 +358,14 @@ public class PacketHandlerClient extends PacketHandlerServer{
else if(type == EnumPacketClient.STOP_SOUNDS) {
ScriptSoundController.Instance.stopAllSounds();
}
else if(type == EnumPacketClient.SYNC_WEAPON) {
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
if(!(entity instanceof EntityNPCInterface))
return;
EntityNPCInterface npc = (EntityNPCInterface) entity;
int weaponSlotIndex = buffer.readInt();
ItemStack stack = ItemStack.loadItemStackFromNBT(Server.readNBT(buffer));
npc.inventory.weapons.put(weaponSlotIndex,stack);
}
}
}