How to Use: Developers - TheIllusiveC4/Curios GitHub Wiki

Creating a New Curio Type

Registering new curio types will always happen through InterModComms (IMC). Use the InterModComms#sendTo(String, String, Supplier) method to send the necessary information. Send the message during the InterModEnqueueEvent phase.

The first String parameter is the modid for Curios ("curios").

The second String parameter is a valid method type for IMC processing. The valid types can be found in SlotTypeMessage. Currently there are only two, REGISTER_TYPE for type registrations and MODIFY_TYPE for modifications of types.

The third parameter is a supplier of the format () -> new SlotTypeMessage.Builder(String).build(), with the inner String parameter being a unique identifier for the curio type. Note that duplicate identifiers across multiple mods will be merged together. It is recommended to use identifiers that are as common and generic as possible for your particular use-case to avoid redundancies.

The SlotTypeMessage.Builder object has several methods for controlling the attributes of the slot type to be registered:

  • icon(ResourceLocation): Points the slot icon to be used to a particular resource location.
  • priority(int): Determines the order, if applicable, for comparing slot types. Higher priorities are considered greater.
  • size(int): The default number of slots for this curio type. Note that the size can only be added, not subtracted. So if multiple mods try to register different amounts for the same curio type, the higher one will always be accepted. In addition, this is only used to determine the default amount. Each individual player has a separate slot count that can be manipulated.
  • lock(): Locks the slot type so that players will not be given any slots related to this type by default. This does not guarantee that the player cannot unlock slots for this type later on.
  • hide(): Hides the slot type, used by the default Curios GUI to determine if it should show a particular slot type.
  • cosmetic(): Enables cosmetic slots next to the equipment slots.

About Slot Identifiers

Before you decide on a slot identifier, please first take a look at the Frequently Used Slots page for a list of suggested identifiers to use instead. In addition, before hardcoding your own unique identifier, please take a look at SlotTypePreset to see if you can utilize one of the suggested presets. This will make integrating with other mods that use the same basic slot types much smoother. If you're a developer and your mod implements one of these slot types and it's not on the list, or you would like to suggest a new frequently used slot type, please send me a message.

Slot Icon Textures

Curios supports custom slot icon textures, but in order to let Minecraft know where to find it, you'll likely have to stitch your textures into the atlas first. Simply subscribe to the TextureStitchEvent.Pre event during mod loading (and note that this is all done client-side) and use evt.addSprite to add your sprite. The ResourceLocation you need to pass in is generally of the form modid: and then the path within the textures folder.

Example: evt.addSprite(new ResourceLocation(MODID, "item/empty_curio_slot"));

Language Keys

The default Curio GUI has hovered tooltips that identify the slots using lang file entries. The key format is curios.identifier.<name>. If you want your curio slot to use the default GUI and you are not using one of the common curio identifiers included in Curios, you will want to make sure that you have the appropriate language key entry in your lang files in order to format the tooltip correctly.

Marking Items with Curio Types

Curio item classification relies on the vanilla tag system. Read more about tags here. You just need to add an appropriate json file to your resources folder. Make sure you are using item tags, and not block tags or any others.

In addition, make sure you use the curios namespace. So your file's path will look like data/curios/tags/items. If you use your own mod's namespace, the tag will not be recognized by the curio registry. The tag itself must be the same as the identifier of the curio type you want to classify it to. For instance, ring.json if the identifier is ring.

Using the API

In CuriosAPI.class, you'll find several helper methods to manipulate player curio slots in a variety of ways. This includes enabling/disabling types and adding/removing slots for particular types.

Additional Functionality

For additional functionality for curio items, there's the ICurio interface available in the API. Simply implement this interface as a capability on your item(s).

⚠️ **GitHub.com Fallback** ⚠️