Creating Accessories - Swackyy/Ohmega GitHub Wiki
For this, you will need a DeferredRegister
for your items to be placed into and registered with.
Create a new line for your item's registry object. A ModItems
class would most likely look something like this:
public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Ohmega.MODID); // <- switch for your mod ID
public static final RegistryObject<Item> EXAMPLE_ACCESSORY = ITEMS.register("example_accessory", ExampleAccessory::new); // <- We will make this class soon
}
This is the way to register a normal item, however to make it an accessory, the class defined (ExampleAccessory) needs to be slightly different.
To make an accessory item class, simply create a normal class, extending from Item
and fill in the constructor fields as you wish. After this, you will need to implement from the IAccessory
interface.
As of Ohmega 1.3.0, Accessory Types are now data driven, allowing DataPacks to create their own types or change the types of other accessories.
There are 3 built-in Accessory Types under the Ohmega Mod ID, being "ohmega:normal"
(the default), "ohmega:utility"
and "ohmega:special"
. You can assign one or multiple Accessory Types to any accessory using the vanilla tag system, so under a data folder, create this file structure (for mods):
.
└── data/
└── ohmega/ --- This can be another Mod ID, just make sure it matches the one that creates your desired accessory types.
└── tags/
└── item/
├── normal.json
├── utility.json
└── special.json
And in the Tag file of your choosing, add in your accessory items (an example used by Ohmega for the example Angel Ring item, making it of the "utility" type):
{
"replace": false,
"values": [
"ohmega:angel_ring"
]
}
After sending your item(s) through Forge's mod event bus, your items will appear in game, however they lack functionality at the moment. Continue to the next page to add this functionality to create your desired accessories.