Skip to content

Commit 8850a5f

Browse files
fix recipe logic not updating on world reload
fix pump "tank exported to is full" logic
1 parent 60a2b47 commit 8850a5f

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,28 +106,18 @@ public void update() {
106106
if (!getMetaTileEntity().getWorld().isRemote) {
107107
if (workingEnabled) {
108108
if (progressTime > 0) {
109-
int currentProgress = progressTime;
110109
updateRecipeProgress();
111-
if (progressTime > currentProgress) {
112-
metaTileEntity.setSituation(WORKING);
113-
} else if (progressTime != 0) {
114-
metaTileEntity.setSituation(INSUFFICIENT_POWER);
115-
}
116110
}
117111
if (progressTime == 0) {
118-
trySearchNewRecipe();
119-
}
120-
if (currentRecipe == null) {
121112
if (metaTileEntity.isInputEmpty()) {
122113
metaTileEntity.setSituation(IDLE);
123-
} else {
114+
}
115+
trySearchNewRecipe();
116+
if (currentRecipe == null) {
124117
metaTileEntity.setSituation(NO_MATCHING_RECIPE);
125118
}
126-
} else if (!canOutputsFit()) {
127-
metaTileEntity.setSituation(OUTPUT_INVENTORY_FULL);
128119
}
129-
}
130-
else {
120+
} else {
131121
metaTileEntity.setSituation(DISABLED_BY_CONTROLLER);
132122
}
133123
}
@@ -145,13 +135,15 @@ boolean canOutputsFit(){
145135
protected void updateRecipeProgress() {
146136
boolean drawEnergy = drawEnergy(recipeEUt);
147137
if (drawEnergy || (recipeEUt < 0)) {
138+
metaTileEntity.setSituation(WORKING);
148139
if (++progressTime >= maxProgressTime) {
149140
completeRecipe();
150141
}
151142
} else if (recipeEUt > 0) {
152143
//only set hasNotEnoughEnergy if this recipe is consuming recipe
153144
//generators always have enough energy
154145
this.hasNotEnoughEnergy = true;
146+
metaTileEntity.setSituation(INSUFFICIENT_POWER);
155147
//if current progress value is greater than 2, decrement it by 2
156148
if (progressTime >= 2) {
157149
if (ConfigHolder.insufficientEnergySupplyWipesRecipeProgress) {
@@ -183,6 +175,8 @@ protected void trySearchNewRecipe() {
183175
}
184176
if (this.currentRecipe != null && setupAndConsumeRecipeInputs(this.currentRecipe)) {
185177
setupRecipe(this.currentRecipe);
178+
} else {
179+
metaTileEntity.setSituation(OUTPUT_INVENTORY_FULL);
186180
}
187181
}
188182

src/main/java/gregtech/api/metatileentity/MetaTileEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ public void pushFluidsIntoNearbyHandlers(EnumFacing... allowedFaces) {
858858
if (fluidHandler == null || myFluidHandler == null) {
859859
continue;
860860
}
861-
if (GTFluidUtils.transferFluids(myFluidHandler, fluidHandler, Integer.MAX_VALUE) == 0) {
861+
if (GTFluidUtils.transferFluids(myFluidHandler, fluidHandler, Integer.MAX_VALUE) == Integer.MAX_VALUE ) {
862862
this.failedToMoveFluids = true;
863863
}
864864
}

0 commit comments

Comments
 (0)