Fix MatteryContainer of capacitor bank getting recreated
This commit is contained in:
parent
92bde060f6
commit
a0af840ab9
@ -144,7 +144,7 @@ public class BlockEntityMatterCapacitorBank extends BlockEntityMattery implement
|
|||||||
|
|
||||||
private final LazyOptional<IMatterHandler> resolver = LazyOptional.of(() -> matter);
|
private final LazyOptional<IMatterHandler> resolver = LazyOptional.of(() -> matter);
|
||||||
|
|
||||||
public MatteryContainer matter_container = new MatteryContainer(this::setChanged, 6 * 2) {
|
public final MatteryContainer matter_container = new MatteryContainer(this::setChanged, 6 * 2) {
|
||||||
@Override
|
@Override
|
||||||
public void setChanged(int slot, ItemStack new_state, ItemStack old_state) {
|
public void setChanged(int slot, ItemStack new_state, ItemStack old_state) {
|
||||||
super.setChanged(slot, new_state, old_state);
|
super.setChanged(slot, new_state, old_state);
|
||||||
@ -182,9 +182,7 @@ public class BlockEntityMatterCapacitorBank extends BlockEntityMattery implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CompoundTag nbt) {
|
public void load(CompoundTag nbt) {
|
||||||
if (nbt.contains("matter_container") && nbt.get("matter_container") instanceof CompoundTag tag)
|
matter_container.deserializeNBT(nbt.get("matter_container"));
|
||||||
matter_container = MatteryContainer.of(this::setChanged, tag, matter_container.getContainerSize());
|
|
||||||
|
|
||||||
super.load(nbt);
|
super.load(nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user