Compare commits

..

2 commits

Author SHA1 Message Date
45d5d32753 readme 2023-12-11 19:00:46 +08:00
c71eaf3d37 忘记把mixin加进json... 2023-12-11 18:49:14 +08:00
3 changed files with 28 additions and 16 deletions

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# maybeefix - maybe a bee bug fix for mc
尝试修理 [MC-168329](https://bugs.mojang.com/browse/MC-168329): 蜜蜂在阴间和末地时,可能不出来的情况。*"yesterday they came out just fine"*
经过用户[繁茂橡木Oaklively](https://space.bilibili.com/390245989)初步分析,复现的方法是,在主世界下雨/打雷的时候保存退出重进。
推测此时整个末地(或下界)的 isRaining 都会返回 true,即使末地和地狱不可能下雨。
解决方案是给 isRaining 函数加一个是否有天空光的检查,用于区分是不是下界和末地。

View file

@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; 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) @Mixin(World.class)
public abstract class WorldMixin { public abstract class WorldMixin {
@ -14,11 +14,13 @@ public abstract class WorldMixin {
public abstract DimensionType getDimension(); public abstract DimensionType getDimension();
// 尝试修复 MC-168329 // 尝试修复 MC-168329
// 根据 https://github.com/Lupicus/BeeFix/blob/master/src/main/resources/asm/Level.js // 根据 https://github.com/Lupicus/BeeFix/blob/master/src/main/resources/asm/Level.js 找到问题来源
@Inject(method = "initWeatherGradients", at = @At("HEAD"),cancellable = true) // 不过我觉得 hook isRaining 会更香草一点
protected void initWeatherGradientsMixin(CallbackInfo ci){
@Inject(method = "isRaining", at = @At("HEAD"), cancellable = true)
protected void notRainInTheEnd(CallbackInfoReturnable<Boolean> cir) {
if (!getDimension().hasSkyLight()) { if (!getDimension().hasSkyLight()) {
ci.cancel(); cir.setReturnValue(false);
} }
} }
} }

View file

@ -1,13 +1,14 @@
{ {
"required": true, "required": true,
"minVersion": "0.8", "minVersion": "0.8",
"package": "com.alpt.maybeefix.mixin", "package": "com.alpt.maybeefix.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
], "WorldMixin"
"client": [ ],
], "client": [
"injectors": { ],
"defaultRequire": 1 "injectors": {
} "defaultRequire": 1
}
} }