Jump to content

Custom Item Definitions 1.0.1

   (0 reviews)

2 Screenshots

  • 574
  • 24
  • 12.65 kB

About Custom Item Definitions


This plugin does not have its own functionality. This plugin is only used as a library for other plugins.

This library allows developers to create their own ItemDefinitions, which will allow them to create custom items with their own unique values.

What is an ItemDefinition created with the library?
It is a full-fledged ItemDefinition just like the other ones created by Rust developers, a new item definition is created based on an existing one with modified settings. 
It has its own shortname and itemid, and can also have its own itemMods created by the developer, which is very convenient.
You can use the give command, item.info.[anything], and any other way you want.

A simple example of item creation:

// Requires: CustomItemDefinitions
using static Oxide.Plugins.CustomItemDefinitions;

namespace Oxide.Plugins
    [Info("LightsaberItem", "0xF", "1.0.0")]
    public class LightsaberItem : RustPlugin
        public static LightsaberItem PluginInstance;

        ItemDefinition PARENT_DEFINITION = ItemManager.FindItemDefinition("longsword");

        void Init()
            PluginInstance = this;
            CustomItemDefinitions.RegisterPluginItemDefinition(new CustomItemDefinition
                shortname = "lightsaber",
                itemId = -346745678,
                parentItemId = PARENT_DEFINITION.itemid,
                maxStackSize = 1,
                category = ItemCategory.Weapon,
                defaultName = "Lightsaber",
                defaultSkinId = 3035762342,
                itemMods = new ItemMod[]
                    new ItemModLightsaberCreatedNotice()
                        exampleField_message = "Item with name \"{0}\" just created! Yay!"
            }, this);

        public class ItemModLightsaberCreatedNotice : ItemMod
            public string exampleField_message;
            public override void OnItemCreated(Item item)
                if (exampleField_message != null)
                    PluginInstance.Puts(string.Format(exampleField_message, item.name));


What are some things to keep in mind?

  • Always register new item definitions in the Init hook! This is important!
  • You must take care to register unique shortnames and item ids.
  • ItemId should never be changed in your plugin, as items created with an old itemId will break if they don't have their definition.
  • After your plugin is unloaded, all items created with your item definitions will lose interaction, as all ItemMods will be removed. This is done for safety, don't worry, after loading the plugin back in, all items will work again as before.

CustomItemDefinition class structure:

public class CustomItemDefinition
   public int parentItemId;
   public string shortname;
   public int itemId;
   public string defaultName;
   public ulong defaultSkinId;
   public int? maxStackSize;
   public ItemCategory? category;
   public ItemDefinition.Flag flags;
   public ItemMod[] itemMods;

ItemMods details:
ItemMods are overwritten, this means the new item definition will not include the itemMods of the parent.
If you need to import an item mod from the parent, you can use


if you need to import everything ItemMods

new List<ItemMod>(PARENT_DEFINITION.itemMods).ToArray()

Custom itemMods are added using the method of creating a new class, i.e.

new YourItemMod()

Here you can also specify the fields you want, example: 

new YourItemMod() {
    field: value

Quick answers to questions:

  • Items have become coal, what does that mean?
    This is a fallback ItemDefinition in case the plugin providing this item is no longer available. The items will be restored if the plugin is returned.


User Feedback



Total number of downloads.



Total customers served.


Files Sold

Total number of files sold.


Payments Processed

Total payments processed.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.