Skip to content

Commit 754073c

Browse files
committed
fix: Loader
1 parent a371e85 commit 754073c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

cobblegen/src/main/java/io/github/null2264/cobblegen/compat/LoaderCompat.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.nio.file.FileSystems;
1010
import java.nio.file.Files;
1111
#endif
12-
#else
12+
#elif FORGE
1313
#if FORGE>=2 && MC>=12002
1414
import net.neoforged.fml.loading.FMLPaths;
1515
import net.neoforged.fml.ModList;
@@ -19,6 +19,8 @@
1919
import net.minecraftforge.fml.ModList;
2020
import net.minecraftforge.fml.loading.LoadingModList;
2121
#endif
22+
#else
23+
#error "Invalid loader name"
2224
#endif
2325

2426
public class LoaderCompat {
@@ -35,7 +37,7 @@ public static boolean isModLoaded(String mod) {
3537

3638
public static Path getConfigDir() {
3739
#if FABRIC
38-
#if MC>1.16.5
40+
#if MC>11605
3941
return FabricLoader.getInstance().getConfigDir();
4042
#else
4143
// Not ideal, but configDir is null somehow in 1.16.5
@@ -49,26 +51,28 @@ public static Path getConfigDir() {
4951
}
5052
return configDir;
5153
#endif
52-
#else
54+
#elif FORGE
5355
return FMLPaths.CONFIGDIR.get();
56+
#else
57+
#error "Invalid loader name"
5458
#endif
5559
}
5660

5761
public static LoaderType getType() {
58-
#if FABRIC>=1
62+
#if FABRIC
5963
#if FABRIC==1
6064
return LoaderType.FABRIC;
6165
#else
6266
return LoaderType.QUILT;
6367
#endif
64-
#elif FORGE>=1
68+
#elif FORGE
6569
#if FORGE==1
6670
return LoaderType.FORGE;
6771
#else
6872
return LoaderType.NEOFORGE;
6973
#endif
7074
#else
71-
throw new RuntimeException("Unsupported Loader");
75+
#error "Invalid loader name"
7276
#endif
7377
}
7478

cobblegen/src/main/java/io/github/null2264/cobblegen/mixin/create/CreateFluidReactionsMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class CreateFluidReactionsMixin
2020
{
2121
@Inject(
2222
method = "handlePipeSpillCollision",
23-
#if FABRIC<=0
23+
#if FORGE
2424
remap = false,
2525
#endif
2626
at = @At(value = "HEAD"),

cobblegen/src/main/java/io/github/null2264/cobblegen/mixin/fluid/FluidEventMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private void doInteraction(Level level, BlockPos pos, BlockState state, Callback
4040
cir.setReturnValue(false);
4141
}
4242

43-
#if MC>=11900 && FABRIC<=0
43+
#if MC>=11900 && FORGE
4444
@Inject(method = "onPlace", at = @At("HEAD"), cancellable = true)
4545
private void fluidInteraction$onPlace(
4646
BlockState state,

0 commit comments

Comments
 (0)