Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -64,4 +64,11 @@ public void setCleanAmount(int amount) {}

@Override
public void adjustCleanAmount(int amount) {}

// Have a higher priority than the cleanroom multiblock (which doesn't override getPriority so it'll return 0)
// doesn't replace the set cleanroom in multiblocks.
@Override
public int getPriority() {
return Integer.MAX_VALUE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,13 @@ public interface ICleanroomProvider {
* @return the tier {@link gregtech.api.GTValues#V} of energy the cleanroom uses at minimum
*/
int getEnergyTier();

/**
* Get the priority of this cleanroom provider to determine which should be used.
*
* @return the priority this cleanroom provider should have over other cleanrooms.
*/
default int getPriority() {
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ public ICleanroomProvider getCleanroom() {

@Override
public void setCleanroom(ICleanroomProvider provider) {
this.cleanroom = provider;
if (cleanroom == null || provider.getPriority() > cleanroom.getPriority()) {
this.cleanroom = provider;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
@Override
public void addToMultiBlock(MultiblockControllerBase controllerBase) {
super.addToMultiBlock(controllerBase);
if (controllerBase instanceof ICleanroomReceiver &&
((ICleanroomReceiver) controllerBase).getCleanroom() == null) {
((ICleanroomReceiver) controllerBase).setCleanroom(DUMMY_CLEANROOM);
if (controllerBase instanceof ICleanroomReceiver cleanroomReceiver) {
cleanroomReceiver.setCleanroom(DUMMY_CLEANROOM);
}
}

Expand Down
Loading