mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-18 19:04:23 +01:00
Fix jar inventory size mismatch. Fixes #441
This commit is contained in:
parent
512ae4d126
commit
9424a3f2ba
1 changed files with 5 additions and 4 deletions
|
@ -30,15 +30,16 @@ public record ItemsJarContents (
|
||||||
TileData tile,
|
TileData tile,
|
||||||
List<ItemStack> stacks
|
List<ItemStack> stacks
|
||||||
) implements JarContents, SidedInventory {
|
) implements JarContents, SidedInventory {
|
||||||
private static final int[] SLOTS = IntStream.range(0, 16).toArray();
|
private static final int MAX_SIZE = 16;
|
||||||
|
private static final int[] SLOTS = IntStream.range(0, MAX_SIZE).toArray();
|
||||||
|
|
||||||
public ItemsJarContents(TileData tile) {
|
public ItemsJarContents(TileData tile) {
|
||||||
this(tile, new ArrayList<>());
|
this(tile, new ArrayList<>(MAX_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemsJarContents(TileData tile, NbtCompound compound) {
|
public ItemsJarContents(TileData tile, NbtCompound compound) {
|
||||||
this(tile, NbtSerialisable.ITEM_STACK.readAll(compound.getList("items", NbtElement.COMPOUND_TYPE))
|
this(tile, NbtSerialisable.ITEM_STACK.readAll(compound.getList("items", NbtElement.COMPOUND_TYPE))
|
||||||
.limit(15)
|
.limit(MAX_SIZE)
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ public record ItemsJarContents (
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return 15;
|
return MAX_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue