Skip to content

Commit

Permalink
Fix offline player inventory saving
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Nov 16, 2024
1 parent 467fe0e commit 49821cc
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,23 @@ public ListTag writeList(final ListTag nbtTagListIn) {
if (!this.mainInventory.get(i).isEmpty()) {
final CompoundTag nbttagcompound = new CompoundTag();
nbttagcompound.putByte("Slot", (byte) i);
this.mainInventory.get(i).save(SpongeCommon.server().registryAccess(), nbttagcompound);
nbtTagListIn.add(nbttagcompound);
nbtTagListIn.add(this.mainInventory.get(i).save(SpongeCommon.server().registryAccess(), nbttagcompound));
}
}

for (int j = 0; j < this.armorInventory.size(); ++j) {
if (!this.armorInventory.get(j).isEmpty()) {
final CompoundTag nbttagcompound1 = new CompoundTag();
nbttagcompound1.putByte("Slot", (byte) (j + 100));
this.armorInventory.get(j).save(SpongeCommon.server().registryAccess(), nbttagcompound1);
nbtTagListIn.add(nbttagcompound1);
nbtTagListIn.add(this.armorInventory.get(j).save(SpongeCommon.server().registryAccess(), nbttagcompound1));
}
}

for (int k = 0; k < this.offHandInventory.size(); ++k) {
if (!this.offHandInventory.get(k).isEmpty()) {
final CompoundTag nbttagcompound2 = new CompoundTag();
nbttagcompound2.putByte("Slot", (byte) (k + 150));
this.offHandInventory.get(k).save(SpongeCommon.server().registryAccess(), nbttagcompound2);
nbtTagListIn.add(nbttagcompound2);
nbtTagListIn.add(this.offHandInventory.get(k).save(SpongeCommon.server().registryAccess(), nbttagcompound2));
}
}

Expand Down

0 comments on commit 49821cc

Please sign in to comment.