Skip to content

Commit

Permalink
Fix some bugs with prev. inventories
Browse files Browse the repository at this point in the history
  • Loading branch information
voidsong-dragonfly committed Apr 3, 2021
1 parent 303b346 commit 537639e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/zmaster587/libVulpes/util/EmbeddedInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public void writeToNBT(NBTTagCompound nbt) {

ArrayList list2 = new ArrayList<Byte>();
for(int i = 0; i < this.slotInsert.size(); i++) {
list2.set(i, slotInsert.get(i) ? 1 : 0);
list2.add(i, slotInsert.get(i) ? (byte)1 : (byte)0);
}
nbt.setTag("slotInsert", new NBTTagByteArray(list2));

ArrayList list3 = new ArrayList<Byte>();
for(int i = 0; i < this.slotExtract.size(); i++) {
list3.set(i, slotExtract.get(i) ? 1 : 0);
list3.add(i, slotExtract.get(i) ? (byte)1 : (byte)0);
}
nbt.setTag("slotExtract", new NBTTagByteArray(list3));

Expand All @@ -88,8 +88,8 @@ public void readFromNBT(NBTTagCompound nbt) {
this.stacks.set(slot, new ItemStack(tag));
}
}


byte[] list2 = nbt.getByteArray("slotInsert");
this.slotInsert = NonNullList.withSize(list2.length, false);
for (int i = 0; i < list2.length; i++) {
Expand All @@ -102,10 +102,10 @@ public void readFromNBT(NBTTagCompound nbt) {
}

//Backcompat, to allow older worlds to load
if (this.slotInsert.isEmpty()) {
if (this.slotInsert.size() == 0) {
this.slotInsert = NonNullList.withSize(4, false);
}
if (this.slotExtract.isEmpty()) {
if (this.slotExtract.size() == 0) {
this.slotExtract = NonNullList.withSize(4, false);
}
}
Expand Down

0 comments on commit 537639e

Please sign in to comment.