AEA TNT Crash Fix
AEA TNT Crash Fix 是一个针对 Minecraft 26.1.2 的小型 Fabric 兼容性补丁。
它防止了当 TNT、床、重生锚或其他爆炸破坏试图掉落经验值但没有有效玩家破坏者时,由 Additional Entity Attributes 引起的崩溃。
此模组不改变 TNT 的行为,不禁用爆炸,也不伪造玩家所有权。它仅防止一种特定的空玩家 XP 修饰符崩溃,并保留原版经验值数量。
修复的崩溃
在某些带有 Origins/Apoli/Additional Entity Attributes 的 Fabric 26.1.2 实例中,下界中的 TNT 爆炸会导致游戏/服务器崩溃,堆栈跟踪如下:
Description: Ticking entity
java.lang.NullPointerException: Cannot invoke "java.lang.ref.WeakReference.get()" because "this.additionalEntityAttributes$breakingPlayer" is null
at net.minecraft.world.level.block.Block.modify$zzb000$additionalentityattributes$additionalEntityAttributes$modifyExperience(Block.java:730)
at net.minecraft.world.level.block.Block.popExperience(Block.java:471)
at net.minecraft.world.level.block.Block.tryDropExperience(Block.java:644)
at net.minecraft.world.level.block.DropExperienceBlock.spawnAfterBreak(DropExperienceBlock.java:34)
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.spawnAfterBreak(BlockBehaviour.java:1172)
at net.minecraft.world.level.block.BlockBehaviour.onExplosionHit(BlockBehaviour.java:204)
at net.minecraft.world.level.ServerExplosion.interactWithBlocks(ServerExplosion.java:226)
at net.minecraft.world.level.ServerExplosion.explode(ServerExplosion.java:251)
at net.minecraft.world.entity.item.PrimedTnt.explode(PrimedTnt.java:142)
at net.minecraft.world.entity.item.PrimedTnt.tick(PrimedTnt.java:130)
出错的实体通常是 minecraft:tnt,但如果其他爆炸源在没有正常玩家挖掘动作的情况下破坏了掉落经验的方块,底层问题也可能发生。
发生原因
Additional Entity Attributes 添加了基于玩家的 XP 掉落修饰符。在内部,它将破坏方块的玩家存储在一个类似于以下的字段中:
WeakReference<Player> breakingPlayer;
这在正常挖掘时是有效的,因为确实是真实玩家在破坏方块。
但爆炸是不同的:
- 玩家引燃 TNT,或爆炸引发 TNT 连锁反应。
- TNT 随后爆炸。
- 爆炸破坏方块。
- 某些方块尝试掉落经验值。
- Additional Entity Attributes 尝试应用基于玩家的 XP 修饰符。
- 但该方块并非由正常的玩家动作破坏。
breakingPlayer 可能为 null。
- AEA 对该空引用调用
.get()。
- 服务器或单人世界崩溃。
此模组的作用
AEA TNT Crash Fix 在 Additional Entity Attributes 方块 XP 修改方法周围添加了一个小型 Mixin 守卫。
如果 AEA 没有有效的 breakingPlayer,此模组将返回原始 XP 值,而不是让游戏崩溃。
用通俗的话来说:
无破坏玩家 -> 无基于玩家的 XP 修饰符 -> 原版 XP 数量
预期的回退行为是原版行为。如果没有玩家破坏者,就没有真实的玩家来应用基于玩家的 XP 奖励或惩罚。
此模组不做的事情
此模组不:
- 禁用 TNT;
- 禁用爆炸;
- 防止连锁反应;
- 改变爆炸威力;
- 改变方块破坏规则;
- 改变 TNT 所有权;
- 寻找最近的玩家;
- 使用假玩家;
- 将 XP 修饰符应用于随机玩家;
- 完全移除 XP 掉落;
- 修补 Lithium 或其他优化模组。
该修复故意保持狭窄:它仅处理 Additional Entity Attributes XP 修饰符中缺失的 breakingPlayer 情况。
多人游戏和客户端要求
专用服务器
如果您运行多人游戏服务器,请在此模组安装在服务器上。
玩家不需要安装它。
此模组不添加客户端需要知道的方块、物品、实体、数据包、命令或注册表。它仅修补服务器端的 XP 掉落逻辑。
单人游戏
对于单人游戏,请在此模组安装在客户端实例中。
单人游戏在客户端进程内使用集成服务器,因此必须由客户端加载此补丁才能修复单人世界。
摘要
| 使用场景 |
安装位置 |
| 专用多人游戏服务器 |
仅限服务器 |
| 加入已修补的专用服务器的玩家 |
不需要 |
| 单人游戏世界 |
客户端 |
| 开放局域网主机 |
主机客户端 |
兼容性
构建并测试于:
- Minecraft
26.1.2
- Fabric Loader
0.19.3
- Java
25
- Additional Entity Attributes
2.2.3+26.1
- Apoli Legacy
2.12.4+26.1.2
- Origins Legacy
1.12.5+26.1.2
在原始测试环境中已知兼容:
- Fabric API
0.152.1+26.1.2
- Lithium
0.24.5+mc26.1.2
此模组不混入 Lithium 类。
安装
- 下载 jar 文件。
- 将其放入相应的
mods 文件夹:
- 专用服务器:服务器
mods/ 文件夹;
- 单人游戏:客户端实例
mods/ 文件夹。
- 确保
Additional Entity Attributes 也存在,直接存在或通过 Origins Legacy / Apoli Legacy 间接存在。
- 启动游戏或服务器。
启动时,您应该看到模组列为:
aea_tnt_crash_fix 1.0.0
您还应该看到:
AEA TNT Crash Fix loaded.
日志记录
当修复防止崩溃时,日志中将包含一个速率限制的警告,例如:
[AEA TNT Crash Fix] Prevented XP crash: Additional Entity Attributes breakingPlayer was null during Block.popExperience/explosion. Keeping vanilla XP.
为了防止 TNT 连锁反应期间的日志垃圾,警告进行了速率限制。每 30 秒最多记录一次。
推荐的测试清单
使用测试世界或备份副本。
推荐检查:
- 在下界引爆一颗 TNT。
- 引爆一串由 5 颗 TNT 组成的连环爆炸。
- 引爆一串由 10 颗 TNT 组成的连环爆炸。
- 在石英矿石、金矿石、远古残骸或其他与经验值相关的方块附近引爆 TNT。
- 在下界使用床进行爆炸。
- 在适用的情况下使用重生锚进行爆炸。
- 由玩家正常挖掘掉落经验值的矿石。
- 如果你的整合包包含相关模组,使用 Origins/Apoli 中影响经验值的技能来挖掘掉落经验值的矿石。
- 确认经验值仍然会掉落。
- 确认游戏/服务器不再崩溃。
常见问题
加入服务器时客户端需要安装此模组吗?
不需要。如果服务器端已安装该模组,普通客户端无需安装。
单人游戏需要安装此模组吗?
需要。单人游戏会在客户端内部运行集成服务器,因此客户端必须加载该模组。
此模组是否会移除爆炸产生的经验值?
不会。当检测到导致崩溃的条件时,该模组会保留原版原有的经验值数量。
此模组是否会伪造玩家?
不会。此模组故意不使用假玩家或最近玩家逻辑。
此模组是否会更改 Origins 的技能效果?
它不应改变正常玩家的挖掘行为。如果真实玩家破坏了方块且 AEA(Additional Entity Attributes)拥有有效的玩家引用,AEA 仍可正常应用其经验值修改器。
仅在不存在有效破坏者(即没有有效的玩家引用)时,补丁才会跳过基于玩家的经验值修改。
此模组是否修复了 Additional Entity Attributes 的所有错误?
不是。它仅针对 AEA 方块经验值修改路径中 breakingPlayer == null 导致的崩溃问题。
技术细节
相关的 AEA 逻辑是一个 Mixin,注入到 net.minecraft.world.level.block.Block 中,修改由 Block.popExperience 传递的经验值参数。
存在问题的情况等效于:
additionalEntityAttributes$breakingPlayer.get()
当 additionalEntityAttributes$breakingPlayer 本身为 null 时。
AEA TNT Crash Fix 在 AEA 生成的经验值修改方法头部注入,并首先检查存储的 WeakReference(弱引用)。
如果引用缺失或被清除,则立即返回原始经验值。
许可证
MIT
AEA TNT Crash Fix
AEA TNT Crash Fix is a tiny Fabric compatibility patch for Minecraft 26.1.2.
It prevents a crash caused by Additional Entity Attributes when TNT, beds, respawn anchors, or other explosions break blocks that try to drop experience without a valid player breaker.
This mod does not change TNT behavior, does not disable explosions, and does not fake player ownership. It only prevents one specific null-player XP modifier crash and keeps the vanilla XP amount.
The crash this fixes
On some Fabric 26.1.2 instances with Origins/Apoli/Additional Entity Attributes, TNT explosions in the Nether can crash the game/server with a stack trace like this:
Description: Ticking entity
java.lang.NullPointerException: Cannot invoke "java.lang.ref.WeakReference.get()" because "this.additionalEntityAttributes$breakingPlayer" is null
at net.minecraft.world.level.block.Block.modify$zzb000$additionalentityattributes$additionalEntityAttributes$modifyExperience(Block.java:730)
at net.minecraft.world.level.block.Block.popExperience(Block.java:471)
at net.minecraft.world.level.block.Block.tryDropExperience(Block.java:644)
at net.minecraft.world.level.block.DropExperienceBlock.spawnAfterBreak(DropExperienceBlock.java:34)
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.spawnAfterBreak(BlockBehaviour.java:1172)
at net.minecraft.world.level.block.BlockBehaviour.onExplosionHit(BlockBehaviour.java:204)
at net.minecraft.world.level.ServerExplosion.interactWithBlocks(ServerExplosion.java:226)
at net.minecraft.world.level.ServerExplosion.explode(ServerExplosion.java:251)
at net.minecraft.world.entity.item.PrimedTnt.explode(PrimedTnt.java:142)
at net.minecraft.world.entity.item.PrimedTnt.tick(PrimedTnt.java:130)
The ticking entity is usually minecraft:tnt, but the underlying problem can also happen with other explosion sources if they break XP-dropping blocks without a normal player mining action.
Why it happens
Additional Entity Attributes adds player-based XP drop modifiers. Internally, it stores the player who broke a block in a field similar to:
WeakReference<Player> breakingPlayer;
That works for normal mining, because a real player is breaking the block.
Explosions are different:
- A player lights TNT, or an explosion starts a TNT chain.
- TNT explodes later.
- The explosion breaks blocks.
- Some blocks try to drop experience.
- Additional Entity Attributes tries to apply player-based XP modifiers.
- But the block was not broken by a normal player action.
breakingPlayer can be null.
- AEA calls
.get() on that null reference.
- The server or singleplayer world crashes.
What this mod does
AEA TNT Crash Fix adds a small Mixin guard around the Additional Entity Attributes block XP modification method.
If AEA has no valid breakingPlayer, this mod returns the original XP value instead of letting the game crash.
In plain English:
No breaking player -> no player-based XP modifier -> vanilla XP amount
The intended fallback is vanilla behavior. If there is no player breaker, there is no honest player to apply player-based XP bonuses or penalties to.
What this mod does NOT do
This mod does not:
- disable TNT;
- disable explosions;
- prevent chain reactions;
- change explosion power;
- change block destruction rules;
- change TNT ownership;
- find the nearest player;
- use a fake player;
- apply XP modifiers to a random player;
- remove XP drops entirely;
- patch Lithium or other optimization mods.
The fix is deliberately narrow: it only handles the missing breakingPlayer case in the Additional Entity Attributes XP modifier.
Multiplayer and client requirements
Dedicated server
If you run a multiplayer server, install this mod on the server.
Players do not need to install it.
The mod does not add blocks, items, entities, packets, commands, or registries that clients need to know about. It only patches server-side XP drop logic.
Singleplayer
For singleplayer, install this mod in the client instance.
Singleplayer uses an integrated server inside the client process, so the patch must be loaded by the client to fix singleplayer worlds.
Summary
| Use case |
Where to install |
| Dedicated multiplayer server |
Server only |
| Player joining a patched dedicated server |
Not required |
| Singleplayer world |
Client |
| Open to LAN host |
Host client |
Compatibility
Built and tested for:
- Minecraft
26.1.2
- Fabric Loader
0.19.3
- Java
25
- Additional Entity Attributes
2.2.3+26.1
- Apoli Legacy
2.12.4+26.1.2
- Origins Legacy
1.12.5+26.1.2
Known compatible in the original test environment with:
- Fabric API
0.152.1+26.1.2
- Lithium
0.24.5+mc26.1.2
The mod does not mix into Lithium classes.
Installation
- Download the jar.
- Put it in the appropriate
mods folder:
- dedicated server: server
mods/ folder;
- singleplayer: client instance
mods/ folder.
- Make sure
Additional Entity Attributes is also present, directly or through Origins Legacy / Apoli Legacy.
- Start the game or server.
On startup you should see the mod listed as:
aea_tnt_crash_fix 1.0.0
You should also see:
AEA TNT Crash Fix loaded.
Logging
When the fix prevents the crash, the log will contain a rate-limited warning like:
[AEA TNT Crash Fix] Prevented XP crash: Additional Entity Attributes breakingPlayer was null during Block.popExperience/explosion. Keeping vanilla XP.
The warning is rate-limited to avoid log spam during TNT chains. It logs at most once every 30 seconds.
Recommended test checklist
Use a test world or a backup copy of your world.
Recommended checks:
- Explode one TNT in the Nether.
- Explode a chain of 5 TNT.
- Explode a chain of 10 TNT.
- Explode TNT near quartz ore, gold ore, ancient debris, or other XP-related blocks.
- Use a bed explosion in the Nether.
- Use a respawn anchor explosion where applicable.
- Mine XP-dropping ore normally with a player.
- Mine XP-dropping ore with Origins/Apoli powers that affect XP, if your pack has them.
- Confirm that XP still drops.
- Confirm that the game/server no longer crashes.
FAQ
Is this needed on the client when joining a server?
No. If the server has the mod, normal clients do not need it.
Is this needed for singleplayer?
Yes. Singleplayer runs an integrated server inside the client, so the client must load the mod.
Does this remove XP from explosions?
No. When the crash condition is detected, the mod keeps the original vanilla XP amount.
Does this fake a player?
No. This mod intentionally does not use fake players or nearest-player logic.
Does this change Origins powers?
It should not change normal player mining behavior. If a real player breaks a block and AEA has a valid player reference, AEA can still apply its XP modifiers normally.
The patch only skips player-based XP modification when there is no valid player breaker.
Does this fix all Additional Entity Attributes bugs?
No. It only targets the breakingPlayer == null crash in AEA's block XP modification path.
Technical details
The relevant AEA logic is a Mixin into net.minecraft.world.level.block.Block, modifying the XP argument passed by Block.popExperience.
The problematic case is equivalent to:
additionalEntityAttributes$breakingPlayer.get()
when additionalEntityAttributes$breakingPlayer itself is null.
AEA TNT Crash Fix injects at the head of AEA's generated XP modification method and checks the stored WeakReference first.
If the reference is missing or cleared, it returns the original XP value immediately.
License
MIT
评论 0
登录后参与评分
还没有评论,来抢沙发吧