From 3857ed0e8b416f421759dad9cb5c133a4e5ae9b6 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 20 Dec 2015 16:10:48 +0100 Subject: [PATCH] Fixed Coal Generator using infinite resources even though full Fixed Oil Generator not visually turning off. --- .../actuallyadditions/tile/TileEntityCoalGenerator.java | 4 ++-- .../actuallyadditions/tile/TileEntityOilGenerator.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java index 35e0ccb3d..cf34854b0 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java @@ -56,7 +56,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements this.storage.receiveEnergy(PRODUCE, false); } - if(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0){ + if(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()){ int burnTime = TileEntityFurnace.getItemBurnTime(this.slots[0]); this.maxBurnTime = burnTime; this.currentBurnTime = burnTime; @@ -80,7 +80,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements this.markDirty(); int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); if(meta == 1){ - if(!(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0)){ + if(!(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored())){ worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java index f7dea25ff..0cf80afeb 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java @@ -86,7 +86,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I this.markDirty(); int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); if(meta == 1){ - if(!(ENERGY_PRODUCED*BURN_TIME <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN) && FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount())){ + if(!(ENERGY_PRODUCED*BURN_TIME <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN) && this.currentBurnTime <= 0 && this.tank.getFluidAmount() >= fuelUsed)){ worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); } }