Java tutorial
/* * Copyright (c) 2014 Rosie Alexander and Scott Killen. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, see <http://www.gnu.org/licenses>. */ package mod.steamnsteel.item; import mod.steamnsteel.TheMod; import mod.steamnsteel.library.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import org.apache.commons.lang3.text.WordUtils; public class SteamNSteelItem extends Item { public SteamNSteelItem() { setCreativeTab(TheMod.CREATIVE_TAB); } public static String getFormattedName(Material material) { return WordUtils.capitalizeFully(material.name().toLowerCase()); } @Override public String getUnlocalizedName() { return String.format("item.%s%s", TheMod.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override public String getUnlocalizedName(ItemStack itemStack) { return getUnlocalizedName(); } public static String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf('.') + 1); } }