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);
|
((IUpgrade) stack.getItem()).process(this, this, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
afterUpgradesApplication();
|
||||||
}
|
}
|
||||||
if (world == null || world.isClient) {
|
if (world == null || world.isClient) {
|
||||||
return;
|
return;
|
||||||
|
@ -175,6 +176,9 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
||||||
resetSpeedMulti();
|
resetSpeedMulti();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void afterUpgradesApplication() {
|
||||||
|
}
|
||||||
|
|
||||||
public int getFacingInt() {
|
public int getFacingInt() {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
if (block instanceof BlockMachineBase) {
|
if (block instanceof BlockMachineBase) {
|
||||||
|
|
|
@ -346,7 +346,8 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
||||||
super.readNbt(tag);
|
super.readNbt(tag);
|
||||||
NbtCompound data = tag.getCompound("PowerAcceptor");
|
NbtCompound data = tag.getCompound("PowerAcceptor");
|
||||||
if (shouldHandleEnergyNBT()) {
|
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;
|
extraPowerInput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterUpgradesApplication() {
|
||||||
|
if (checkOverfill && getStored() > getMaxStoredPower()) {
|
||||||
|
setStored(getStored());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long getStored() {
|
public long getStored() {
|
||||||
return energyContainer.amount;
|
return energyContainer.amount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue