package com.yolp900.itsjustacharm.common.items; import baubles.api.BaubleType; import baubles.api.IBauble; import com.yolp900.itsjustacharm.api.IJCConstants; import com.yolp900.itsjustacharm.common.items.base.ModItem; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import net.minecraftforge.client.model.ModelLoader; import javax.annotation.Nonnull; import java.util.List; public class ItemBaubleRingHolder extends ModItem implements IBauble { public ItemBaubleRingHolder() { super(IJCConstants.Items.BaubleRingHolder); setMaxStackSize(1); setHasSubtypes(true); } @Override public void getSubItems(@Nonnull Item item, CreativeTabs tab, List<ItemStack> subItems) { for (ItemBaubleRingHolder.EnumType type : ItemBaubleRingHolder.EnumType.values()) { subItems.add(new ItemStack(item, 1, type.ordinal())); } } @Override @Nonnull public String getUnlocalizedName(ItemStack stack) { return super.getUnlocalizedName(stack) + ItemBaubleRingHolder.EnumType.values()[stack.getItemDamage()].getName(); } @Override public int getMetadata(int damage) { return damage; } @Override public void registerRender() { for (ItemBaubleRingHolder.EnumType type : ItemBaubleRingHolder.EnumType.values()) { ModelLoader.setCustomModelResourceLocation(this, type.ordinal(), new ModelResourceLocation(this.getRegistryName().toString() + type.getName())); } } @Override public BaubleType getBaubleType(ItemStack stack) { return BaubleType.RING; } @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { } @Override public void onEquipped(ItemStack stack, EntityLivingBase player) { } @Override public void onUnequipped(ItemStack stack, EntityLivingBase player) { } @Override public boolean canEquip(ItemStack stack, EntityLivingBase player) { return true; } @Override public boolean canUnequip(ItemStack stack, EntityLivingBase player) { return true; } public enum EnumType implements IStringSerializable { Basic("Basic"), Advanced("Advanced"); private String name; EnumType(@Nonnull String name) { this.name = name; } @Override @Nonnull public String getName() { return name; } } }