diff --git a/src/main/java/com/alpt/maybeefix/mixin/WorldMixin.java b/src/main/java/com/alpt/maybeefix/mixin/WorldMixin.java index 01dba39..ff08661 100644 --- a/src/main/java/com/alpt/maybeefix/mixin/WorldMixin.java +++ b/src/main/java/com/alpt/maybeefix/mixin/WorldMixin.java @@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(World.class) public abstract class WorldMixin { @@ -14,11 +14,13 @@ public abstract class WorldMixin { public abstract DimensionType getDimension(); // 尝试修复 MC-168329 - // 根据 https://github.com/Lupicus/BeeFix/blob/master/src/main/resources/asm/Level.js - @Inject(method = "initWeatherGradients", at = @At("HEAD"),cancellable = true) - protected void initWeatherGradientsMixin(CallbackInfo ci){ + // 根据 https://github.com/Lupicus/BeeFix/blob/master/src/main/resources/asm/Level.js 找到问题来源 + // 不过我觉得 hook isRaining 会更香草一点 + + @Inject(method = "isRaining", at = @At("HEAD"), cancellable = true) + protected void notRainInTheEnd(CallbackInfoReturnable cir) { if (!getDimension().hasSkyLight()) { - ci.cancel(); + cir.setReturnValue(false); } } } diff --git a/src/main/resources/maybeefix.mixins.json b/src/main/resources/maybeefix.mixins.json index 2a23f64..a1cb865 100644 --- a/src/main/resources/maybeefix.mixins.json +++ b/src/main/resources/maybeefix.mixins.json @@ -1,13 +1,14 @@ { - "required": true, - "minVersion": "0.8", - "package": "com.alpt.maybeefix.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "minVersion": "0.8", + "package": "com.alpt.maybeefix.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "WorldMixin" + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 + } }