Skip to content

Commit

Permalink
Fixed #49.
Browse files Browse the repository at this point in the history
  • Loading branch information
DisasterMoo committed May 3, 2020
1 parent bbd15ad commit 83a7c0c
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions src/main/java/tfctech/objects/tileentities/TEInductionCrucible.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,40 +110,45 @@ public int getEnergyCapacity()
@Override
public void update()
{
super.update();
if (world.isRemote)
{
IMachineSoundEffect.super.update();
return;
}
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
Expand Down

0 comments on commit 83a7c0c

Please sign in to comment.