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

Cache last recipe done by Target Chamber #3738

Merged
merged 3 commits into from
Jan 3, 2025
Merged
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 @@ -62,6 +62,7 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber
private static final int CASING_INDEX_FRONT = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings3, 10); // Grate
private static final int CASING_INDEX_CENTRE = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings5, 14); // Shielded
// Acc.
private RecipeTC lastRecipe;

private float inputEnergy;
private float inputRate;
Expand Down Expand Up @@ -270,6 +271,7 @@ public boolean checkRecipe(ItemStack itemStack) {
&& !(inputInfo.getEnergy() < recipeTc.minEnergy || inputInfo.getEnergy() > recipeTc.maxEnergy));

})
.cachedRecipe(this.lastRecipe)
.find();

if (tRecipe == null) return false;
Expand Down Expand Up @@ -329,6 +331,8 @@ public boolean checkRecipe(ItemStack itemStack) {
if (maxParallel < 1) // Insufficient items
return false;

if (!tRecipe.equals(this.lastRecipe)) this.lastRecipe = tRecipe;

if (batchAmount > maxParallel) batchAmount = (int) maxParallel;

tRecipe.consumeInput(batchAmount, new FluidStack[] {}, tItemsWithFocusItemArray);
Expand Down Expand Up @@ -393,6 +397,8 @@ public boolean checkMachine(IGregTechTileEntity arg0, ItemStack arg1) {
mInputBeamline.clear();
mInputFocus.clear();

this.lastRecipe = null;

if (!checkPiece("base", 2, 4, 0)) return false;

return this.mInputBeamline.size() == 1 && this.mMaintenanceHatches.size() == 1
Expand Down
Loading