DamageSource Is Not Null Basic
项目结构
DSNNULL 项目现在分为两部分:
DSNNULL Basic
核心模块。提供共享的防护逻辑、回退处理以及基于原版的基础保护。
DSNNULL Plus
扩展模块。在 Basic 的基础上构建,为受支持的第三方模组和模组实体增加额外的兼容性覆盖。
进行这种拆分是因为在一个包内同时维护核心系统和所有模组实体的兼容性变得越来越困难。将它们分离出来使得项目更易于维护、扩展和调试。
关于 DamageSource 空指针异常的说明
原版 Minecraft 和加载器都假设 DamageSource 永远不会为空。
然而,一些模组仍然错误地触发伤害或死亡逻辑,并传递了一个空的 DamageSource,这可能导致崩溃,例如:
LivingDeathEvent.getSource() is null
这些崩溃会中断游戏进程,并造成难以调试的问题,因为堆栈跟踪很少包含实际将空值传入伤害处理管道的具体方法。本模组提供了一个防御层来防止此类问题导致崩溃,并且它能捕获空值被传入管道的位置,从而使实际的调试工作更加容易。
环境支持
- Forge - 1.20.1
- NeoForge - 1.21.1
支持
如果您想支持我的模组开发工作,包括维护、更新和兼容性工作,可以通过 Patreon 赞助:
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:
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 DamageSource Is Not Null Basic
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
修复不安全的类转换
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
评论 0
登录后参与评分
还没有评论,来抢沙发吧