-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
🐛 bugSomething isn't workingSomething isn't working
Description
OS Version - 操作系统
Windows
Minecraft Version Details - Minecraft 版本信息
1.21.1
Mod Loader - 模组加载器
Forge
Version Details - 版本信息
0.0.1+build.27
Existing behavior - 现有行为
单人模式下,打开 fastLeafDecay 功能有概率在ESC时崩溃。
在经过分析后(非AI)认为是 BlockEventListener.onNotifyNeighbors(...) 中调用了 TimerQueue 去加速叶子腐烂,但在 timerqueue.schedule() 时放入的计划任务无法在世界保存时正确序列化,序列化结果为 null,所以导致 Minecraft 尝试 net.minecraft.world.level.timers.TimerCallback$Serializer.serialize(net.minecraft.nbt.CompoundTag, net.minecraft.world.level.timers.TimerCallback) 时,触发了 java.lang.NullPointerException。
- TimerQueue 设计要求所有任务必须有对应的
TimerCallback.Serializer,这样任务才能在世界保存时序列化进 NBT,并在世界加载时反序列化还原。 - 但源代码中放入的确是一个 lambda,并没有
serializer() - 在世界保存时,
TimerQueue.store()遍历所有任务,然后调用callback.serializer().serialize(...),结果序列化到本模组的计划任务时,得到了一个null, 也就造成了java.lang.NullPointerException
Expected behavior - 预期行为
不再崩溃
To Reproduce - 复现问题
在单人存档里打开 fastLeafDecay 功能,找棵树将其树干采集,在叶子腐烂完全前按下ESC。
This issue is unique - 这个issue是唯一的
- I have searched the issue tracker and did not find an issue describing my bug. - 我已经搜索问题追踪器并且没有发现相同的 issue。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🐛 bugSomething isn't workingSomething isn't working