Skip to content
Mikael E. Wikner edited this page Jul 22, 2022 · 15 revisions

Work in progress!

This is a technical wiki intended for mod developers looking to integrate with tetra in some way, or for those making modpacks or datapacks that want to add, change or remove content from tetra.

If you are looking for guidance on how to play you should look at the ingame advancements.

You need some understanding of json and minecraft datapacks or this will be difficult to follow.

Getting started

Datapacks

  1. Set up a datapack (guide)
  2. Enable the output log, allows you to see if there are errors in your datapack (guide)
  3. Turn on tetra development mode in the config (config/tetra.toml, generates if you start minecraft with tetra installed)
  4. Set up resourcepack (needed in most cases) (guide)
  5. Test that both are loaded (run /datapacks list and check resource pack screen)

Mod integrations

  1. Add repository in build.gradle (Thanks Jared for hosting the artifacts <3)
repositories {
  // ...
  maven { url = 'https://maven.blamejared.com/' }
}
  1. Add tetra & mutil as dependencies in build.gradle
dependencies {
  // ...
  implementation fg.deobf("se.mickelus.mutil:mutil:1.19-5.1.0")
  implementation fg.deobf("se.mickelus.tetra:tetra:1.19-5.0.0")
}
  1. Add entry in mods.toml
[[dependencies.example_mod]]
    modId="tetra"
    mandatory=true
    versionRange="[5,]"
    ordering="AFTER"
    side="BOTH"

Overview

Concepts

Some of the basic concepts that tetra relies on, some from vanilla and others from forge and tetra.

Attributes

Attributes represent most stats for entities in vanilla, e.g. attack damage, health and armor. Most tetra items modify the attributes of wielding entities when they're held in the mainhand or the offhand.

Documentation on the vanilla attributes can be found here: https://minecraft.fandom.com/wiki/Attribute#Attributes.

Tetra adds four new attributes:

  • tetra:draw_strength: damage for bows and crossbows
  • tetra:draw_speed draw speed for bows and crossbows
  • tetra:ability_damage damage for shields
  • tetra:ability_cooldown cooldown for shields and the holosphere

Forge also adds the following:

  • "forge:entity_gravity": decides how much an entity is affected by gravity
  • "forge:reach_distance": how far away an entity can break blocks (tetra changes this to also affects the range at which one can hit entities)
  • "forge:swim_speed": How fast an entity can swim? (I have not tested this)
  • "forge:nametag_distance": How far away an entity's nametag can be seen? (I have not tested this either)

Tools

Minecraft keeps track of what items can be used for with ToolActions (used to be ToolTypes, added by forge) which tetra uses to determine which blocks a tool can break, and how fast those blocks are broken. ToolActions are also used to determine which tools are required to craft modules and improvements.

Has a level and efficiency for each ToolAction. The level determines which blocks the tool can break and which modules/improvements it can craft, the efficiency determines how fast it can break blocks (which require the tool).

Tetra uses ToolActions for some in world block interactions, such as prying open a crate or for fixing a jammed forge hammer. It's possibly to new in world block interactions for other mods.

Minecraft adds support for some in world block interactions based on ToolActions, such as tilling dirt or stripping a log.

This system is backed by strings, a tool action exists as long as it's referenced somewhere. Mods that want to add custom tools should keep a reference to their tools in the same way as vanilla does it, pack makers can create new tools by requiring them in a schematic and providing them in a module.

Item effects

Tetra introduces Item effects which are used to apply special effects when an item is used, e.g. bleeding, critical strike or intuit.

Item effects are currently used for right click abilities as well, e.g. bashing or blocking. This will probably change in the future.

There's a list of all item effects available here.

Aspects

(introduced in 1.18)
Modules can have Aspects similar to ToolActions and ItemEffects. The Aspects are intended to be used to control how the module can be modified, e.g. which improvements or enchantments it accepts.

Enchantments

Modular items can hold enchantments like any other, the item keeps a separate mapping between slots and enchantments to keep track of magic capacity use and to clear enchantments when modules are removed. Enchantments from other mods that use vanilla EnchantmentCategories are supported out of the box, enchantments can otherwise be tagged with the tags listed here to further control which enchantments different types of modules can accept based on their Aspects. New Aspect to EnchantmentCategory mappings can be added programatically with TetraEnchantmentHelper.registerMapping.

Resources

Most content in tetra can be changed using datapacks, this works both for standalone datapacks and for other mods looking to integrate with tetra. Resources are often referred to as a resource, or as data. Resources exist in a folder structure, the file path for a resource within that structure is often called a resource location.

If there are resources at the same resource location in multiple datapacks they would either merge or be replaced based on the load order of the datapacks and the value of a special replace field within those resources.

The following resources are available:

  • Modules: Modular items are made up of a set of modules, module data defines the stats and effects that those modules should provide for the item.
  • Schematics: Modules are typically crafted in a workbench, schematic data defines which modules can be crafted from which materials and what kind of tools that requires.
  • Improvements: Some modules (based on the slot they go in) can be improved, improvement data defines the stats and effects that those improvements should provide for the item.
  • Enchantments/Destabilization: Enchantment data defines mappings between minecraft enchantments and tetra improvements. Destabilization data defines how negative effects are applied to modules if the magic capacity is exceeded
  • Materials: Material data defines properties for materials, that can then be referenced by modules and schematics to set up variants without lots of repetition
  • Synergies: Some modules provide additional stats when used together, synergy data define which combinations of modules that should provide those bonuses and what those bonuses should be
  • Tweaks: Some modules (like binding bolts) allow the stats of the items to be tweaked in more detail, tweak data defines some rules and which stats that can be tweaked
  • Replacements: Most modular items are not crafted in the regular crafting grid, they're converted into modular items by placing and modifying a regular weapon/tool in the workbench. Replacement data defines which items that can be converted into modular items and which modules & improvements that modular item should start off with
  • Repairs: Repair data can be used to add additional repair materials for a module variant
  • Actions: The workbench allows for actions to be performed on some items (i.e. cracking a geode or repairing a modular item), action data defines simple loot-table based actions and for which items those can be performed
  • Crafting effects: Crafting effects allows for additional effects to be apply based on the context when a module or improvement is crafted

Feel free to hop onto discord and ask for help if you're having issues: https://discord.gg/MyjK4Fx