Skip to content

How to make an item with the properties you choose (Minecraft mod)

How an item behaves comes from its properties, a builder you pass when you register it (Item.Properties; on 1.12.2 these are methods on the item instead): how many fit in a stack, its durability, its rarity (the colour of its name), whether it survives fire, whether it is food, what it leaves in the crafting grid and more. Choose any of them here and Make it writes the builder chain.

Works on Minecraft 1.20.1 to 26.3 on NeoForge; Minecraft 1.16.5 to 26.3 on Fabric; Minecraft 1.16.5 to 1.20.1 on Forge; Minecraft 1.12.2 on Forge. Each example was compiled against its loader and version before it shipped in Linen.

  1. Start from new Item.Properties().
  2. Chain the properties you want, for example .stacksTo(16).rarity(Rarity.RARE).
  3. Pass the properties when you register the item.

The example mod is examplemod in the package com.example.examplemod. Use your own mod id and package.

Uses:

  • Registry.register
  • BuiltInRegistries.ITEM
  • Item
  • Item.Properties
  • ItemGroupEvents.modifyEntriesEvent

It’s registered like any other item: see a new item.

NeoForge 1.20.1 to 26.3, Forge 1.17.1 to 1.20.1

Section titled “NeoForge 1.20.1 to 26.3, Forge 1.17.1 to 1.20.1”

Uses:

  • DeferredRegister.createItems
  • DeferredRegister.Items.registerSimpleItem
  • DeferredItem
  • Item.Properties
  • BuildCreativeModeTabContentsEvent

It’s registered like any other item: see a new item.

Uses:

  • DeferredRegister.create
  • ForgeRegistries.ITEMS
  • RegistryObject
  • Item.Properties

It’s registered like any other item: see a new item.

Uses:

  • Item.setMaxStackSize
  • Item.setMaxDamage
  • Item.setCreativeTab

1.12.2 has no Item.Properties: the settings are methods on the item (setMaxStackSize, setMaxDamage, setCreativeTab, …).

It’s registered like any other item: see a new item.

Linen’s How-tos library has this page too, with the example for your own mod’s loader and Minecraft version. Hover a name in your code and Linen points to the how-tos that explain it. Both are free. Download Linen.