From 25f492ef6585a751480e5a3e9b923a0c2675f4e3 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Fri, 23 Mar 2018 13:24:33 -0400 Subject: [PATCH] *Hopefully* make Nut cry a bit less. --- .../core/RegistrarBloodMagicItems.java | 2 +- .../bloodmagic/item/ItemAlchemicVial.java | 22 ++++++ .../bloodmagic/item/ItemEnumColour.java | 67 ------------------- 3 files changed, 23 insertions(+), 68 deletions(-) create mode 100644 src/main/java/WayofTime/bloodmagic/item/ItemAlchemicVial.java delete mode 100644 src/main/java/WayofTime/bloodmagic/item/ItemEnumColour.java diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java index e7085209..0d9abfe8 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java @@ -212,7 +212,7 @@ public class RegistrarBloodMagicItems new ItemLivingArmourPointsUpgrade().setRegistryName("points_upgrade"), new ItemDemonWillGauge().setRegistryName("demon_will_gauge"), new ItemPotionFlask().setRegistryName("potion_flask"), - new ItemEnumColour.Variant<>(AlchemicTypes.class, "alchemicVial").setRegistryName("alchemic_vial") + new ItemAlchemicVial().setRegistryName("alchemic_vial") )); event.getRegistry().registerAll(items.toArray(new Item[0])); diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemAlchemicVial.java b/src/main/java/WayofTime/bloodmagic/item/ItemAlchemicVial.java new file mode 100644 index 00000000..520bbcb6 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/item/ItemAlchemicVial.java @@ -0,0 +1,22 @@ +package WayofTime.bloodmagic.item; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; + +import javax.annotation.Nonnull; + +import WayofTime.bloodmagic.item.types.AlchemicTypes; +import WayofTime.bloodmagic.item.types.ISubItem; + +public class ItemAlchemicVial & ISubItem> extends ItemEnum.Variant +{ + public ItemAlchemicVial() + { + super((Class) AlchemicTypes.class, "alchemic_vial"); + } + + @Override + public void gatherVariants(@Nonnull Int2ObjectMap variants) + { + variants.put(0, "type=normal"); + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemEnumColour.java b/src/main/java/WayofTime/bloodmagic/item/ItemEnumColour.java deleted file mode 100644 index bb99c6a9..00000000 --- a/src/main/java/WayofTime/bloodmagic/item/ItemEnumColour.java +++ /dev/null @@ -1,67 +0,0 @@ -package WayofTime.bloodmagic.item; - -import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.client.IVariantProvider; -import WayofTime.bloodmagic.item.types.ISubItem; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class ItemEnumColour & ISubItem> extends Item -{ - //Copy of @ItemEnum, except all variants use the same textures with different colouring - protected final T[] types; - - public ItemEnumColour(Class enumClass, String baseName) - { - super(); - - this.types = enumClass.getEnumConstants(); - - setUnlocalizedName(BloodMagic.MODID + "." + baseName); - setHasSubtypes(types.length > 1); - setCreativeTab(BloodMagic.TAB_BM); - } - - @Override - public String getUnlocalizedName(ItemStack stack) - { - return super.getUnlocalizedName(stack) + "." + getItemType(stack).getInternalName(); - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(CreativeTabs tab, NonNullList subItems) - { - if (!isInCreativeTab(tab)) - return; - - for (T type : types) - subItems.add(new ItemStack(this, 1, type.ordinal())); - } - - public T getItemType(ItemStack stack) - { - return types[MathHelper.clamp(stack.getItemDamage(), 0, types.length)]; - } - - public static class Variant & ISubItem> extends ItemEnum implements IVariantProvider - { - - public Variant(Class enumClass, String baseName) - { - super(enumClass, baseName); - } - - @Override - public void gatherVariants(Int2ObjectMap variants) - { - variants.put(0, "type=normal"); - } - } -}