GregTechCEu Modern

GregTechCEu Modern

6M Downloads

Air Scrubber processes constantly, when attached to a duct, and will prevent duct network from accepting pollution?

fluffle opened this issue ยท 1 comments

commented

Checked for existing issues

  • I have checked for existing issues, and have found none.

Tested latest version

  • I have checked that this occurs on the latest version.

GregTech CEu Version

1.4.6

Minecraft Version

1.20.1

Recipe Viewer Installed

EMI

Environment

Singleplayer

Cross-Mod Interaction

No

Other Installed Mods

Terrafirmagreg Modern 0.8.1 beta

Expected Behavior

Ducts are supposed to move pollution particles around, so you can attach them to e.g. muffler hatches, and pipe pollution to either different chunks or air scrubbers.

Air scrubbers remove pollution in chunks, or from a connected Duct pipenet.

Actual Behavior

If a duct is connected to an Air Scrubber, it will simply process its recipe, continually producing carbon monoxide from nothing: L82 here just returns true.

for (Direction dir : GTUtil.DIRECTIONS) {
BlockPos offset = getPos().relative(dir);
if (GTCapabilityHelper.getHazardContainer(getLevel(), offset, dir.getOpposite()) != null) {
if (getLevel().getBlockEntity(offset) instanceof DuctPipeBlockEntity duct &&
!duct.isConnected(dir.getOpposite())) {
continue;
}
return true;
}
}

When pollution is inserted into a Duct pipenet it looks for a scrubber:

https://github.com/GregTechCEu/GregTech-Modern/blob/c64bd1d549a4484e7194a5333a6fc3ced361d164/src/main/java/com/gregtechceu/gtceu/common/pipelike/duct/DuctNetHandler.java#L65-73

If it finds one it calls cleanHazard, which, because the recipe is always running if a duct is connected, will just do nothing:

public void cleanHazard(MedicalCondition condition, float amount) {
if (this.recipeLogic.isActive()) {
return;
}
GTRecipeBuilder builder = GTRecipeTypes.AIR_SCRUBBER_RECIPES.recipeBuilder(condition.name + "_autogen")
.duration(200).EUt(VHA[LV]);
condition.recipeModifier.accept(builder);
this.recipeLogic.checkMatchedRecipeAvailable(builder.buildRawRecipe());
}

But this breaks the for loop scanning the DuctRoutePath, without updating the total amount of pollution consumed, causing the total pollution changed to be returned as zero. Not that the Muffler Hatch checks the returned value, it just assumes the pollution has been dealt with:

if (self().getLevel() instanceof ServerLevel serverLevel) {
IHazardParticleContainer container = GTCapabilityHelper.getHazardContainer(serverLevel,
self().getPos().relative(self().getFrontFacing()), self().getFrontFacing().getOpposite());
if (container != null &&
container.getHazardCanBeInserted(getConditionToEmit()) > getHazardStrengthPerOperation()) {
container.addHazard(getConditionToEmit(), getHazardStrengthPerOperation());
return;

Steps to Reproduce

Read the code.

Additional Information

I think this means that all pollution can be ducted to a single LV scrubber which will conveniently void it?