此模组安全地修改了 Minecraft 网络数据包的核心读取方法。
每当任何模组尝试向数据包中写入 null 时,该方法会在返回阶段自动将 null 替换为空 CompoundTag,从而确保后续的任何 NBT 操作(如 getString、getInt 等)都不会抛出空指针异常。
注意 • 这是一个崩溃防护,而非数据修复:被跳过的功能可能会暂时停止工作(例如,一个掉落物被丢弃或一个方块实体停止 ticking),但服务器/客户端会保持存活。 • 仅抑制空指针异常;其他错误仍会产生正常的崩溃报告。
[NullPointer Fix for Mio — 如何启用额外保护]
这两个选项默认均为关闭状态。仅当你的崩溃日志中包含以下内容时才启用它们:
Slot.getItem / Inventory.setItem / Inventory.add / NonNullList
添加以下 JVM 参数:
-Dnullpointerfix.sanitizeSlots=true
-Dnullpointerfix.sanitizeInventory=true
客户端(请先关闭游戏):
• CurseForge:设置 → 特定于游戏 → Minecraft → Java Arguments,追加到末尾
• Prism:右键实例 → 编辑 → 设置 → Java → JVM arguments,追加到末尾
• HMCL:版本设置 → 高级设置 → JVM Arguments,追加到末尾
• PCL2:设置 → 启动设置 → 高级 → JVM Arguments,追加到末尾
• 官方启动器:安装 → 编辑 → 更多选项 → JVM arguments,追加到末尾
注意:请将它们放入“JVM / Java arguments”字段中,而不是“Game arguments”。
服务器(Forge 1.19/1.20,NeoForge 1.21):
打开服务器文件夹中的 user_jvm_args.txt 并按每行一个添加:
-Dnullpointerfix.sanitizeSlots=true
-Dnullpointerfix.sanitizeInventory=true
保存并重启。
如果你的启动脚本不读取该文件,请将参数放在 java 和 -jar 之间。
如何验证:
启动后,logs/latest.log 应包含:
[NPE-Fix] NullPointerFixForMio active (... slots=true, inventory=true ...)
如何禁用:
移除这些参数并重启游戏/服务器。
注意:
• 客户端崩溃 → 在客户端添加。服务器崩溃 → 在服务器添加。单侧的设置不影响另一侧。
• 如果物品消失、存储终端行为异常或库存不同步,请先移除这些参数。
• 所有其他保护默认均已启用。这两项是可选的。
This mod safely modifies the core read method of Minecraft network packets.
Whenever any mod attempts to write null into a packet, the method automatically replaces null with an empty CompoundTag at the return stage, ensuring that any subsequent NBT operations (such as getString, getInt, etc.) will not throw a null pointer exception.
Notes • This is a crash guard, not a data fix: a skipped feature may stop working temporarily (for example, one dropped item is discarded or one block entity stops ticking), but the server/client stays alive. • Only null-pointer exceptions are suppressed; other errors still produce a normal crash report.
[NullPointer Fix for Mio — How to enable the extra protections]
Both options are OFF by default. Only enable them if your crash log contains:
Slot.getItem / Inventory.setItem / Inventory.add / NonNullList
Add these JVM arguments:
-Dnullpointerfix.sanitizeSlots=true
-Dnullpointerfix.sanitizeInventory=true
Client (close the game first):
• CurseForge: Settings → Game Specific → Minecraft → Java Arguments, append at the end
• Prism: right-click instance → Edit → Settings → Java → JVM arguments, append at the end
• HMCL: Version Settings → Advanced Settings → JVM Arguments, append at the end
• PCL2: Settings → Launch Settings → Advanced → JVM Arguments, append at the end
• Official Launcher: Installations → Edit → More Options → JVM arguments, append at the end
Note: put them in the "JVM / Java arguments" field, NOT in "Game arguments".
Server (Forge 1.19/1.20, NeoForge 1.21):
Open user_jvm_args.txt in the server folder and add one per line:
-Dnullpointerfix.sanitizeSlots=true
-Dnullpointerfix.sanitizeInventory=true
Save and restart.
If your start script does not read that file, put the arguments between java and -jar.
How to verify:
After launch, logs/latest.log should contain:
[NPE-Fix] NullPointerFixForMio active (... slots=true, inventory=true ...)
How to disable:
Remove the arguments and restart the game/server.
Notes:
• Client crash → add on the client. Server crash → add on the server. One side does not affect the other.
• If items disappear, storage terminals misbehave, or inventories get out of sync, remove the arguments first.
• All other protections are enabled by default. These two are optional.
评论 0
登录后参与评分
还没有评论,来抢沙发吧