Skip to content

Commit

Permalink
Waiting status should not call preWorking/postWorking function
Browse files Browse the repository at this point in the history
  • Loading branch information
iamSmallY committed Apr 15, 2024
1 parent 45da6c0 commit fbdcbbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ public void scheduleRenderUpdate() {
* Call it to abort current recipe and reset the first state.
*/
public void resetRecipeLogic() {
setStatus(Status.IDLE);
recipeDirty = false;
lastRecipe = null;
lastOriginRecipe = null;
progress = 0;
duration = 0;
fuelTime = 0;
lastFailedMatches = null;
setStatus(Status.IDLE);
updateTickSubscription();
}

Expand Down Expand Up @@ -326,9 +326,9 @@ private void notifyRecipeStatusChanged(Status oldStatus, Status newStatus) {
if (lastRecipe == null) {
return;
}
if (oldStatus == Status.WORKING && newStatus != Status.WORKING) {
if (oldStatus == Status.WORKING && newStatus != Status.WORKING && newStatus != Status.WAITING) {
lastRecipe.postWorking(machine);
} else if (oldStatus != Status.WORKING && newStatus == Status.WORKING) {
} else if (oldStatus != Status.WAITING && oldStatus != Status.WORKING && newStatus == Status.WORKING) {
lastRecipe.preWorking(machine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IWorkableMultiController;
import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine;
import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine;
import com.gregtechceu.gtceu.common.machine.trait.NotifiableStressTrait;
Expand Down Expand Up @@ -69,4 +70,11 @@ public void onRotated(Direction oldFacing, Direction newFacing) {
public boolean shouldOpenUI(Player player, InteractionHand hand, BlockHitResult hit) {
return false;
}

@Override
public boolean onWaiting(IWorkableMultiController controller) {
getKineticHolder().stopWorking();
return super.onWaiting(controller);
}

}

0 comments on commit fbdcbbf

Please sign in to comment.