Fix electric furnace energy usage. Closes #1920

This commit is contained in:
drcrazy 2019-12-25 03:49:11 +03:00
parent 99b2342a1c
commit a37a6e29a5

View file

@ -57,7 +57,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
private int cookTime;
private int cookTimeTotal;
// Energy cost per tick of cooking
final int EnergyPerTick = 4;
final int EnergyPerTick = 1;
public ElectricFurnaceBlockEntity() {
super(TRBlockEntities.ELECTRIC_FURNACE );
@ -99,9 +99,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
return true;
}
if (ItemUtils.isItemEqual(inventory.getInvStack(slot), recipeOutput, true, true)) {
if (recipeOutput.getCount() + inventory.getInvStack(slot).getCount() <= recipeOutput.getMaxCount()) {
return true;
}
return recipeOutput.getCount() + inventory.getInvStack(slot).getCount() <= recipeOutput.getMaxCount();
}
return false;
}
@ -116,12 +114,8 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
if (!canAcceptOutput(currentRecipe, outputSlot)) {
return false;
}
if (getEnergy() < currentRecipe.getCookTime() * getEuPerTick(EnergyPerTick)) {
return false;
}
return true;
}
return !(getEnergy() < currentRecipe.getCookTime() * getEuPerTick(EnergyPerTick));
}
private void resetCrafter() {
currentRecipe = null;
@ -148,13 +142,9 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
if (inventory.getInvStack(inputSlot).isEmpty()) {
return false;
}
if (!recipe.matches(inventory, world)) {
return false;
}
return true;
}
return recipe.matches(inventory, world);
}
private void craftRecipe(SmeltingRecipe recipe) {
if (recipe == null) {