Embeddium compat

This commit is contained in:
IThundxr 2024-12-08 11:06:48 -05:00
parent db9e1b753a
commit 566df485d5
Failed to generate hash of commit
6 changed files with 41 additions and 5 deletions

View file

@ -3,6 +3,7 @@ package dev.engine_room.flywheel.impl.compat;
import dev.engine_room.flywheel.impl.FlwImplXplat; import dev.engine_room.flywheel.impl.FlwImplXplat;
public enum CompatMod { public enum CompatMod {
EMBEDDIUM("embeddium"),
IRIS("iris"), IRIS("iris"),
SODIUM("sodium"); SODIUM("sodium");

View file

@ -33,6 +33,8 @@ fabric_api_version = 0.105.0+1.21.1
# Build dependency mod versions # Build dependency mod versions
sodium_version = mc1.21.1-0.6.0-beta.4 sodium_version = mc1.21.1-0.6.0-beta.4
iris_version = 1.8.0-beta.8+1.21.1 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 # Publication info
group = dev.engine_room.flywheel group = dev.engine_room.flywheel

View file

@ -89,6 +89,8 @@ dependencies {
modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}-neoforge") modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}-neoforge")
modCompileOnly("maven.modrinth:iris:${property("iris_version")}-neoforge") modCompileOnly("maven.modrinth:iris:${property("iris_version")}-neoforge")
modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}")
"forApi"(project(path = ":common", configuration = "commonApiOnly")) "forApi"(project(path = ":common", configuration = "commonApiOnly"))
"forLib"(project(path = ":common", configuration = "commonLib")) "forLib"(project(path = ":common", configuration = "commonLib"))
"forBackend"(project(path = ":common", configuration = "commonBackend")) "forBackend"(project(path = ":common", configuration = "commonBackend"))

View file

@ -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.api.event.ReloadLevelRendererEvent;
import dev.engine_room.flywheel.backend.compile.FlwProgramsReloader; import dev.engine_room.flywheel.backend.compile.FlwProgramsReloader;
import dev.engine_room.flywheel.backend.engine.uniform.Uniforms; 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.impl.visualization.VisualizationEventHandler;
import dev.engine_room.flywheel.lib.model.baked.PartialModelEventHandler; import dev.engine_room.flywheel.lib.model.baked.PartialModelEventHandler;
import dev.engine_room.flywheel.lib.util.LevelAttached; import dev.engine_room.flywheel.lib.util.LevelAttached;
@ -51,6 +52,8 @@ public final class FlywheelNeoForge {
CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString);
FlwImpl.init(); FlwImpl.init();
EmbeddiumCompat.init();
} }
private static void registerImplEventListeners(IEventBus gameEventBus, IEventBus modEventBus) { private static void registerImplEventListeners(IEventBus gameEventBus, IEventBus modEventBus) {

View file

@ -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);
});
}
}
}

View file

@ -36,8 +36,3 @@ modId = "sodium"
type = "optional" type = "optional"
versionRange = "[0.6.0-beta.2,)" versionRange = "[0.6.0-beta.2,)"
side = "CLIENT" side = "CLIENT"
[[dependencies.${mod_id}]]
modId = "embeddium"
type = "incompatible"
reason = "Remove Embeddium and install Sodium"