Skip to content

Commit

Permalink
change way machines are banned
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 committed Feb 5, 2022
1 parent 3436b1f commit 0028d67
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ protected static TraceabilityPredicate doorPredicate() {
return new TraceabilityPredicate(blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof BlockDoor);
}

// protected to allow easy addition of addon "cleanrooms"
@Nonnull
protected TraceabilityPredicate innerPredicate() {
return new TraceabilityPredicate(blockWorldState -> {
Expand All @@ -218,16 +217,13 @@ protected TraceabilityPredicate innerPredicate() {

MetaTileEntity metaTileEntity = ((MetaTileEntityHolder) tileEntity).getMetaTileEntity();

// blacklisted machines: mufflers, all generators, other cleanrooms
if (metaTileEntity instanceof IMufflerHatch)
return false;
if (metaTileEntity instanceof SimpleGeneratorMetaTileEntity)
return false;
if (metaTileEntity instanceof FuelMultiblockController)
return false;
// always ban other cleanrooms, can cause problems otherwise
if (metaTileEntity instanceof ICleanroomProvider)
return false;

if (isMachineBanned(metaTileEntity))
return false;

// the machine does not need a cleanroom, so do nothing more
if (!(metaTileEntity instanceof ICleanroomReceiver))
return true;
Expand All @@ -240,6 +236,18 @@ protected TraceabilityPredicate innerPredicate() {
});
}

protected boolean isMachineBanned(MetaTileEntity metaTileEntity) {
// blacklisted machines: mufflers and all generators
if (metaTileEntity instanceof IMufflerHatch)
return true;
if (metaTileEntity instanceof SimpleGeneratorMetaTileEntity)
return true;
if (metaTileEntity instanceof FuelMultiblockController)
return true;

return false;
}

@Override
protected void addDisplayText(List<ITextComponent> textList) {
super.addDisplayText(textList);
Expand Down

0 comments on commit 0028d67

Please sign in to comment.