All Mods Resource Packs Data Packs Shaders Modpacks Plugins
TLA Api

TLA Api

by MattiDragon • Downloads: 0 • Followers: 0
Description
Gallery
Changelog
Versions

TLA Api

Badge showing the amount of downloads on modrinth Badge showing the amount of downloads on curseforge Badge linking to issues on github

TLA api is an abstraction layer over recipe viewer apis for minecraft. It allows mod developers to write their recipe viewer integration once and have it work with multiple recipe viewers. Currently supported recipe viewers are: EMI and REI

Usage

Gradle

TLA api is available on jitpack. Add the following to your build.gradle to use it:

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    modImplementation "com.github.mattidragon:TlaApi:${tla_api_version}"
    include "com.github.mattidragon:TlaApi:${tla_api_version}"
}

Entrypoint

To use the api you need to implement the TlaApiPlugin interface and add your implementation to the tla-api entrypoint. Note that the entire api is client side only. If you are using split source sets, you need to implement the api in the client source set.

public class MyTlaPlugin implements TlaApiPlugin {
    @Override
    public void register(PluginContext context) {
        // Register your api here
    }
}
{
  "entrypoints": {
    "tla-api": [
      "my.package.MyTlaPlugin"
    ]
  }
}

Registering Content

Once you've set up your entrypoint you can begin registering content. The entire api is documented using javadocs, so you can use your IDE to explore the api. The api design is mostly based on EMIs, but I've had to make some changes to accommodate REI.

Things to Consider

While the TLA api abstracts everything, you will still need to verify yourself that your code works with both recipe viewers. For example, you still need to translate all of your tags for EMI. Some widgets might also render slightly differently.

A useful thing to look for while using the api are the following annotations. They help with explaining how the api should be used.

  • @ApiStatus.Internal: This means that the part of code is not meant to be used by mod developers.
  • @ImplementationOnly: This means that the part of code is only meant to be used by the implementation of the api for recipe viewers. Unless you are creating your own recipe viewer integration, you should not use these parts of the api.
  • @PluginOnly: This means that the part of code is only meant to be by plugins and not by the implementation of the api for recipe viewers.
  • @ImplementationsExtend: This indicates that the interface is implemented by the implementations of the api and plugins generally shouldn't implement it.
  • @PluginsExtend: This indicates that the interface is implemented by plugins and the implementations of the api generally shouldn't implement it.

Questions

Q: Does this allow mods that only support one viewer to work on both?

A: No. This api just makes it easier for mod developers to support both viewers.

Q: Why is this api client side only?

A: EMIs entire api is client side only. REI has a server side api, but it doesn't contain any features that TLA uses.

Q: Are there any examples?

A: Yes, you can find the test mod here. It does a few things you wouldn't normally do, but generally does a good job of showing off the api.

How to Install TLA Api (Mod)

TLA Api by MattiDragon is verified for Fabric, Quilt across Minecraft versions 1.20.4, 1.20.6, 1.21, 1.21.1 (latest release: 1.2.1+mc.1.21, file size: 157 KB). Follow the steps below to install it safely from ModCraft.tv:

  1. Click the Download button above and select your Minecraft version (1.20.4, 1.20.6, 1.21, 1.21.1) and platform (Fabric, Quilt).
  2. Make sure you have the compatible loader or environment installed for Fabric, Quilt.
  3. Move the downloaded TLA Api file into your Minecraft .minecraft/mods folder and launch the game.

All Versions

+ Add Version
Name Game version Platforms Published Downloads Actions
1.21
Fabric Quilt
last yr. 1
1.21.x
Fabric Quilt
last yr. 1
1.20.6
Fabric Quilt
last yr. 1
1.20.6
Fabric Quilt
last yr. 1
1.20.4
Fabric Quilt
last yr. 1
1.20.4
Fabric Quilt
last yr. 1
[1.2.1+mc.1.21] v1.2.1 [1.21] by MattiDragon on Oct 19, 2024
Download
  • Add support for custom item comparisons
  • Fix recipes using custom widgets not working outside of dev
[1.2.0+mc.1.21] v1.2.0 [1.21] by MattiDragon on Jun 22, 2024
Download
[1.1.1+mc.1.20.6] v1.1.1 [1.20.6] by MattiDragon on Jun 16, 2024
Download
  • Fixed jitpack release
[1.1.0+mc.1.20.6] v1.1.0 [1.20.6] by MattiDragon on May 09, 2024
Download
  • Updated to 1.20.6
  • Added support for click areas (REI only)
  • Added the ability to get the active recipe viewer
[1.0.1+mc.1.20.4] v1.0.1 [1.20.4] by MattiDragon on Jan 12, 2024
Download
  • Added TlaStack#asIngredient utility method
  • Added the ability to register workstations
  • Added the ability to create dark mode versions of textures
  • Reworked how texture configs are built (old methods deprecated)
  • Added option for custom widgets to utilize the dark theme
  • Added support for custom animated textures
  • Fixed issue where texture category icons weren't converted correctly for emi
  • Improved testmod
[1.0.0+mc.1.20.4] v1.0.0 [1.20.4] by MattiDragon on Jan 07, 2024
Download
First release
TLA Api Icon
Download TLA Api
Select game version
Select platform