Skip to content

Commit 80d3ed8

Browse files
address issues brought up
1 parent 4323cbd commit 80d3ed8

2 files changed

Lines changed: 11 additions & 18 deletions

File tree

src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public <T> T getCapability(Capability<T> capability) {
109109
@Override
110110
public void update() {
111111
World world = getMetaTileEntity().getWorld();
112-
if (world == null || !world.isRemote) {
112+
if (world != null && !world.isRemote) {
113113
if (workingEnabled) {
114114
if (progressTime > 0) {
115115
updateRecipeProgress();
@@ -182,7 +182,6 @@ protected void trySearchNewRecipe() {
182182
currentRecipe = this.previousRecipe;
183183
// If there is no active recipe, then we need to find one.
184184
else {
185-
metaTileEntity.setInputsDirty(false);
186185
currentRecipe = findRecipe(maxVoltage, importInventory, importFluids);
187186
}
188187
// If a recipe was found, then inputs were valid.
@@ -196,11 +195,10 @@ protected void trySearchNewRecipe() {
196195
} else this.invalidInputsForRecipes = !this.isOutputsFull;
197196

198197
// proceed if we have a usable recipe.
199-
if (currentRecipe != null && setupAndConsumeRecipeInputs(currentRecipe)) {
198+
if (currentRecipe != null && setupAndConsumeRecipeInputs(currentRecipe))
200199
setupRecipe(currentRecipe);
201-
//avoid new recipe lookup caused by item consumption from input
202-
metaTileEntity.setInputsDirty(false);
203-
}
200+
// Inputs have been inspected.
201+
metaTileEntity.setInputsDirty(false);
204202
}
205203

206204
public void forceRecipeRecheck() {

src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiFurnace.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,25 @@ protected void trySearchNewRecipe() {
103103
//for MultiSmelter, we can reuse previous recipe if inputs didn't change
104104
//otherwise, we need to recompute it for new ingredients
105105
//but technically, it means we can cache multi smelter recipe, but changing inputs have more priority
106-
if (metaTileEntity.isInputsDirty()) {
107-
metaTileEntity.setInputsDirty(false);
106+
if (metaTileEntity.isInputsDirty() ||
107+
previousRecipe == null ||
108+
!previousRecipe.matches(false,importInventory,importFluids)) {
108109
//Inputs changed, try searching new recipe for given inputs
109110
currentRecipe = findRecipe(maxVoltage, importInventory, importFluids);
110-
} else if (previousRecipe != null && previousRecipe.matches(false, importInventory, importFluids)) {
111+
} else {
111112
//if previous recipe still matches inputs, try to use it
112113
currentRecipe = previousRecipe;
113-
} else {
114-
metaTileEntity.setInputsDirty(false);
115-
currentRecipe = findRecipe(maxVoltage, importInventory, importFluids);
116114
}
117115
if (currentRecipe != null)
118116
// replace old recipe with new one
119117
this.previousRecipe = currentRecipe;
120-
121118
// proceed if we have a usable recipe.
122-
if (currentRecipe != null && setupAndConsumeRecipeInputs(currentRecipe)) {
119+
if (currentRecipe != null && setupAndConsumeRecipeInputs(currentRecipe))
123120
setupRecipe(currentRecipe);
124-
//avoid new recipe lookup caused by item consumption from input
125-
metaTileEntity.setInputsDirty(false);
126-
}
121+
// Inputs have been inspected.
122+
metaTileEntity.setInputsDirty(false);
127123
}
128124

129-
130125
@Override
131126
protected Recipe findRecipe(long maxVoltage,
132127
IItemHandlerModifiable inputs,

0 commit comments

Comments
 (0)