Skip to content

Commit

Permalink
fix: Race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Mar 17, 2024
1 parent e8c96bf commit 10130fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.null2264.cobblegen;

import io.github.null2264.cobblegen.CobbleGen;
import io.github.null2264.cobblegen.data.CGRegistryImpl;
import io.github.null2264.cobblegen.data.model.CGRegistry;
import io.github.null2264.cobblegen.data.model.Generator;
Expand Down Expand Up @@ -160,6 +161,8 @@ public boolean interact(LevelAccessor level, BlockPos pos, BlockState state, boo
*/
@ApiStatus.Internal
public Optional<BlockState> interactFromPipeState(Level level, BlockPos pos, Fluid fluid1, Fluid fluid2) {
if (CobbleGen.META_CONFIG.create.disablePipe) return Optional.empty();

Fluid source;
Fluid neighbour;
List<Generator> generators = generatorMap.get(fluid1);
Expand Down Expand Up @@ -228,4 +231,4 @@ public static Map<Fluid, List<Generator>> read(FriendlyByteBuf buf) {
}
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.null2264.cobblegen.mixin.core;

import io.github.null2264.cobblegen.CobbleGen;
import io.github.null2264.cobblegen.compat.LoaderCompat;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
Expand Down Expand Up @@ -50,10 +49,8 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (mixinClassName.contains("CreateFluidReactionsMixin")) {
if (!LoaderCompat.isModLoaded("create")) return false;

if (mixinClassName.endsWith("PatchF")) return isPatchFOrNewer() >= 1 && !CobbleGen.META_CONFIG.create.disablePipe;
if (mixinClassName.endsWith("PatchE")) return isPatchFOrNewer() <= 0 && !CobbleGen.META_CONFIG.create.disablePipe;

return !CobbleGen.META_CONFIG.create.disablePipe;
if (mixinClassName.endsWith("PatchF")) return isPatchFOrNewer() >= 1;
if (mixinClassName.endsWith("PatchE")) return isPatchFOrNewer() <= 0;
}
return true;
}
Expand Down

0 comments on commit 10130fb

Please sign in to comment.