Skip to content

Commit

Permalink
Changes regarding Blast Furnace behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
DisasterMoo committed Jun 18, 2019
1 parent bf50ac9 commit fb688d2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
59 changes: 38 additions & 21 deletions src/main/java/net/dries007/tfc/objects/te/TEBlastFurnace.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import net.dries007.tfc.ConfigTFC;
import net.dries007.tfc.TerraFirmaCraft;
import net.dries007.tfc.api.capability.heat.CapabilityItemHeat;
import net.dries007.tfc.api.capability.heat.IItemHeat;
import net.dries007.tfc.api.types.Metal;
import net.dries007.tfc.api.util.IMetalObject;
import net.dries007.tfc.objects.blocks.BlockMolten;
Expand Down Expand Up @@ -217,18 +219,6 @@ public void update()
return;
}
addItemsFromWorld();
if (temperature > Metal.PIG_IRON.getMeltTemp() && !oreStacks.isEmpty()) //Melting one item per sec
{
this.markDirty();
convertToMolten(oreStacks.get(0));
oreStacks.remove(0);
burnTicksLeft = 0; //To consume instantly current fuel
ItemStack tuyereStack = inventory.getStackInSlot(0);
if (!tuyereStack.isEmpty())
{
tuyereStack.damageItem(1, null);
}
}
updateSlagBlock(state.getValue(LIT));
this.oreCount = oreStacks.size();
this.fuelCount = fuelStacks.size();
Expand Down Expand Up @@ -288,6 +278,30 @@ else if (temperature > targetTemperature)
{
((IHeatConsumerBlock) blockCrucible).acceptHeat(world, pos.down(), temperature);
}
oreStacks.removeIf(stack ->
{
IItemHeat cap = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
if (cap != null)
{
// Update temperature of item
float itemTemp = cap.getTemperature();
if (temperature > itemTemp)
{
CapabilityItemHeat.addTemp(cap);
}
if (cap.isMolten())
{
convertToMolten(stack);
ItemStack tuyereStack = inventory.getStackInSlot(0);
if (!tuyereStack.isEmpty())
{
tuyereStack.damageItem(1, null);
}
return true;
}
}
return false;
});
}
if (temperature <= 0 && burnTemperature <= 0)
{
Expand All @@ -297,6 +311,18 @@ else if (temperature > targetTemperature)
}
}

public void debug()
{
TerraFirmaCraft.getLog().debug("Debugging Blast Furnace:");
TerraFirmaCraft.getLog().debug("Temp {} | Burn Temp {} | Fuel Ticks {}", temperature, burnTemperature, burnTicksLeft);
TerraFirmaCraft.getLog().debug("Burning? {}", world.getBlockState(pos).getValue(LIT));
int i = 0;
for (ItemStack item : oreStacks)
{
TerraFirmaCraft.getLog().debug("Slot: {} - NBT: {}", i, item.serializeNBT().toString());
}
}

/**
* Passed from BlockBlastFurnace's IBellowsConsumerBlock
*
Expand Down Expand Up @@ -362,8 +388,6 @@ else if (OreDictionaryHelper.doesStackMatchOre(stack, "dustFlux"))
}
}
//Add each ore consuming flux
//For each ore added, drop temperature
int before = oreStacks.size();
while (maxOre > oreStacks.size())
{
if (fluxEntity == null || oreEntity == null) break;
Expand All @@ -383,13 +407,6 @@ else if (OreDictionaryHelper.doesStackMatchOre(stack, "dustFlux"))
oreEntity = null;
}
}
//Resets
if (before == 0 && !oreStacks.isEmpty()) temperature = 0;
//Drops by % amount
if (before < oreStacks.size())
{
temperature = temperature * before / oreStacks.size();
}
}

private void updateSlagBlock(boolean cooking)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/dries007/tfc/objects/te/TEBloomery.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public boolean canIgnite()

public void onIgnite()
{
this.burnTicksLeft = 100; //15 in-game hours
this.burnTicksLeft = 15000; //15 in-game hours
}

@Override
Expand Down

0 comments on commit fb688d2

Please sign in to comment.