Skip to content

Commit

Permalink
fix recipe logic not updating on world reload
Browse files Browse the repository at this point in the history
fix pump "tank exported to is full" logic
  • Loading branch information
PrototypeTrousers committed Nov 30, 2020
1 parent 60a2b47 commit 0a54039
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,18 @@ public void update() {
if (!getMetaTileEntity().getWorld().isRemote) {
if (workingEnabled) {
if (progressTime > 0) {
int currentProgress = progressTime;
updateRecipeProgress();
if (progressTime > currentProgress) {
metaTileEntity.setSituation(WORKING);
} else if (progressTime != 0) {
metaTileEntity.setSituation(INSUFFICIENT_POWER);
}
}
if (progressTime == 0) {
trySearchNewRecipe();
}
if (currentRecipe == null) {
if (currentRecipe == null) {
metaTileEntity.setSituation(NO_MATCHING_RECIPE);
}
if (metaTileEntity.isInputEmpty()) {
metaTileEntity.setSituation(IDLE);
} else {
metaTileEntity.setSituation(NO_MATCHING_RECIPE);
}
} else if (!canOutputsFit()) {
metaTileEntity.setSituation(OUTPUT_INVENTORY_FULL);
}
}
else {
} else {
metaTileEntity.setSituation(DISABLED_BY_CONTROLLER);
}
}
Expand All @@ -145,13 +135,15 @@ boolean canOutputsFit(){
protected void updateRecipeProgress() {
boolean drawEnergy = drawEnergy(recipeEUt);
if (drawEnergy || (recipeEUt < 0)) {
metaTileEntity.setSituation(WORKING);
if (++progressTime >= maxProgressTime) {
completeRecipe();
}
} else if (recipeEUt > 0) {
//only set hasNotEnoughEnergy if this recipe is consuming recipe
//generators always have enough energy
this.hasNotEnoughEnergy = true;
metaTileEntity.setSituation(INSUFFICIENT_POWER);
//if current progress value is greater than 2, decrement it by 2
if (progressTime >= 2) {
if (ConfigHolder.insufficientEnergySupplyWipesRecipeProgress) {
Expand Down Expand Up @@ -183,6 +175,8 @@ protected void trySearchNewRecipe() {
}
if (this.currentRecipe != null && setupAndConsumeRecipeInputs(this.currentRecipe)) {
setupRecipe(this.currentRecipe);
} else {
metaTileEntity.setSituation(OUTPUT_INVENTORY_FULL);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ public void pushFluidsIntoNearbyHandlers(EnumFacing... allowedFaces) {
if (fluidHandler == null || myFluidHandler == null) {
continue;
}
if (GTFluidUtils.transferFluids(myFluidHandler, fluidHandler, Integer.MAX_VALUE) == 0) {
if (GTFluidUtils.transferFluids(myFluidHandler, fluidHandler, Integer.MAX_VALUE) == Integer.MAX_VALUE ) {
this.failedToMoveFluids = true;
}
}
Expand Down

0 comments on commit 0a54039

Please sign in to comment.