Add tryAddingEnergy to ThermalGenerator to fix eternal activation with adjacent lava
This commit is contained in:
parent
d727c2698b
commit
1181ce49f2
1 changed files with 23 additions and 6 deletions
|
@ -108,16 +108,18 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
||||||
this.getPos().getY() + direction.getFrontOffsetY(),
|
this.getPos().getY() + direction.getFrontOffsetY(),
|
||||||
this.getPos().getZ() + direction.getFrontOffsetZ()))
|
this.getPos().getZ() + direction.getFrontOffsetZ()))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA) {
|
||||||
this.addEnergy(1);
|
if(this.tryAddingEnergy(1))
|
||||||
this.lastOutput = this.world.getTotalWorldTime();
|
this.lastOutput = this.world.getTotalWorldTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tank.getFluidAmount() > 0 && this.getMaxPower() - this.getEnergy() >= TileThermalGenerator.euTick) {
|
if (this.tank.getFluidAmount() > 0) {
|
||||||
this.tank.drain(1, true);
|
if(tryAddingEnergy(euTick))
|
||||||
this.addEnergy(TileThermalGenerator.euTick);
|
{
|
||||||
this.lastOutput = this.world.getTotalWorldTime();
|
this.tank.drain(1, true);
|
||||||
|
this.lastOutput = this.world.getTotalWorldTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isRemote) {
|
if (!this.world.isRemote) {
|
||||||
|
@ -136,6 +138,21 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean tryAddingEnergy(int amount)
|
||||||
|
{
|
||||||
|
if(this.getMaxPower() - this.getEnergy() >= amount)
|
||||||
|
{
|
||||||
|
addEnergy(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(this.getMaxPower() - this.getEnergy() > 0)
|
||||||
|
{
|
||||||
|
addEnergy(this.getMaxPower() - this.getEnergy());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower() {
|
public double getMaxPower() {
|
||||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||||
|
|
Loading…
Add table
Reference in a new issue