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