2015-01-30 20:16:32 +01:00
|
|
|
package ellpeck.someprettyrandomstuff.items;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2015-01-30 20:16:32 +01:00
|
|
|
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
|
|
|
|
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
|
|
|
|
import ellpeck.someprettyrandomstuff.util.Util;
|
2014-11-10 16:47:04 +01:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.StatCollector;
|
2015-02-09 17:25:05 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2015-01-29 20:23:19 +01:00
|
|
|
public class ItemMisc extends Item{
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2015-02-09 17:25:05 +01:00
|
|
|
public static final TheMiscItems[] allMiscItems = TheMiscItems.values();
|
2015-01-29 20:23:19 +01:00
|
|
|
|
|
|
|
public ItemMisc(){
|
|
|
|
this.setUnlocalizedName("itemMisc");
|
2015-01-30 20:16:32 +01:00
|
|
|
this.setHasSubtypes(true);
|
2014-12-03 22:33:46 +01:00
|
|
|
this.setCreativeTab(CreativeTab.instance);
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
|
|
|
|
2015-02-09 17:25:05 +01:00
|
|
|
public int getMetadata(int damage){
|
|
|
|
return damage;
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
|
|
|
|
2015-01-30 20:16:32 +01:00
|
|
|
@SuppressWarnings("all")
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void getSubItems(Item item, CreativeTabs tab, List list){
|
2015-02-09 17:25:05 +01:00
|
|
|
for(int j = 0; j < allMiscItems.length; j++){
|
2015-01-30 20:16:32 +01:00
|
|
|
list.add(new ItemStack(this, 1, j));
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-30 20:16:32 +01:00
|
|
|
public String getUnlocalizedName(ItemStack stack){
|
|
|
|
return this.getUnlocalizedName() + allMiscItems[stack.getItemDamage()].name;
|
|
|
|
}
|
|
|
|
|
2015-01-29 20:23:19 +01:00
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
|
|
|
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + this.getUnlocalizedName(stack).substring(5) + ".desc"));
|
|
|
|
else list.add(Util.shiftForInfo());
|
|
|
|
}
|
|
|
|
}
|