C. Creating Items
Updated 4 months agoPreparation
Your mod can only contain one ContentContainer ScriptableObject, if you've already made one then that's good, but if not then right-click your assets, hover over Create -> CodeRebirthLib -> ContentContainer
Then create a new AssetBundle and name it something like mymodmainassets, and assign your ContentContainer into that bundle.
Unity Editor Portion
Firstly you'll want to make a folder for your enemy, generally I like to structure my enemy folders like so:
Items/MyFirstItemName/ -> Animations -> Audio -> Materials/Textures -> Model -> RegistryRinse and repeat if you're adding multiple items.
Before doing anything, create a new AssetBundle on the bottom right, something like itemnameassets, then click onto your item's main folder, i.e. MyFirstItemName and put that folder into the AssetBundle, from there everything inside it is referenced perfectly fine into the AssetBundle automatically.
Inside each folder you put whatever is required into it, i.e. I usually extract the Animation files from the Model file and just put them into the Animations folder for the sake of being able to edit the animations and organisation.
Sound files into the Audio folder, Materials into the Materials folder, Textures inside the Textures folder, etc, etc.
In the Registry Folder, you'll want to right-click and hover over Create -> CodeRebirthLib -> Definitions -> Item Definition and press that.
Within the ItemDefinition you're able to enter in as many ConfigEntries as needed (only accessible via code and maybe JLL? currently).
Then you enter the Entity Name Reference, this part is very important, I usually just enter the Item's own name into that, it's used to match content with eachother when registering.
You also need to enter an Item, this is the direct reference of your item and it contains all the item's information/properties.
The TerminalNode is available incase you want to do some custom logic with what the item says on the terminal when trying to buy whether successful or not, but is not necessary.
Overall you should have something looking like this:
- Folder Structure

- Item Definition

Finally, go back to the Content Container and press + to add a new element for your new item, from there fill it in with the name of the AssetBundle, whether it should always be loaded (you can ignore this unless you include VideoClips into your bundle), I tend to put the config name as my item's name.
Then press on the Items list and press + again there to add an item entry to your AssetBundleData and set it up so it should look something like this:

Code/CSharp Portion
This portion assumes you're using the C# Template for CodeRebirthLib, and if you haven't then do that part first in https://thunderstore.io/c/lethal-company/p/XuXiaolan/CodeRebirthLib/wiki/3731-setting-up-c-template/.
Then you need to create a ContentHandler for your Item/Items, the way to do this is already detailed in the main README and the C# Template offers an example DefaultContentHandler you can use and after renaming some things it should look something like this:
