跳到正文

DamageSource Is Not Null Basic

作者:vomiter

An attempt to solve DamageSource NPE (Only Covers Vanilla Mobs)

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

DamageSource Is Not Null Basic

Project structure

The DSNNULL project is now split into two parts:

DSNNULL Basic

The core module. Provides the shared guard logic, fallback handling, and baseline vanilla-oriented protection.

DSNNULL Plus

The extended module. Builds on Basic and adds extra compatibility coverage for supported third-party mods and modded entities.

This split was made because maintaining both the core system and all modded-entity coverage inside a single package became increasingly difficult. Separating them makes the project easier to maintain, expand, and debug.


Explanation on the DamageSource Null Pointer Exception

Vanilla Minecraft and mod loaders assume that DamageSource is never null.

However, some mods still trigger damage or death logic incorrectly and pass a null DamageSource, which can cause crashes such as:

LivingDeathEvent.getSource() is null

These crashes can interrupt gameplay and create issues that are hard to debug, as the stacktrace seldom includes the actual method that pass a null into damage handling pipeline. This mod provides a defensive layer to prevent such issue from causing crash, and it also catch the point where null is passed into the pipeline, so that the actual debugging could be easier.

Environment

  • Forge – 1.20.1
  • NeoForge – 1.21.1

Support

If you’d like to support my modding work, including maintenance, updates, and compatibility work, Patreon is available here:

https://patreon.com/vomiter_scp

常见问题

DamageSource Is Not Null Basic 支持哪些 Minecraft 版本?

DamageSource Is Not Null Basic 支持 Minecraft Java 版 1.20.1–1.21.1,共 2 个版本,可用的加载器:Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。

DamageSource Is Not Null Basic 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

vomiter 的其他作品

查看全部 →