Fix item storage blocks. Closes #2717

This commit is contained in:
drcrazy 2022-01-10 00:39:56 +03:00
parent cf9965a598
commit c887d1652d
2 changed files with 3 additions and 8 deletions

View file

@ -141,6 +141,7 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
public void setHashChanged() {
this.hasChanged = true;
this.markDirty();
}
public void setHashChanged(boolean changed) {

View file

@ -75,23 +75,21 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
public StorageUnitBaseBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.STORAGE_UNIT, pos, state);
inventory = new RebornInventory<>(2, "ItemInventory", 64, this);
}
public StorageUnitBaseBlockEntity(BlockPos pos, BlockState state, TRContent.StorageUnit type) {
super(TRBlockEntities.STORAGE_UNIT, pos, state);
inventory = new RebornInventory<>(2, "ItemInventory", 64, this);
configureEntity(type);
}
private void configureEntity(TRContent.StorageUnit type) {
// Set capacity to local config unless overridden by server
if(serverCapacity == -1){
this.maxCapacity = type.capacity;
}
storeItemStack = ItemStack.EMPTY;
inventory = new RebornInventory<>(2, "ItemInventory", 64, this);
this.type = type;
}
@ -313,8 +311,6 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
if (tagCompound.contains("lockedItem")) {
lockedItemStack = ItemStack.fromNbt(tagCompound.getCompound("lockedItem"));
}
inventory.read(tagCompound);
}
@Override
@ -340,8 +336,6 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
if (isLocked()) {
tagCompound.put("lockedItem", lockedItemStack.writeNbt(new NbtCompound()));
}
inventory.write(tagCompound);
}
@Override