mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
Fixed slots being replaced when custom GUIs are read from NBT.
This commit is contained in:
1 parent
1fa9e41c24
commit
9af7c67798
1 file changed
+12
-5
@@ -256,14 +256,21 @@ public class ScriptGui implements ICustomGui {
|
||||
}
|
||||
}
|
||||
|
||||
List<IItemSlot> slots = new ArrayList();
|
||||
List<IItemSlot> slots = new ArrayList<>();
|
||||
list = tag.getTagList("slots", 10);
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
NBTBase b = list.getCompoundTagAt(i);
|
||||
ScriptGuiItemSlot component = (ScriptGuiItemSlot)ScriptGuiComponent.createFromNBT((NBTTagCompound)b);
|
||||
components.put(component.getID(), component);
|
||||
slots.add(component);
|
||||
NBTTagCompound slotNbt = list.getCompoundTagAt(i);
|
||||
|
||||
int id = slotNbt.getInteger("id");
|
||||
if (!components.containsKey(id)) {
|
||||
components.put(id, ScriptGuiComponent.createFromNBT(slotNbt));
|
||||
} else {
|
||||
components.get(id).fromNBT(slotNbt);
|
||||
}
|
||||
|
||||
ScriptGuiItemSlot slot = (ScriptGuiItemSlot) components.get(id);
|
||||
slots.add(slot);
|
||||
}
|
||||
|
||||
this.slots = slots;
|
||||
|
||||
Reference in new issue
Block a user