Sophisticated Storage Create Fabric Compatibility

模组

· 作者 SypherRed

Sophisticated Storage 现已兼容 Create Fabric Contraptions。

0 本站下载 0 关注 更新于 6 个月前
一键开服(送7天)

Create: Sophisticated Storage 兼容性

一个 Fabric 模组,用于修复在 Minecraft 1.20.1 中,将 Sophisticated Storage 容器放置在 Create Contraptions 内时发生的崩溃问题。

问题

当 Sophisticated Storage 区块实体(箱子、桶等)被放置在 Create Contraption 内部时,游戏会因以下错误而崩溃:

java.lang.ClassCastException: class com.simibubi.create.foundation.virtualWorld.VirtualChunk cannot be cast to class net.minecraft.world.chunk.WorldChunk

发生此问题的原因是:

  1. Create Contraptions 使用特殊的 VirtualChunk 类进行渲染和操作
  2. Sophisticated Storage 在 NBT 数据加载期间调用 BlockEntity.setChanged()
  3. setChanged() 尝试将区块强制转换为 WorldChunk,但实际上它是 VirtualChunk
  4. 转换失败导致游戏崩溃

解决方案

本模组实现了一个 Mixin,拦截所有 BlockEntity.setChanged() 调用并执行以下操作:

  1. 检查该区块实体是否来自 Sophisticated Storage
  2. 检查当前区块是否为 Create 的 VirtualChunk
  3. 如果两个条件均满足,则取消 setChanged() 调用以防止崩溃

此修复过程是透明的,不会破坏任何功能——物品仍能在 Create 和 Sophisticated Storage 之间正常传输。

特性

  • 允许 Sophisticated Storage 箱子随 Create Contraptions 移动
  • 防止 ClassCastException 崩溃
  • 自动检测 — 无需配置

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源