Skip to content

Commit

Permalink
Fix PA & Cleanroom Sync Issues (GregTechCEu#2566)
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit authored Aug 7, 2024
1 parent d302eda commit e96f99c
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ public int getItemOutputLimit() {
return mte == null ? 0 : mte.getItemOutputLimit();
}

@Override
public void setCleanroom(ICleanroomProvider provider) {
super.setCleanroom(provider);

// Sync Cleanroom Change to Internal Workable MTE
((ProcessingArrayWorkable) this.recipeMapWorkable).updateCleanroom();
}

@SuppressWarnings("InnerClassMayBeStatic")
protected class ProcessingArrayWorkable extends MultiblockRecipeLogic {

Expand Down Expand Up @@ -334,15 +342,7 @@ public void findMachineStack() {
mte = holder.setMetaTileEntity(mte);
holder.setWorld(this.metaTileEntity.getWorld());

// Set the cleanroom of the MTEs to the PA's cleanroom reference
if (mte instanceof ICleanroomReceiver receiver) {
if (ConfigHolder.machines.cleanMultiblocks) {
receiver.setCleanroom(DUMMY_CLEANROOM);
} else {
ICleanroomProvider provider = controller.getCleanroom();
if (provider != null) receiver.setCleanroom(provider);
}
}
updateCleanroom();
}

// Find the voltage tier of the machine.
Expand All @@ -353,6 +353,18 @@ public void findMachineStack() {
this.currentMachineStack = machine;
}

private void updateCleanroom() {
// Set the cleanroom of the MTEs to the PA's cleanroom reference
if (mte instanceof ICleanroomReceiver receiver) {
if (ConfigHolder.machines.cleanMultiblocks) {
receiver.setCleanroom(DUMMY_CLEANROOM);
} else {
ICleanroomProvider provider = ((RecipeMapMultiblockController) metaTileEntity).getCleanroom();
if (provider != null) receiver.setCleanroom(provider);
}
}
}

@Override
public boolean checkRecipe(@NotNull Recipe recipe) {
if (mte == null) return false;
Expand Down

0 comments on commit e96f99c

Please sign in to comment.