TESLA
The TESLA platform is a universal energy interface for cross-mod interaction in Minecraft. It enables various mods to exchange energy through a unified network, ensuring compatibility between items, blocks, and entities from different mods.
IMPORTANT WARNING: Alpha and beta versions are intended exclusively for mod developers and testers. Developed modules should only target stable releases! Using alpha builds may cause crashes in dependent mods!
Basic Operation Principles
The most effective way to use the TESLA API is through Forge's capability system. The concept itself is quite simple: capabilities represent interface implementations that handle specific logic related to TESLA. These capabilities can be attached to supported objects (tile entities, item stacks, and entities). After attachment, the object gains access to the corresponding TESLA functionality and becomes visible to other components supporting this system.
Frequently Asked Questions
What distinguishes TESLA from other energy APIs?
Although TESLA functions similarly to other energy interfaces, architectural decisions make it significantly more flexible. A key advantage is integration with Forge's capability system, allowing TESLA support to be added to almost any objects. For example, TESLA support can be implemented for a regular furnace from the base game without using questionable technical workarounds. Another important difference is the use of long integers instead of standard ones, enabling convenient work with large energy values.
What are the standards for TESLA?
The API doesn't impose strict standards but recommends following certain conventions. The main rule is that 1 unit of TESLA should equal 1 RF. Tile entities should not directly implement capability interfaces, and side logic handling should be done through appropriate methods.
How does soft dependency work without the ability to bundle the API?
Forge provides tools that significantly simplify soft dependency implementation. The Optional annotation allows adding interfaces to existing container objects without hard dependency on TESLA. Another powerful tool is the CapabilityInject annotation, which ensures field initialization with specific capabilities when they're connected. Although the annotation contains references to TESLA classes, the JVM system safely handles such cases even when the mod itself is missing.
Modpack Usage Policy
Usage in custom mod packs is permitted. There's no need to request additional permission to include TESLA in your mod pack.