merged separate gui packet calls in the ProfileChangePacket

This commit is contained in:
luisc committed 2025-06-10 10:56:25 -05:00
1 parent e973605be6
commit 43bf4d3427
4 files changed
+43 -19

No files matched your search

@@ -335,22 +335,15 @@ public class GuiProfiles extends GuiCNPCInventory implements ISubGuiListener, IC
public void setGuiData(NBTTagCompound compound) {
this.slot = null;
if (compound.hasKey("PROFILE")) {
// Load Profile
this.profile = new Profile(mc.thePlayer, compound);
this.data = new HashMap<>();
String currentSlot = "\u00A7e";
String otherSlot = "\u00A7f";
for (ISlot slot1 : profile.getSlots().values()) {
String name = slot1.getId() + " - " + slot1.getName();
if (profile.currentSlotId == slot1.getId())
name = currentSlot + name;
else
name = otherSlot + name;
this.data.put(name, slot1.getId());
}
if (compound.hasKey("CHANGE_PACKET")) {
this.readProfileCompound(
compound.getCompoundTag("PROFILE"));
this.slotInfoMap = ProfileGetInfoPacket.readProfileInfo(
compound.getCompoundTag("PROFILE_INFO"));
} else if (compound.hasKey("PROFILE")) {
this.readProfileCompound(compound);
} else if (compound.hasKey("PROFILE_INFO")) {
slotInfoMap = ProfileGetInfoPacket.readProfileInfo(compound);
this.slotInfoMap = ProfileGetInfoPacket.readProfileInfo(compound);
}
if (scroll != null) {
scroll.setSelected("");
@@ -358,6 +351,22 @@ public class GuiProfiles extends GuiCNPCInventory implements ISubGuiListener, IC
initGui();
}
private void readProfileCompound(NBTTagCompound compound) {
// Load Profile
this.profile = new Profile(mc.thePlayer, compound);
this.data = new HashMap<>();
String currentSlot = "\u00A7e";
String otherSlot = "\u00A7f";
for (ISlot slot1 : profile.getSlots().values()) {
String name = slot1.getId() + " - " + slot1.getName();
if (profile.currentSlotId == slot1.getId())
name = currentSlot + name;
else
name = otherSlot + name;
this.data.put(name, slot1.getId());
}
}
/**
* Handles mouse clicks for the scrollbar.
*/