-
Notifications
You must be signed in to change notification settings - Fork 5
Creating Add On Mods
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.
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.
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.
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.
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.