Skip to content

Creating Add On Mods

Danny edited this page Sep 2, 2021 · 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.

Tiny Redstone is published to a maven repository located at http://files.dannyandson.com/repo. To make the Tiny Redstone API available to your project, include the following block of code within the repositories{} block of your build.gradle:

` maven { // Tiny Redstone

    name 'dannyandson maven'

    url "http://files.dannyandson.com/repo"

    allowInsecureProtocol = true

    content {

        includeGroup "com.dannyandson.tinyredstone"

    }

}

`

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

implementation fg.deobf("com.dannyandson.tinyredstone:Tiny-Redstone-1.17:1.17.1-2.2.1")

Replace 1.17 portion of "Tiny-Redstone-1.17" with the appropriate Minecraft version and "1.17.1-2.2.1" with the appropriate version of Tiny Redstone.

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: coming soon.

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/master/src/main/java/com/dannyandson/tinygates/setup/Registration.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.

Clone this wiki locally