Skip to content

Commit

Permalink
Embeddium compat
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Dec 8, 2024
1 parent db9e1b7 commit 566df48
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.engine_room.flywheel.impl.FlwImplXplat;

public enum CompatMod {
EMBEDDIUM("embeddium"),
IRIS("iris"),
SODIUM("sodium");

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -51,6 +52,8 @@ public FlywheelNeoForge(IEventBus modEventBus, ModContainer modContainer) {

CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString);
FlwImpl.init();

EmbeddiumCompat.init();
}

private static void registerImplEventListeners(IEventBus gameEventBus, IEventBus modEventBus) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});
}
}
}
5 changes: 0 additions & 5 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 566df48

Please sign in to comment.