mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 14:19:49 +00:00
Separate GUI Data from PartyData so that overwrites don't consistently occur to GUI Page
This commit is contained in:
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import tconstruct.client.tabs.TabRegistry;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, ITopButtonListener,ICustomScrollListener, IGuiData, GuiYesNoCallback {
|
||||
public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, ITopButtonListener,ICustomScrollListener, IPartyData, GuiYesNoCallback {
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
private final EntityPlayer player;
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -370,7 +370,7 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
public void setPartyData(NBTTagCompound compound) {
|
||||
this.receivedData = true;
|
||||
ClientCacheHandler.party = null;
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package noppes.npcs.client.gui.util;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface IPartyData {
|
||||
public void setPartyData(NBTTagCompound compound);
|
||||
}
|
||||
Reference in new issue
Block a user