Skip to content

Creating Add On Mods

Danny edited this page Jul 14, 2023 · 9 revisions

Tiny Redstone has an API to allow other mods to add their own custom components that can be placed as cells on Tiny Redstone's Panels. To see an example of how this works in code, check out Tiny Gates. To see a description of the process, continue reading.

To follow these instructions, you do need to know how to create a Minecraft mod. You will also want to be familiar with texture rendering code.

Including Tiny Redstone in your project.

To make the Tiny Redstone API available to your project (or any other Curseforge mod), I recommend using Curse Maven. Include the following block of code within the repositories{} block of your build.gradle:

`

maven {
    url "https://cursemaven.com"
    content {
        includeGroup "curse.maven"
    }
}

`

Within the dependencies{} block of your build.gradle, include the following

implementation fg.deobf("curse.maven:tiny-redstone-453746:xxxxxxx")

where xxxxxxx is the file id for the specific version you want to include from CurseForge. You can get this by going to the Files tab on curseforge for Tiny Redstone (https://www.curseforge.com/minecraft/mc-mods/tiny-redstone/files). Click on the version you want, then look for the Curse Maven Snippet.

For example, 4593836 is the file id for Tiny Redstone 1.20-5.0.1, so the code would look like this:

implementation fg.deobf("curse.maven:tiny-redstone-453746:4593836")

Adding a component

Register an item

A component requires an Item which you will need to register in the usual way. It's recommended that the item inherit the AbstractPanelCellItem class in the com.dannyandson.tinyredstone.api package.

Create the component's class

Each component needs a class that implements the IPanelCell interface (also in the com.dannyandson.tinyredstone.api package). This interface is documented with JavaDocs and should be straightforward. The render method may benefit from further discussion which I hope to include here soon. In the meantime, you can see examples in Tiny Redstone code (https://github.com/dannydjdk/Tiny-Redstone/tree/1.20/src/main/java/com/dannyandson/tinyredstone/blocks/panelcells). McJty also has some helpful tutorials on BlockEntity Rendering.

Register your component

To let Tiny Redstone know about your item and component class, from within the FMLCommonSetupEvent, you must call the TinyRedstone.registerPanelCell class (package com.dannyandson.tinyredstone) with your component class and registered Item object.

For examples, see https://github.com/dannydjdk/Tiny-Gates/blob/1.20/src/main/java/com/dannyandson/tinygates/setup/RegistrationTinyRedstone.java

The items are registered in the usual way, and the registerpanelcells() class, which is called from within the FMLCommonSetupEvent, registers all the items and IPanelCell classes with Tiny Redstone.