Reservoir
The Reservoir (BlockReservoir / TileReservoir) is a 4-block fluid storage multiblock that forms a 2×2 cube. It provides higher capacity than a single tank and has a built-in water regeneration system.
Core Blocks
- Block:
crazypants.enderio.machine.reservoir.BlockReservoir - Tile:
crazypants.enderio.machine.reservoir.TileReservoir - ModObject:
blockReservoir
Multiblock Formation
- 4 blocks, 2×2 square(2×2×1)。
formMultiblock()取dir+neighbor+ 对角 + 自身共 4 格(TileReservoir.java:565-593)。因ForgeDirection.VALID_DIRECTIONS含上下方向,该 2×2 可位于任意朝向的平面(水平或竖直)。 - Controller:
multiblock[0]所在方块(isMaster(),TileReservoir.java:356-361),不是固定方位、随首次成网的取序而定。 - Automatic: Formed by
formMultiblock()when two non-multiblock reservoirs are placed orthogonally adjacent, and a fourth block exists to complete the 2×2. - Detection algorithm: For each
ForgeDirection, checks if the block in that direction AND the diagonal block are both non-multiblock reservoirs. If so, forms a 4-block multiblock. - Positions: Each tile is assigned a
Posenum (TL,TR,BL,BR) based on its orientation relative to the master. - Master: The block at position
multiblock[0](determined byisMaster()— the first block in themultiblockarray) is the controller.
Formation detection (example):
[dir=SOUTH, neighbor=EAST] → forms
[A][B]
[C][D]
Where A = placed block, B = inDirection(SOUTH), C = inDirection(EAST), D = diagonal
Formation Rules
- All four blocks must be
BlockReservoirinstances. - The four blocks must occupy a 2×2 square (not a line or L-shape).
- If any block is broken, the entire multiblock dissolves.
- Re-formation is attempted automatically via
onNeighborBlockChange(). - The reservoir does NOT require water to form — it works empty.
Fluid Storage
- Total capacity: 4,000 mB (4 buckets) — 每个方块各 1,000 mB(
SmartTank(FluidRegistry.WATER, BUCKET_VOLUME),BUCKET_VOLUME= Forge 常量 1000;TileReservoir.java:73)。- ✅ 订正记录:原文「总计 2,000 mB / 每块 500 mB」为编造值,已订正。
- Regen tank: When the main tank is full and
regenTankis empty, a secondarySmartTankwith capacity 2,000 mB is created to simulate “condensing” of steam/lava back to water. This is purely visual/functional for the water cycle. - Accepted fluid: Only water (
FluidRegistry.WATER).doFill()returns 0 for any non-water fluid. - Auto-eject: If
autoEjectis enabled, the controller scans all 6 directions of all 4 multiblock blocks for adjacentIFluidHandlertanks and distributes fluid evenly to neighbors.
Energy / Data Flow
- No power consumption — purely passive fluid storage.
- IFluidHandler: Implements
fill(),drain(),canFill(),canDrain()— all routed through the master tile. - Auto-eject logic (
doUpdateTankNeighbours): Every 20 ticks whenautoEjectis true and tank has fluid, distributes fluid evenly to all adjacent fluid handlers. - Fluid level sync:
tankDirtyflag triggers block metadata update (render change).
Rendering
ReservoirRendererrenders the 2×2 structure with per-face water level visualization.- Each face has a different water level based on the
MbFaceenum and the tile’sPos. - Water render bounds are calculated from the full 4-block
AxisAlignedBB. - The block renders with
isOpaqueCube() = falseandrenderAsNormalBlock() = falsefor custom rendering.
Tank Neighbours
When autoEject is enabled, the reservoir tracks which adjacent blocks are IFluidHandler:
for each multiblock block coord:
for each ForgeDirection:
if adjacent block NOT in multiblock AND implements IFluidHandler:
add to tankNeighbours list
Fluid is then distributed round-robin to all neighbors.