This commit is contained in:
parent
f7e1ad1367
commit
a5aa7acc83
2 changed files with 13 additions and 1 deletions
|
@ -155,6 +155,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
((IUpgrade) stack.getItem()).process(this, this, stack);
|
||||
}
|
||||
}
|
||||
afterUpgradesApplication();
|
||||
}
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
|
@ -175,6 +176,9 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
resetSpeedMulti();
|
||||
}
|
||||
|
||||
protected void afterUpgradesApplication() {
|
||||
}
|
||||
|
||||
public int getFacingInt() {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockMachineBase) {
|
||||
|
|
|
@ -346,7 +346,8 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
super.readNbt(tag);
|
||||
NbtCompound data = tag.getCompound("PowerAcceptor");
|
||||
if (shouldHandleEnergyNBT()) {
|
||||
this.setStored(data.getLong("energy"));
|
||||
// Bypass the overfill check in setStored() because upgrades have not yet been applied.
|
||||
this.energyContainer.amount = data.getLong("energy");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,6 +368,13 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
extraPowerInput = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterUpgradesApplication() {
|
||||
if (checkOverfill && getStored() > getMaxStoredPower()) {
|
||||
setStored(getStored());
|
||||
}
|
||||
}
|
||||
|
||||
public long getStored() {
|
||||
return energyContainer.amount;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue