文件
--------------------------------------------------------------------------------------------------------------
注意:1.18.2 版本已修复空处理器问题,因此对于该 Minecraft 版本及更高版本,本模组不再需要。
信息
你是否曾尝试使用预生成模组预生成世界的大片区域,却总是因以下错误而随机崩溃?
原因:java.lang.NullPointerException: 无法调用 "net.minecraft.structure.processor.StructureProcessorList.getList()",因为 "java.util.function.Supplier.get()" 的返回值为 null
位于 net.minecraft.structure.pool.SinglePoolElement.createPlacementData(SinglePoolElement:148) ~[?:?]
位于 net.minecraft.structure.pool.SinglePoolElement.generate(SinglePoolElement:124) ~[?:?]
原因:java.lang.NullPointerException: 无法调用 "net.minecraft.class_5497.method_31027()",因为 "java.util.function.Supplier.get()" 的返回值为 null
位于 net.minecraft.structure.pool.SinglePoolElement.createPlacementData(SinglePoolElement:148) ~[?:?]
位于 net.minecraft.structure.pool.SinglePoolElement.generate(SinglePoolElement:124) ~[?:?]
如果是这样,恭喜你!你发现了 Minecraft 1.17.1 中一个非常古怪的 Bug!本模组旨在修复此问题。
这个 bug 的解释有些棘手,但基本上要触发它,你需要一个由 worldgen json 文件创建处理器列表(processor lists)的模组或数据包,使用区块预加载模组或其他工具加载大量区块,然后加载所有包含使用 json 处理器列表的结构区块。随机情况下,可能会因为空的处理器列表而导致崩溃。
那么到底发生了什么?Minecraft 内部有一个处理器列表注册表,应该在世界启动时创建。当游戏需要使用时,它会从注册表中获取,但不应该在运行时重写该注册表。因为这本来是不好的做法对吧?好吧……
在世界生成过程中创建结构布局时,游戏会将该布局以及所选用的部分保存到区块本身中。之后,在构建区块时,它会从区块中加载这些部分以在世界中生成。但是,在从区块读取该结构部分时,还需要读取附加在该部分上的处理器列表,以便知道哪些处理器应针对该部分运行。问题就出在这里。读取处理器列表的代码存在错误,它会读取处理器并将其再次注册到注册表中,用自身替换自身,然后再使用它。
这种用自身替换自身的注册表操作不是线程安全的。由于 Minecraft 以多线程方式创建区块……因此存在两个使用相同处理器的结构部分尝试同时读取/写入注册表中完全相同的条目的情况。当发生这种罕见的冲突时,其中一个结构部分最终可能会得到一个空处理器,从而导致游戏崩溃,因为游戏无法处理生成不存在的空处理器!
很奇怪对吧?超级诡异且调试起来非常痛苦,但多亏另一位模组作者,我们才得以查明此问题并制作了这个修复补丁。据我们所知,1.16.5 版本没有这个问题。问题始于 1.17.0,并一直持续到 1.18.1。然而,1.18.2 修复了此 bug。本模组所做的修复是缓存每个独立处理器列表所使用的 RegistryOps,使其仅向注册表写入一次并永久复用,从而避免了对同一特定注册表条目进行多次读取/写入的问题。(理论上是这样 lol)
希望这能帮到你!
Discord 链接至我的模组 #telepathicgrunt-mods 频道:
Files
Forge download: Click here
Fabric download: Click here
--------------------------------------------------------------------------------------------------------------
NOTE: 1.18.2 FIXED NULL PROCESSORS SO THIS MOD IS NO LONGER NEEDED FOR THAT MC VERSION AND NEWER
INFO
Have you been trying to pre-generate large areas of your world with pregenerator mods and keep randomly crashing with this error?
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.structure.processor.StructureProcessorList.getList()" because the return value of "java.util.function.Supplier.get()" is null
at net.minecraft.structure.pool.SinglePoolElement.createPlacementData(SinglePoolElement:148) ~[?:?]
at net.minecraft.structure.pool.SinglePoolElement.generate(SinglePoolElement:124) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_5497.method_31027()" because the return value of "java.util.function.Supplier.get()" is null
at net.minecraft.structure.pool.SinglePoolElement.createPlacementData(SinglePoolElement:148) ~[?:?]
at net.minecraft.structure.pool.SinglePoolElement.generate(SinglePoolElement:124) ~[?:?]
If so, congrats! You found a really wacky bug in 1.17.1 Minecraft! This mod aims to fix that.
The bug is tricky to explain but basically to trigger it, you need a mod or datapack that has processor lists created by worldgen json files, use a chunk pregenerator mod or something to load a massive amount of chunks, and then load all those chunks that contains structures that uses json processor lists. Randomly, that may crash due to a null processor list.
So what's going on? Well, Minecraft has a registry of processor lists inside that should be created at world startup. Then when the game needs it, it grabs it from the registry but it shouldn't be rewriting that registry at runtime. Cause that would be bad right? Well...
When a structure layout is created during worldgen, the game saves that layout and what pieces were picked into the chunk itself. Then later, as the chunk is being made, it loads that piece from the chunk to spawn in the world. Except, upon reading that structure piece from the chunk, it also needs to read the processor list attached to the piece to know what processors should run for that piece. And it's here that the bug is done. The code to read the processor list is incorrect and will take the processor it reads and register it again to the registry, replacing itself with itself, and then use it.
And this registry replacing with itself is not threadsafe. And since minecraft creates chunks in a multithreaded way... there exists a point where two structure pieces using the same processor could try reading/writing to that same exact entry in the registry. And when this rare collision occurs, one of the structure pieces may end up with a null processor which then crashes the game because the game cannot handle spawning a null processor because it doesn't exist!
Wacky right? Super weird and painful to debug but thanks to another modder, we were able to figure this out and create this fix. As far as we know, 1.16.5 does not have this issue. The problem started in 1.17.0 and continues to persist to 1.18.1. However, 1.18.2 fixed this bug. The fix this mod does is it caches the RegistryOps used for each individual processor list so it only writes itself to the registry once and reuses that forever. Thus avoiding the whole issue with multiple read/writes to that same specific registry entry. (In theory lol)
Hope this helps!
Discord Link to #telepathicgrunt-mods channel for my mods! :
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 No Null Processors
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
(V.2.0.2 更新内容) (1.18.1 Minecraft)
其他:
修改了 fabric.mod.json 文件,以防止此模组在 1.18.2 或更高版本中加载。
(V.2.0.1 更新内容) (1.18.1 Minecraft)
其他:
将 mixin 兼容性级别提升至 Java 17
(V.2.0.0 更新内容) (1.18.0 Minecraft)
主要:
已更新至 1.18。
(V.1.0.0 更新内容) (1.17.1 Minecraft)
主要:
首次发布!
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
原版世界生成优化模组
模组
新增 50+ 个独特生物群系,为你的世界增添新树木、花卉等更多元素!
模组
一个基于构建器的 Minecraft 配置库!
模组
基于 GTCEu 1.12.2 的现代 GregTech
模组
让你能够在世界中的任何位置定位结构。
模组
简单的原版生物群系更新,包含有趣的怪物、方块等更多内容!
评论 0
登录后参与评分
还没有评论,来抢沙发吧