diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMod.java b/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMod.java index c53fa9ecd..8217cb963 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMod.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMod.java @@ -3,6 +3,7 @@ package dev.engine_room.flywheel.impl.compat; import dev.engine_room.flywheel.impl.FlwImplXplat; public enum CompatMod { + EMBEDDIUM("embeddium"), IRIS("iris"), SODIUM("sodium"); diff --git a/gradle.properties b/gradle.properties index f343ff5c3..04b470b9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,6 +33,8 @@ fabric_api_version = 0.105.0+1.21.1 # Build dependency mod versions sodium_version = mc1.21.1-0.6.0-beta.4 iris_version = 1.8.0-beta.8+1.21.1 +# There is no oculus for 1.21.1 so we will only support iris +embeddium_version = 1.0.11+mc1.21.1 # Publication info group = dev.engine_room.flywheel diff --git a/neoforge/build.gradle.kts b/neoforge/build.gradle.kts index b1383ff3f..9ef36d2f9 100644 --- a/neoforge/build.gradle.kts +++ b/neoforge/build.gradle.kts @@ -89,6 +89,8 @@ dependencies { modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}-neoforge") modCompileOnly("maven.modrinth:iris:${property("iris_version")}-neoforge") + modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") + "forApi"(project(path = ":common", configuration = "commonApiOnly")) "forLib"(project(path = ":common", configuration = "commonLib")) "forBackend"(project(path = ":common", configuration = "commonBackend")) diff --git a/neoforge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java b/neoforge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java index f9c2108cb..4b11ec71e 100644 --- a/neoforge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java +++ b/neoforge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java @@ -8,6 +8,7 @@ import dev.engine_room.flywheel.api.event.EndClientResourceReloadEvent; import dev.engine_room.flywheel.api.event.ReloadLevelRendererEvent; import dev.engine_room.flywheel.backend.compile.FlwProgramsReloader; import dev.engine_room.flywheel.backend.engine.uniform.Uniforms; +import dev.engine_room.flywheel.impl.compat.EmbeddiumCompat; import dev.engine_room.flywheel.impl.visualization.VisualizationEventHandler; import dev.engine_room.flywheel.lib.model.baked.PartialModelEventHandler; import dev.engine_room.flywheel.lib.util.LevelAttached; @@ -51,6 +52,8 @@ public final class FlywheelNeoForge { CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); FlwImpl.init(); + + EmbeddiumCompat.init(); } private static void registerImplEventListeners(IEventBus gameEventBus, IEventBus modEventBus) { diff --git a/neoforge/src/main/java/dev/engine_room/flywheel/impl/compat/EmbeddiumCompat.java b/neoforge/src/main/java/dev/engine_room/flywheel/impl/compat/EmbeddiumCompat.java new file mode 100644 index 000000000..cd1e5e138 --- /dev/null +++ b/neoforge/src/main/java/dev/engine_room/flywheel/impl/compat/EmbeddiumCompat.java @@ -0,0 +1,33 @@ +package dev.engine_room.flywheel.impl.compat; + +import org.embeddedt.embeddium.api.ChunkDataBuiltEvent; + +import dev.engine_room.flywheel.impl.FlwImpl; +import dev.engine_room.flywheel.lib.visualization.VisualizationHelper; + +public final class EmbeddiumCompat { + public static final boolean ACTIVE = CompatMod.EMBEDDIUM.isLoaded; + + static { + if (ACTIVE) { + FlwImpl.LOGGER.debug("Detected Embeddium"); + } + } + + private EmbeddiumCompat() { + } + + public static void init() { + if (ACTIVE) { + Internals.init(); + } + } + + private static final class Internals { + static void init() { + ChunkDataBuiltEvent.BUS.addListener(event -> { + event.getDataBuilder().removeBlockEntitiesIf(VisualizationHelper::tryAddBlockEntity); + }); + } + } +} diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 795cab042..39f3ab61a 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -36,8 +36,3 @@ modId = "sodium" type = "optional" versionRange = "[0.6.0-beta.2,)" side = "CLIENT" - -[[dependencies.${mod_id}]] -modId = "embeddium" -type = "incompatible" -reason = "Remove Embeddium and install Sodium"