忘记把mixin加进json...

This commit is contained in:
Sodium-Aluminate 2023-12-11 18:49:14 +08:00
parent 2d16ac5101
commit c71eaf3d37
2 changed files with 19 additions and 16 deletions

View file

@ -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<Boolean> cir) {
if (!getDimension().hasSkyLight()) {
ci.cancel();
cir.setReturnValue(false);
}
}
}

View file

@ -4,6 +4,7 @@
"package": "com.alpt.maybeefix.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"WorldMixin"
],
"client": [
],