Skip to content
Compact Universe logoCompact UniverseDownloads
You are viewing upcoming docs from main (unreleased).

Links, Forwarding & Chunk Loading

Compact Universe replaces typed, buffered tunnels with a single capability-forwarding link system built from two blocks: Machine I/O outside the room and Room Port inside the room.

Why zero-buffer forwarding instead of typed tunnels

Section titled “Why zero-buffer forwarding instead of typed tunnels”

Traditional Compact Machines tunnel add-ons attach handlers directly to Compact Machines’ placed machine block entities and expose separate typed tunnels (item, fluid, energy, chemical) with push/pull modes and internal buffers. Stored machines have no placed Compact Machine block entity, and typed tunnels require dedicated code for every modded resource type.

Compact Universe takes a pass-through proxy approach:

  • No internal buffers and no transfer modes. Neither Machine I/O nor Room Port holds items, fluids, or energy, and neither ticks to move resources. Pipes, hoppers, cables, and machines on either side drive all transfer directly.
  • Capability-agnostic forwarding. At EventPriority.LOWEST during RegisterCapabilitiesEvent, Compact Universe registers pass-through forwarding for every NeoForge sided block capability marked proxyable (BlockCapability.getAllProxyable()). With NeoForge alone that covers items, fluids, and Forge Energy, and any third-party mod that marks its own sided capability proxyable works automatically.
  • Wall-independent port mapping. Each Room Port is a wall-mounted plate with a socket facing into the room. Its face picker links it to any of the six faces of the room’s Machine I/O block (Down, Up, North, South, West, East) regardless of which wall the port is mounted on.
Section titled “Stateless endpoints and central link topology”

Neither the Machine I/O block entity nor any Room Port block entity saves link data in its own NBT. Instead, all topology lives in a single server-wide SavedData record (compact_universe_links) mapping:

  • Each room code to at most one Machine I/O GlobalPos (dimension + block position).
  • Each (room code, Machine I/O face) pair to at most one Room Port (position + wall direction).

Because both ends look up the far end exclusively through this central record:

  • Unlinking works across unloaded chunks. Breaking a Machine I/O block, breaking a Room Port, or removing a machine from a universe clears the record immediately—even if the other end is in an unloaded chunk or another dimension.
  • Relocating a Machine I/O preserves Room Ports. Unlinking or breaking a Machine I/O block clears only the room’s I/O claim; the Room Ports inside keep their face assignments and reconnect as soon as a new Machine I/O block links to that room.
  • Removing a machine clears everything cleanly. When a stored machine is removed from a universe, LinkService listens for StoredMachineRemovedEvent, releases both the Machine I/O claim and every Room Port claim for that room, invalidates loaded endpoints, and emits LinkChangedEvent.

Every capability query and LinkCapabilities.target(...) lookup checks that both the far link block and the block directly in front of it are already loaded (ServerLevel#isLoaded) and that the far link block entity is still present. If either chunk is unloaded, the link returns null (or Optional.empty()).

This keeps links from silently force-loading distant base chunks or empty compact rooms. If you want a room to run while nobody is inside it, load the room explicitly with Compact Machines’ chunk loader upgrade.

Many pipe and cable mods cache capability references with NeoForge’s BlockCapabilityCache and only re-query when a neighbor invalidates its capabilities. Compact Universe handles this on two paths:

  1. Topology changes: Whenever a link is created, changed, or broken, LinkService mutates the central record first, invalidates both endpoints (if loaded), and then posts LinkChangedEvent.
  2. Far-target watches: Whenever a link block answers a capability request—even when the far chunk is currently unloaded—it registers a NeoForge capability invalidation listener (ServerLevel#registerCapabilityListener) on both the far link position and the far target position. If a chest is placed, broken, or replaced on the other side, or if the far chunk finishes loading, the watch invalidates the near link block so caching pipes re-query immediately.

To avoid modifying NeoForge’s listener set mid-iteration or causing infinite ping-pong invalidations between two link blocks that face each other, Compact Universe tracks actively notifying positions in a re-entrancy guard.

Because a Machine I/O block can point into a room whose Room Port faces another Machine I/O block (nested rooms or chained links), LinkBlockEntity tracks per-thread forwarding depth and caps nested forwarding at 8 hops. If a chain exceeds depth 8—or loops back on itself—the innermost lookup returns null safely instead of recursing indefinitely.

Not an official Minecraft website. Not approved by or associated with Mojang or Microsoft.