diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java index f9f91f56e..0bfe20b5d 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java @@ -1,18 +1,16 @@ package dev.engine_room.flywheel.impl; -import java.util.function.BooleanSupplier; - import dev.engine_room.flywheel.api.internal.DependencyInjection; import net.minecraft.client.multiplayer.ClientLevel; public interface FlwImplXplat { FlwImplXplat INSTANCE = DependencyInjection.load(FlwImplXplat.class, "dev.engine_room.flywheel.impl.FlwImplXplatImpl"); + boolean getModLoaded(String modId); + void dispatchReloadLevelRendererEvent(ClientLevel level); String getVersionStr(); FlwConfig getConfig(); - - BooleanSupplier getModLoaded(String modId); } diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java b/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java index 1ff9f2be4..6c5e20e53 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java @@ -1,20 +1,14 @@ package dev.engine_room.flywheel.impl.compat; -import java.util.function.BooleanSupplier; - import dev.engine_room.flywheel.impl.FlwImplXplat; public enum CompatMods { SODIUM("sodium"), IRIS("iris"); - private final BooleanSupplier isLoaded; - - CompatMods(String modid) { - isLoaded = FlwImplXplat.INSTANCE.getModLoaded(modid); - } + public final boolean isLoaded; - public boolean isLoaded() { - return isLoaded.getAsBoolean(); + CompatMods(String modId) { + isLoaded = FlwImplXplat.INSTANCE.getModLoaded(modId); } } diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/mixin/BlockEntityTypeMixin.java b/common/src/main/java/dev/engine_room/flywheel/impl/mixin/BlockEntityTypeMixin.java index 7c6589214..631d1ead6 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/mixin/BlockEntityTypeMixin.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/mixin/BlockEntityTypeMixin.java @@ -29,7 +29,7 @@ abstract class BlockEntityTypeMixin implements BlockEntit @Override public void flywheel$setVisualizer(@Nullable BlockEntityVisualizer visualizer) { - if (CompatMods.SODIUM.isLoaded()) { + if (CompatMods.SODIUM.isLoaded) { if (flywheel$visualizer == null && visualizer != null) { flywheel$sodiumPredicate = SodiumCompat.forBlockEntityType((BlockEntityType) (Object) this); } else if (flywheel$visualizer != null && visualizer == null && flywheel$sodiumPredicate != null) { diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java index 5a75e971d..4c1ea44c2 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java @@ -1,12 +1,15 @@ package dev.engine_room.flywheel.impl; -import java.util.function.BooleanSupplier; - import dev.engine_room.flywheel.api.event.ReloadLevelRendererCallback; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.multiplayer.ClientLevel; public class FlwImplXplatImpl implements FlwImplXplat { + @Override + public boolean getModLoaded(String modId) { + return FabricLoader.getInstance().isModLoaded(modId); + } + @Override public void dispatchReloadLevelRendererEvent(ClientLevel level) { ReloadLevelRendererCallback.EVENT.invoker().onReloadLevelRenderer(level); @@ -21,9 +24,4 @@ public String getVersionStr() { public FlwConfig getConfig() { return FabricFlwConfig.INSTANCE; } - - @Override - public BooleanSupplier getModLoaded(String modId) { - return () -> FabricLoader.getInstance().isModLoaded(modId); - } } diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java index b081fd9d6..0a372485f 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java @@ -52,7 +52,7 @@ public MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter le @Override @Nullable public ShadersModHandler.InternalHandler createIrisHandler() { - if (!CompatMods.IRIS.isLoaded()) { + if (!CompatMods.IRIS.isLoaded) { return null; } diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java index ba80f96fe..774665549 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java @@ -1,13 +1,16 @@ package dev.engine_room.flywheel.impl; -import java.util.function.BooleanSupplier; - import dev.engine_room.flywheel.api.event.ReloadLevelRendererEvent; import net.minecraft.client.multiplayer.ClientLevel; import net.neoforged.fml.loading.LoadingModList; import net.neoforged.neoforge.common.NeoForge; public class FlwImplXplatImpl implements FlwImplXplat { + @Override + public boolean getModLoaded(String modId) { + return LoadingModList.get().getModFileById(modId) != null; + } + @Override public void dispatchReloadLevelRendererEvent(ClientLevel level) { NeoForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level)); @@ -22,9 +25,4 @@ public String getVersionStr() { public FlwConfig getConfig() { return NeoForgeFlwConfig.INSTANCE; } - - @Override - public BooleanSupplier getModLoaded(String modId) { - return () -> LoadingModList.get().getModFileById(modId) != null; - } } diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java index 278094cb4..0dfbbc4f7 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java @@ -2,9 +2,6 @@ import java.lang.reflect.Field; -import dev.engine_room.flywheel.lib.model.baked.NeoForgeBlockModelBuilder; -import dev.engine_room.flywheel.lib.model.baked.NeoForgeMultiBlockModelBuilder; - import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -12,8 +9,10 @@ import dev.engine_room.flywheel.lib.internal.FlwLibXplat; import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder; import dev.engine_room.flywheel.lib.model.baked.BlockModelBuilder; -import dev.engine_room.flywheel.lib.model.baked.NeoForgeBakedModelBuilder; import dev.engine_room.flywheel.lib.model.baked.MultiBlockModelBuilder; +import dev.engine_room.flywheel.lib.model.baked.NeoForgeBakedModelBuilder; +import dev.engine_room.flywheel.lib.model.baked.NeoForgeBlockModelBuilder; +import dev.engine_room.flywheel.lib.model.baked.NeoForgeMultiBlockModelBuilder; import dev.engine_room.flywheel.lib.util.ShadersModHandler; import net.irisshaders.iris.api.v0.IrisApi; import net.minecraft.client.Minecraft; @@ -70,7 +69,7 @@ public MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter le @Override @Nullable public ShadersModHandler.InternalHandler createIrisHandler() { - if (!CompatMods.IRIS.isLoaded()) { + if (!CompatMods.IRIS.isLoaded) { return null; }