Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the large miner crashing when cycling layers #980

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine;
import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI;
import com.gregtechceu.gtceu.common.data.GTMachines;
import com.gregtechceu.gtceu.common.machine.trait.miner.MinerLogic;
import com.gregtechceu.gtceu.data.lang.LangHandler;
import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget;
import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup;
import com.lowdragmc.lowdraglib.gui.widget.SlotWidget;
import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup;
import com.lowdragmc.lowdraglib.misc.FluidTransferList;
import com.lowdragmc.lowdraglib.misc.ItemStackTransfer;
import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper;
import com.lowdragmc.lowdraglib.syncdata.ISubscription;
Expand Down Expand Up @@ -323,7 +320,7 @@ else if (playerIn.isCrouching())
else
getRecipeLogic().setCurrentRadius(Math.max(1, currentRadius - 1));

getRecipeLogic().resetArea();
getRecipeLogic().resetArea(true);

int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius());
playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han
int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius());
playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea));
}
getRecipeLogic().resetArea();
getRecipeLogic().resetArea(true);
} else {
playerIn.sendSystemMessage(Component.translatable("gtceu.multiblock.large_miner.errorradius"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void setChunkMode(boolean isChunkMode) {
if (!isWorking()) {
this.isChunkMode = isChunkMode;
if (!getMachine().isRemote()) {
resetArea();
resetArea(true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public MinerLogic(@Nonnull IRecipeLogicMachine machine, int fortune, int speed,
@Override
public void resetRecipeLogic() {
super.resetRecipeLogic();
resetArea();
resetArea(false);
this.cachedItemTransfer = null;
this.pipeLength = 0;
}
Expand Down Expand Up @@ -445,12 +445,14 @@ public void checkBlocksToMine() {
/**
* Recalculates the mining area, refills the block list and restarts the miner, if it was done
*/
public void resetArea() {
public void resetArea(boolean checkToMine) {
initPos(getMiningPos(), currentRadius);
if (this.isDone) this.setWorkingEnabled(false);
this.isDone = false;
blocksToMine.clear();
checkBlocksToMine();
if (checkToMine) {
blocksToMine.clear();
checkBlocksToMine();
}
}

/**
Expand Down
Loading