Skip to content
AleXndrTheGr8st edited this page Dec 14, 2014 · 1 revision

Using SimpleItem

Creates a basic item, such as an ingot.

Usage:

yourItem = new SimpleItem();

Customising Methods:

You can customise your item using the below methods. In most cases, they will be appended to your initialization code (above, see the example below).

  • addToolTip(String toolTip):

Adds a mouse-over tool-tip to the item. The string is a localisation entry key, such as "yourItem.toolTip", so there must be a localisation containing your string key.

yourItem = new SimpleItem().modId("yourModId").addToolTip("yourItem.toolTip");
  • modId(String modId):

Sets the modId for the item. This is very important, if you don't specify it, textures won't be located for your block, among other things. You should normally set it before any other methods.

yourItem = new SimpleItem().modId("yourModId");
  • isIngot():

Sets the item as an ingot. This is important for the ContentRegistry, which allows plugins to get content by type, such as "ingot", "tool", etc.

yourItem = new SimpleItem().modId("yourModId").isIngot();
  • setTab(CreativeTabs creativetab):

Sets which creative tab the item will appear in.

yourItem = new SimpleItem().modId("yourModId").setTab(CreativeTabs.tabDecorations);
  • setUnlocalizedName(String unlocalizedName):

Sets the code name of the item. Not the name that shows in-game. Also registers the item with both GameRegistry and ContentRegistry.

yourItem = new SimpleItem().modId("yourModId").setUnlocalizedName("your_item");
  • List getItemListFromModId(String modId):

Gets a list of all the SimpleItem's with the specified modId.

List<SimpleItem> items = SimpleItem.getItemListFromModId("yourModId");
for(SimpleItem i : items) {
//do something with the items
}

Example

yourItem = new SimpleItem().modId("yourModId").addToolTip("yourItem.toolTip").isIngot().setTab(CreativeTabs.tabDecorations).setUnlocalizedName("your_item");

Clone this wiki locally