Fixed null pointer exceptions from new custom gui slot commit.

This commit is contained in:
Luis C.M committed 2023-03-18 03:47:24 -05:00
1 parent 586c451f06
commit e3405d22e9
4 files changed
+25 -10

No files matched your search

@@ -143,13 +143,13 @@ public class ScriptGui implements ICustomGui {
}
public IItemSlot addItemSlot(int x, int y) {
ScriptGuiItemSlot slot = new ScriptGuiItemSlot(this.getMaxId() + 1, x, y);
ScriptGuiItemSlot slot = new ScriptGuiItemSlot(-1, x, y);
this.slots.add(slot);
return (IItemSlot)this.slots.get(this.slots.size() - 1);
}
public IItemSlot addItemSlot(int x, int y, IItemStack stack) {
ScriptGuiItemSlot slot = new ScriptGuiItemSlot(this.getMaxId() + 1, x, y, stack);
ScriptGuiItemSlot slot = new ScriptGuiItemSlot(-1, x, y, stack);
this.slots.add(slot);
return (IItemSlot)this.slots.get(this.slots.size() - 1);
}
@@ -308,6 +308,9 @@ public class ScriptGui implements ICustomGui {
while(var3.hasNext()) {
c = (ICustomGuiComponent)var3.next();
if (c.getID() == -1) {
c.setID(this.getMaxId()+1);
}
list.appendTag(((ScriptGuiComponent)c).toNBT(new NBTTagCompound()));
}