From c71eaf3d37435db31adf60f7528d93e6a751ca60 Mon Sep 17 00:00:00 2001 From: Sodium-Aluminate Date: Mon, 11 Dec 2023 18:49:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E6=8A=8Amixin=E5=8A=A0?= =?UTF-8?q?=E8=BF=9Bjson...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/alpt/maybeefix/mixin/WorldMixin.java | 12 ++++++---- src/main/resources/maybeefix.mixins.json | 23 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) 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 + } }