Skip to content

For Developers

fishcute edited this page Nov 9, 2021 · 9 revisions

For Developers

Tough as Client allows for mod creators to add their own custom items, custom armors, custom status effects, and more. This page will go through how to use Tough as Client to create client-side things.

Adding Tough as Client to your development environment

WIP don't forget to do this future self.

Creating a custom item

There are two ways to create custom items. The first method is the most recommended one.

Custom items as a class

In order to create a custom item class, create a new class and have it extend ICustomItem. Depending on your IDE, these methods should automatically be applied to your class. Below them will be a short description.

String identifier()

The item's name. (eg. If the identifier is "Amazing item", any items with the name "Amazing item" will turn into an "Amazing item")

String itemType()

The item's translation key (eg. If the itemType is "ice", any items that has "ice" in their translation key will turn into the custom item. In this case, packed ice, regular ice, and blue ice can turn into the custom item)

HashMap<String, Integer> overrides()

The custom model data values. Can be set with the ICustomItem#setOverride method. The String in the hashmap is the name of the override. (eg. If there is an override, "off, 1" and "on, 2", and the current override is "on", the item's custom model data will be 2. If there is only one value, the mod will default to that value)

ArrayList<String> lore()

Can be set to null. Any values present in this arraylist will be set as a lore on the item.

void tick();

A tick method. You can run whatever you want in this method.

Things to know about Custom Item Classes

Custom item classes must be registered in the Registry class. Items can be registered by using the Registry#registerCustomItem. Set the input as a new instance of the class.

Custom items as an InstantiableCustomItem

If you are creating items variants (things like umbrellas and fans), it is recommended to use this class. Otherwise, stick to creating items using item objects.

InstantiableCustomItem is very straightforward. Simply create one by creating a new instance of InstantiableCustomItem:

new InstantiableCustomItem(identifier, itemType, overrides, lore)

Clone this wiki locally