跳到正文
烈焰甘蔗Wiki

分类抽屉(Sorting Drawers)

Refined Relocation 集成模块在 StorageDrawers 主 mod 名下额外注册的一整套「分类抽屉」方块与 upgradeSorting 升级物品。它们是普通抽屉的升级版:外观与容量相同,多一个 Refined Relocation 的分拣网格。

基本信息

属性 值
所属模块 integration/RefinedRelocation.java(IntegrationRegistry 的 11 个模块之一)
探测的 modid RefinedRelocation(getModID())
版本要求 [1.0.8b,)(versionPattern())
开关 StorageDrawers.config.cache.enableRefinedRelocationIntegration(moduleConfig())
依赖 modid 无硬依赖;未装 RefinedRelocation 时该模块的 init() 不执行,全部内容不存在
创意标签 独立标签 storageDrawersSorting(RefinedRelocation.tabStorageDrawers)
方块数 7(5 满深/半深抽屉 + 压缩抽屉 + 装饰条)
物品数 1(upgradeSorting)

注册名(全部挂在 StorageDrawers: 下)

注册名 类 配置开关
StorageDrawers:fullDrawersSort1 BlockSortingDrawers isBlockEnabled("fulldrawers1")
StorageDrawers:fullDrawersSort2 BlockSortingDrawers isBlockEnabled("fulldrawers2")
StorageDrawers:fullDrawersSort4 BlockSortingDrawers isBlockEnabled("fulldrawers4")
StorageDrawers:halfDrawersSort2 BlockSortingDrawers isBlockEnabled("halfdrawers2")
StorageDrawers:halfDrawersSort4 BlockSortingDrawers isBlockEnabled("halfdrawers4")
StorageDrawers:compDrawersSort BlockSortingCompDrawers isBlockEnabled("compdrawers")
StorageDrawers:trimSort BlockSortingTrim isBlockEnabled("trim")
StorageDrawers:upgradeSorting ItemUpgradeSorting enableSortingUpgrades

注册行在 integration/RefinedRelocation.java:90-105。每一个方块都套了和主 mod 同名方块相同的配置开关(fulldrawers1 ↔ fullDrawersSort1),所以关掉主 mod 抽屉也会连带关掉分类抽屉。

功能

分拣网格

TileSortingDrawersStandard / TileSortingDrawersComp / TileSortingTrim 额外持有 DrawerSortingInventory(integration/refinedrelocation/DrawerSortingInventory.java),它是 Refined Relocation ISortingInventory 的实现:

部件 作用
DrawerFilter implements IFilter passesFilter(ItemStack) 遍历抽屉组里每个启用且非空的抽屉,只要有一个 drawer.canItemBeStored(itemStack) 为真就放行 ⇒ 分拣器能把物品送进任何能装下它的槽位
DrawerSortingInventory.attach()/detach() 分别调用 onTileAdded() / onTileRemoved(),与 RR 的网络同步
SortingBlockRegistry 主 mod 方块 ↔ 分类方块的双向映射,init() 里用 SortingBlockRegistry.register(...) 逐对登记 7 组

源码在 mirror/ 中的只有 StorageDrawers 一侧;com.dynious.refinedrelocation.* 属 Refined Relocation 本体,其语义无法在本仓库核实。

升级(upgradeSorting)

ItemUpgradeSorting.onItemUseFirst 依次尝试三条路径,任一成功就 stack.stackSize--:

  1. 目标是 ModBlocks.trim → BlockSortingTrim.upgradeToSorting(world, x, y, z)
  2. 目标的 TileEntity 是 TileEntityDrawersStandard → BlockSortingDrawers.upgradeToSorting(...)
  3. 目标的 TileEntity 是 TileEntityDrawersComp → BlockSortingCompDrawers.upgradeToSorting(...)

BlockSortingDrawers.upgradeToSorting(integration/refinedrelocation/BlockSortingDrawers.java:32-56)的转换过程:

  1. 目标已是 TileSortingDrawersStandard ⇒ 返回 false(不可二次升级)
  2. oldDrawer.writeToNBT(tag) → newDrawer.readFromNBT(tag),物品、配置、升级全部原样搬运
  3. world.removeTileEntity + world.setBlockToAir,再按 SortingBlockRegistry.resolveSortingBlock(block) 放回分类方块
  4. world.setTileEntity(x, y, z, newDrawer) 装上分拣版 TileEntity
  5. metadata 保持不变

upgradeSorting 本身是存储升级槽物品之外的独立物品——它不能装进抽屉的 5 个升级槽,只能手持右击方块升级。

数值

属性 值 来源
最大堆叠 64(ItemUpgradeSorting 未调 setMaxStackSize) ItemUpgradeSorting.java:22-27
耐久 setMaxDamage(0) → 不可损坏 ItemUpgradeSorting.java:26
纹理 StorageDrawers:upgrade_sorting ItemUpgradeSorting.java:25
槽位数 与对应普通抽屉完全一致(BlockDrawers 的 public final int drawerCount / public final boolean halfDepth,block/BlockDrawers.java:76-77) BlockSortingDrawers 构造参数透传给 super(blockName, drawerCount, halfDepth)
分类方块的升级槽 仍是 5 个——TileSortingDrawersStandard extends TileEntityDrawersStandard,只是额外 implements ISpecialSortingInventory 并持有一个 DrawerSortingInventory integration/refinedrelocation/TileSortingDrawersStandard.java:12-17
trimSort 的性质 TileSortingTrim extends TileEntity implements ISortingMember,不是抽屉,没有槽位 integration/refinedrelocation/TileSortingTrim.java:9

交互

触发 行为
手持 upgradeSorting 右击普通抽屉 整块抽屉就地升级为分类抽屉,物品不丢失,消耗 1 个
手持 upgradeSorting 右击已是分类的抽屉 返回 false,不消耗
手持 upgradeSorting 右击 trim 升级为 trimSort
右击分类抽屉 打开 GUI,界面是 Refined Relocation 的分拣网格

合成配方

upgradeSorting(integration/RefinedRelocation.java:205-212,GameRegistry.addRecipe):

 y y
 z
 y y

y = Items.gold_nugget(金粒)  ×4
z = ModItems.upgradeTemplate(升级模板) ×1

分类方块本身没有合成配方——它们只能由 upgradeSorting 就地升级得到。

相关条目

浏览全部模组