Java Code Examples for net.minecraft.item.Item#setRegistryName()

The following examples show how to use net.minecraft.item.Item#setRegistryName() .
Example 1
Project: customstuff4   File: ContentBlockBase.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected void initItem(Item item, ContentHelper helper)
{
    this.item = item;

    item.setUnlocalizedName(helper.getModId() + "." + id);
    item.setRegistryName(id);
}
 
Example 2
Project: BaseMetals   File: Items.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
private static Item registerItem(Item item, String name, MetalMaterial metal, CreativeTabs tab){
	item.setRegistryName(BaseMetals.MODID, name);
	item.setUnlocalizedName(BaseMetals.MODID+"."+name);
	GameRegistry.register(item); 
	itemRegistry.put(item, name);
	if(tab != null){
		item.setCreativeTab(tab);
	}
	if(metal != null){
		itemsByMetal.computeIfAbsent(metal, (MetalMaterial g)->new ArrayList<>());
		itemsByMetal.get(metal).add(item);
	}
	return item;
}