promotional bannermobile promotional banner

UtilityConnect

UtilityMod Used by BetterStorage

UtilityConnect

Hytale Server 0.6.8 Java 25 Gradle Kotlin DSL MIT

Every mod with pipes or cables ends up writing its own network graph. UtilityConnect does that job once: a mod-agnostic library for Hytale that links blocks into networks and keeps track of them, live while building and across server restarts. Items, fluids and energy are meant to travel through those networks, and other mods build their own transport systems on top of it, much like Forge Energy or the Fabric Transfer API in the Minecraft world.

API

Type Purpose
UtilityConnectAPI • Entry point of the library
• networks(), isReady(), runtimeVersion()
Networks • Register nodes with addNode / removeNode
• Query with hasNode, networkAt, sameNetwork, networkCount, nodeCount
NodeKind • DEVICE or CONNECTOR
• Only connectors connect: two devices side by side are not a network yet
NodeKindResolver • Tells the library which of your blocks plays which role
• Asked at the block, not taken from a stored value
NodePos / ChunkKey • Block and chunk positions of the nodes
• Nodes are saved per chunk
TransportProvider<T> • Contract for moving resources: insert, extract, capacity, tier
• Not wired up yet
TransferMode • SIMULATE or EXECUTE
• Try a transfer before doing it

Status

0.2.0-Alpha. The network side works, the transport side doesn't yet. Blocks join into networks as you build and break them, and the nodes survive a full server restart. Nothing flows through the pipes on its own, though: TransportProvider and TransferMode describe the contract, but nothing stands behind them yet.

The public API is not stable. Going from 0.1.0-Alpha to 0.2.0-Alpha already broke it: registerKindResolver was added, and the save format now knows about connectors.

Usage

Add UtilityConnect as a hard manifest dependency. The server enforces it and orders the lifecycle for you: UtilityConnect's setup() has finished before your own setup() runs, so the API is ready from there on.

manifest_dependencies = com.cyberpiratepenguin:utilityconnect=0.2.0-Alpha
// Only your mod knows which of its blocks is a pipe and which is a device.
UtilityConnectAPI.networks().registerKindResolver((world, pos) -> {
    String blockId = blockIdAt(world, pos);
    if (!isMyBlock(blockId)) {
        return null;                 // not your block: don't guess
    }
    return isMyPipe(blockId) ? NodeKind.CONNECTOR : NodeKind.DEVICE;
});

After that, call addNode when one of your blocks is placed and removeNode when it is broken. BetterStorage is the first mod built on UtilityConnect.

The UtilityConnect Team

profile avatar
  • 1
    Followers
  • 5
    Projects
  • 296
    Downloads

More from MutigerAffeView all