Smoothened out vanilla furnace smelt code

This commit is contained in:
Calclavia 2014-01-04 13:30:46 +08:00
parent ebc1e90f80
commit 0ea073d797
3 changed files with 27 additions and 80 deletions

@ -1 +1 @@
Subproject commit 9ee40535875746f1f3035e69c43d50bda7b62a82
Subproject commit 0e555849dbe3dd51f2c7690aad450d060af12e99

View file

@ -107,7 +107,7 @@ public class ResonantInduction
* Settings
*/
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
public static int FURNACE_WATTAGE = 25000;
public static int FURNACE_WATTAGE = 50000;
public static boolean SOUND_FXS = true;
public static boolean LO_FI_INSULATION = false;
public static boolean SHINY_SILVER = true;

View file

@ -38,85 +38,9 @@ public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInt
public void updateEntity()
{
/**
* If we have fuel and can smelt properly, do the vanilla process.
* Producing energy from coal.
*/
if (this.canSmelt() && TileEntityFurnace.getItemBurnTime(this.getStackInSlot(1)) > 0)
{
boolean flag = this.furnaceBurnTime > 0;
boolean flag1 = false;
if (this.furnaceBurnTime > 0)
{
--this.furnaceBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.furnaceBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.getStackInSlot(1));
if (this.furnaceBurnTime > 0)
{
flag1 = true;
if (this.getStackInSlot(1) != null)
{
--this.getStackInSlot(1).stackSize;
if (this.getStackInSlot(1).stackSize == 0)
{
this.setInventorySlotContents(1, this.getStackInSlot(1).getItem().getContainerItemStack(this.getStackInSlot(1)));
}
}
}
}
if (this.isBurning() && this.canSmelt())
{
++this.furnaceCookTime;
if (this.furnaceCookTime == 200)
{
this.furnaceCookTime = 0;
this.smeltItem();
flag1 = true;
}
}
else
{
this.furnaceCookTime = 0;
}
if (flag != this.furnaceBurnTime > 0)
{
flag1 = true;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
if (flag1)
{
this.onInventoryChanged();
}
}
else if (this.getStackInSlot(1) == null && canSmelt() && this.furnaceBurnTime == 0)
{
if (this.energy.checkExtract(ResonantInduction.FURNACE_WATTAGE / 20))
{
this.furnaceCookTime++;
if (this.furnaceCookTime == 200)
{
this.furnaceCookTime = 0;
this.smeltItem();
this.onInventoryChanged();
}
this.energy.extractEnergy(ResonantInduction.FURNACE_WATTAGE / 20, true);
}
}
else if (this.getStackInSlot(0) == null)
if (TileEntityFurnace.getItemBurnTime(this.getStackInSlot(1)) > 0)
{
boolean doBlockStateUpdate = this.furnaceBurnTime > 0;
@ -140,6 +64,29 @@ public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInt
this.produce();
}
/**
* Consuming energy for smelting
*/
if (this.canSmelt())
{
if (this.energy.checkExtract(ResonantInduction.FURNACE_WATTAGE / 20))
{
this.furnaceCookTime++;
if (this.furnaceCookTime == 200)
{
this.furnaceCookTime = 0;
this.smeltItem();
}
this.energy.extractEnergy(ResonantInduction.FURNACE_WATTAGE / 20, true);
}
}
else
{
this.furnaceCookTime = 0;
}
}
private void produce()