Skip to content

Commit

Permalink
Fix Indium incompatibility (#224)
Browse files Browse the repository at this point in the history
* Fix Indium incompatibility

* I forgot to mark this as dynamic

* Use ModifyExpressionValue instead of WrapOperation

---------

Co-authored-by: LambdAurora <[email protected]>
  • Loading branch information
BluSpring and LambdAurora authored Jul 23, 2024
1 parent e65846c commit 5ba107a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 6 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.4.+"
id "fabric-loom" version "1.6.+"
id "dev.yumi.gradle.licenser" version "1.1.+"
id "java-library"
id "maven-publish"
Expand Down Expand Up @@ -135,7 +135,8 @@ dependencies {
transitive = false
}

modRuntimeOnly "maven.modrinth:sodium:${project.sodium_version}"
modImplementation "maven.modrinth:sodium:${project.sodium_version}"
modImplementation "maven.modrinth:indium:${project.indium_version}"

shadow "com.electronwill.night-config:core:3.6.6"
shadow "com.electronwill.night-config:toml:3.6.6"
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ curseforge_id=393442
spruceui_version=5.0.3+1.20.2
pridelib_version=1.2.0+1.19.4
modmenu_version=9.0.0
sodium_version=mc1.20.3-0.5.5
sodium_version=mc1.20.4-0.5.8
indium_version=1.0.31+mc1.20.4
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ public static boolean isSodium05XInstalled() {
}
}).orElse(false);
}

public static boolean isIndiumInstalled() {
return FabricLoader.getInstance().isModLoaded("indium");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public LambDynLightsMixinPlugin() {
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.sodium.ArrayLightDataCacheMixin", sodium05XInstalled);
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.sodium.FlatLightPipelineMixin", sodium05XInstalled);
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.sodium.LightDataAccessMixin", sodium05XInstalled);

boolean indiumInstalled = LambDynLightsCompat.isIndiumInstalled();
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.indium.TerrainRenderContextMixin", indiumInstalled);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright © 2024 LambdAurora <[email protected]>
*
* This file is part of LambDynamicLights.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
*/

package dev.lambdaurora.lambdynlights.mixin.indium;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import dev.lambdaurora.lambdynlights.LambDynLights;
import link.infra.indium.renderer.render.AbstractBlockRenderContext;
import link.infra.indium.renderer.render.TerrainRenderContext;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;

@Pseudo
@Mixin(value = TerrainRenderContext.class, remap = false)
public abstract class TerrainRenderContextMixin extends AbstractBlockRenderContext {
@Dynamic
@ModifyExpressionValue(method = "bufferQuad", at = @At(value = "INVOKE", target = "Llink/infra/indium/renderer/mesh/MutableQuadViewImpl;lightmap(I)I"), require = 0)
private int lambdynlights$getLightmap(int original) {
return LambDynLights.get().getLightmapWithDynamicLight(this.blockInfo.blockPos, original);
}
}
5 changes: 3 additions & 2 deletions src/main/resources/lambdynlights.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
"MinecraftClientMixin",
"VideoOptionsScreenMixin",
"WorldMixin",
"fabric.AoCalculatorMixin",
"indium.TerrainRenderContextMixin",
"ltr.LilTaterBlockEntityMixin",
"ltr.LilTaterBlocksMixin",
"sodium.ArrayLightDataCacheMixin",
"sodium.FlatLightPipelineMixin",
"sodium.LightDataAccessMixin",
"fabric.AoCalculatorMixin"
"sodium.LightDataAccessMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 5ba107a

Please sign in to comment.