From 83a7c0cf192f76f71930051b736f2b9c39ca00e3 Mon Sep 17 00:00:00 2001 From: DisasterMoo Date: Sun, 3 May 2020 13:23:02 -0300 Subject: [PATCH] Fixed #49. --- .../tileentities/TEInductionCrucible.java | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/main/java/tfctech/objects/tileentities/TEInductionCrucible.java b/src/main/java/tfctech/objects/tileentities/TEInductionCrucible.java index 4621e7e..bb18f5e 100644 --- a/src/main/java/tfctech/objects/tileentities/TEInductionCrucible.java +++ b/src/main/java/tfctech/objects/tileentities/TEInductionCrucible.java @@ -110,6 +110,7 @@ public int getEnergyCapacity() @Override public void update() { + super.update(); if (world.isRemote) { IMachineSoundEffect.super.update(); @@ -117,33 +118,37 @@ public void update() } IBlockState state = world.getBlockState(pos); boolean isLit = state.getValue(LIT); - for (int i = SLOT_INPUT_START; i <= SLOT_INPUT_END; i++) + int energyUsage = TechConfig.DEVICES.inductionCrucibleEnergyConsumption; + boolean acceptHeat = this.getAlloy().removeAlloy(1, true) > 0; + if(!acceptHeat) { - ItemStack stack = inventory.getStackInSlot(i); - IItemHeat cap = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null); - int energyUsage = TechConfig.DEVICES.inductionCrucibleEnergyConsumption; - if ((cap != null || this.getAlloy().removeAlloy(1, true) > 0) && energyContainer.consumeEnergy(energyUsage, false)) + for (int i = SLOT_INPUT_START; i <= SLOT_INPUT_END; i++) { - this.acceptHeat(Heat.maxVisibleTemperature()); - litTime = 15; - if (!isLit) + ItemStack stack = inventory.getStackInSlot(i); + IItemHeat cap = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null); + if (cap != null) { - state = state.withProperty(BlockElectricForge.LIT, true); - world.setBlockState(pos, state, 2); + acceptHeat = true; + break; } - break; } - if (--litTime <= 0) + } + if(acceptHeat && energyContainer.consumeEnergy(energyUsage, false)) + { + this.acceptHeat(Heat.maxVisibleTemperature()); + litTime = 15; + if (!isLit) { - litTime = 0; - if (isLit) - { - state = state.withProperty(BlockElectricForge.LIT, false); - world.setBlockState(pos, state, 2); - } + state = state.withProperty(BlockElectricForge.LIT, true); + world.setBlockState(pos, state, 2); + isLit = true; } } - super.update(); + if (litTime > 0 && --litTime <= 0 && isLit) + { + state = state.withProperty(BlockElectricForge.LIT, false); + world.setBlockState(pos, state, 2); + } } @Override