Fixes item duplication during Sable assembly/disassembly for block entities that do not implement Clearable.
Sable's SubLevelAssemblyHelper.moveBlocks() calls Clearable.tryClear() on block entities during assembly.
For BEs that don't implement Clearable, this is a no-op — their contents are neither cleared nor removed,
so when the block is destroyed and recreated in the sub-level, the items drop into the world AND remain in the NBT,
causing item duplication.
| Block Entity | Items per dupe |
|---|---|
| TableCloth (桌布) | up to 4 |
| Mechanical Arm (机械手臂) | 1 held item |
| Ejector (弹射器) | launched items |
| Brass Tunnel (黄铜隧道) | 1 distribution stack |
| Crate / FluidTank / Toolbox / etc. | varies |
Plus any modded BE with inventory that doesn't implement Clearable.
A single @Redirect mixin targets Clearable.tryClear() inside SubLevelAssemblyHelper.moveBlocks():
- If the BE implements
Clearable→ passes through normally - If the BE doesn't → calls
level.removeBlockEntity(pos)instead, preventing drops during block destruction
Auto-creates config/sableassemblyfix/whitelist.json on first launch.
Add BE IDs to skip the fix (e.g., mods that handle Clearable themselves).
Requires game restart to reload.
MIT