Separate GUI Data from PartyData so that overwrites don't consistently occur to GUI Page

This commit is contained in:
Kam committed 2024-03-01 20:56:24 -05:00
1 parent 32dc6e86e2
commit 1cbd306c50
6 files changed
+30 -9

No files matched your search

@@ -400,5 +400,19 @@ public class PacketHandlerClient extends PacketHandlerServer{
ItemStack stack = ItemStack.loadItemStackFromNBT(Server.readNBT(buffer));
npc.inventory.weapons.put(weaponSlotIndex,stack);
}
else if(type == EnumPacketClient.PARTY_DATA){
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui == null)
return;
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
}
else if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
}
if(gui instanceof IPartyData)
((IPartyData)gui).setPartyData(Server.readNBT(buffer));
}
}
}