promotional bannermobile promotional banner
premium banner
An electricity API for generation, transmission, and storage; in hopes of having a unified library.

Description

HyVoltz

HyVoltz is a lightweight electricity API for Hytale mods. The API is called HyVoltz; the unit of energy it handles is called voltz. All storage, transfer, and sided-IO utilities work in voltz.

Features

  • Voltz storage and transfer interfaces
  • Sided IO configuration per block face
  • Simulation-aware transfer helpers
  • Simple reference implementations for quick integration

API Overview

Package: com.siriuswolf.hyvoltz.api.power

Core types (store/transfer voltz):

  • PowerConsumer (receive)
  • PowerProvider (extract)
  • PowerStorage (both + capacity)

Sided IO:

  • PowerSide maps to Hytale BlockFace
  • PowerConnection defines NONE / INPUT / OUTPUT / BOTH
  • SidedPowerAccess / MutableSidedPowerAccess for per-side config
  • SidedPowerConsumer, SidedPowerProvider, SidedPowerStorage for side-gated IO

Reference implementations:

  • SimplePowerStorage for capacity and rate-limited IO
  • SidedPowerConfig for per-side connection state
  • SidedPowerStorageImpl combines both for easy use

Helpers:

  • PowerTransfer for safe transfer with simulation support

Basic Usage

Create a simple capacitor-style storage (10,000 voltz):

import com.siriuswolf.hyvoltz.api.power.*;

public final class BasicCapacitor extends SidedPowerStorageImpl { public BasicCapacitor() { super(10_000, 200, 200, new SidedPowerConfig(PowerConnection.BOTH)); } }

Transfer voltz between two storages:

int moved = PowerTransfer.transfer(source, PowerSide.EAST, target, PowerSide.WEST, 100, false);

Tip: I really prefer shadowjar look into it for builds!

Server API Dependency

The project targets the Hytale latest server API. Update the server jar path in build.gradle.kts if your install differs:

...game/latest/Server/HytaleServer.jar

Integration Notes

  • Add HyVoltz to your mod's classpath and reference the API from com.siriuswolf.hyvoltz.api.power.
  • If your mod loads alongside HyVoltz as a separate plugin, declare it as a dependency in your manifest.

License

Apache 2.0. See https://www.apache.org/licenses/LICENSE-2.0
(This just means you can't sell it, and requires attribution, please don't call it your own. But make whatever the heck you want with it, go crazy and make cool stuff!)