Handful of improvements to the electrical furnace, closes #1349
This commit is contained in:
parent
777707373a
commit
53c731d678
1 changed files with 19 additions and 15 deletions
|
@ -48,9 +48,10 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
public int progress;
|
public int progress;
|
||||||
public int fuelScale = 100;
|
public int fuelScale = 100;
|
||||||
public int cost = 8;
|
public int cost = 6;
|
||||||
int input1 = 0;
|
int input1 = 0;
|
||||||
int output = 1;
|
int output = 1;
|
||||||
|
boolean wasBurning = false;
|
||||||
|
|
||||||
public TileElectricFurnace() {
|
public TileElectricFurnace() {
|
||||||
super();
|
super();
|
||||||
|
@ -71,15 +72,14 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
boolean updateInventory = false;
|
boolean updateInventory = false;
|
||||||
if (this.isBurning() && this.canSmelt()) {
|
if (this.isBurning() && this.canSmelt()) {
|
||||||
this.updateState();
|
this.updateState();
|
||||||
|
if(canUseEnergy(this.cost)){
|
||||||
this.progress++;
|
this.useEnergy(this.cost);
|
||||||
if (this.progress % 10 == 0) {
|
this.progress++;
|
||||||
this.useEnergy(getEuPerTick(this.cost));
|
if (this.progress >= Math.max((int) (fuelScale * (1.0 - getSpeedMultiplier())), 2)) {
|
||||||
}
|
this.progress = 0;
|
||||||
if (this.progress >= Math.max((int) (fuelScale * (1.0 - getSpeedMultiplier())), 1)) {
|
this.cookItems();
|
||||||
this.progress = 0;
|
updateInventory = true;
|
||||||
this.cookItems();
|
}
|
||||||
updateInventory = true;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
@ -139,12 +139,16 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState() {
|
public void updateState() {
|
||||||
final IBlockState BlockStateContainer = this.world.getBlockState(this.pos);
|
if(wasBurning != (this.progress > 0)){
|
||||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
final IBlockState BlockStateContainer = this.world.getBlockState(this.pos);
|
||||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != this.progress > 0)
|
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||||
blockMachineBase.setActive(this.progress > 0, this.world, this.pos);
|
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != this.progress > 0)
|
||||||
|
blockMachineBase.setActive(this.progress > 0, this.world, this.pos);
|
||||||
|
}
|
||||||
|
wasBurning = (this.progress > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue