ItemMod Class - PULSAR-Modders/pulsar-mod-loader GitHub Wiki

Modded items can be registered using the ItemMod class, found at PulsarModLoader.Content.Items.ItemMod. The ItemMod class has two overridable values, one for the PLPawnItem and another for the item name. The Name variable is purely an ID value, and must be unique for the item to load. It does not set the pawn item name.

class MyItemMod : ItemMod
{
    public override string Name => "MyModdedItem";

    public override PLPawnItem PLPawnItem => new MyModdedPawnItem();
}

Getting the PawnItem IDs

The method GetItemIDsFromName(string ItemName, out int MainType, out int SubType) will return the main and subtype IDs for the component, and can be found under Items.ItemModManager.Instance.

Occasionally you may need to check the IDs of a modded item. Due to how modded items were implimented, the subtypes values of items at any given time is going to be a combination of MainType and SubType. The real MainType and SubType IDs can be accessed from the combined subtype or item itself using the following methods: GetActualMainAndSubTypesFromSubtype(int InSubType, out int MainType, out int SubType) GetActualMainAndSubTypesFromPawnItem(PLPawnItem InItem, out int MainType, out int SubType).

Instantiating modded PawnItems

Modded items can be instantiated using ModManager.Instance.CreatePawnItem(int Maintype, int Subtype, int level). Do not instantiate PawnItems by instantiating the ModdedPawnItem class, as it will not have it's type IDs set for saving, loading, and network transfer.