From dc43d22c8b7823a7eeff81d8bbde4d7f9ba76667 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:57:40 -0600 Subject: [PATCH] Update virtual rendering workarounds - Require Fabric API >=0.75.1 - Only wrap with CullingBakedModel if Indium is installed --- .../com/jozufozu/flywheel/fabric/model/CullingBakedModel.java | 2 +- .../com/jozufozu/flywheel/fabric/model/FabricModelUtil.java | 4 ++-- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/jozufozu/flywheel/fabric/model/CullingBakedModel.java b/src/main/java/com/jozufozu/flywheel/fabric/model/CullingBakedModel.java index 897935401..e0dbdf490 100644 --- a/src/main/java/com/jozufozu/flywheel/fabric/model/CullingBakedModel.java +++ b/src/main/java/com/jozufozu/flywheel/fabric/model/CullingBakedModel.java @@ -21,7 +21,7 @@ public class CullingBakedModel extends ForwardingBakedModel { protected final BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); public static BakedModel wrap(BakedModel model) { - if (!FabricModelUtil.FREX_LOADED) { + if (FabricModelUtil.INDIUM_LOADED) { CullingBakedModel wrapper = THREAD_LOCAL.get(); wrapper.wrapped = model; return wrapper; diff --git a/src/main/java/com/jozufozu/flywheel/fabric/model/FabricModelUtil.java b/src/main/java/com/jozufozu/flywheel/fabric/model/FabricModelUtil.java index b81ac7569..f8832d384 100644 --- a/src/main/java/com/jozufozu/flywheel/fabric/model/FabricModelUtil.java +++ b/src/main/java/com/jozufozu/flywheel/fabric/model/FabricModelUtil.java @@ -25,7 +25,7 @@ public class FabricModelUtil { private static final ShadedPredicate SHADED_PREDICATE = createShadedPredicate(); private static BlendModeGetter createBlendModeGetter() { - if (FabricLoader.getInstance().isModLoaded("frex")) { + if (FREX_LOADED) { try { Field frexQuadField = FabricQuadView.class.getDeclaredField("wrapped"); frexQuadField.setAccessible(true); @@ -57,7 +57,7 @@ public class FabricModelUtil { } catch (Exception e) { Flywheel.LOGGER.error("Detected FREX but failed to load quad wrapper field", e); } - } else if (FabricLoader.getInstance().isModLoaded("indium")) { + } else if (INDIUM_LOADED) { return quad -> ((link.infra.indium.renderer.RenderMaterialImpl) quad.material()).blendMode(0); } else if (RendererAccess.INSTANCE.getRenderer() instanceof IndigoRenderer) { return quad -> ((RenderMaterialImpl) quad.material()).blendMode(0); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3ebca6259..7c1c802e4 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,7 +32,7 @@ "depends": { "fabricloader": ">=0.11.3", - "fabric": "*", + "fabric": ">=0.75.1", "minecraft": ">=1.18.2", "java": ">=17" }