Posted January 18, 20196 yr I'm working on Mod which makes minecraft more Hardcore. But i figured one major problem in my mod. This problem is my custom item doesn't disappear after crafting another item with my custom item. Spoiler My ColoredItem Class public class HColoredItem extends HItem implements IItemColor{ private int colorIndex = 0; public HColoredItem(String name) { super(name); setMaxDamage(0); setContainerItem(this); setHasSubtypes(true); setColored(true); } public HColoredItem(String name, CreativeTabs tabs) { super(name, tabs); setMaxDamage(0); setContainerItem(this); setHasSubtypes(true); setColored(true); } public HColoredItem colorIndex(int index){ this.colorIndex = index; return this; } @Override public int getMetadata(int damage) { return damage; } @Override public String getUnlocalizedName(ItemStack stack) { if(colorIndex == 0){ return getUnlocalizedName() + "." + DyeColor.byMetadata(stack.getMetadata()).getUnlocalizedName(); }else{ return getUnlocalizedName() + "." + MaterialColor.byMetadata(stack.getMetadata()).getUnlocalizedName(); } } @Override public void getSubItems(net.minecraft.creativetab.CreativeTabs tab, NonNullList<ItemStack> items) { if(isInCreativeTab(tab)) { for(int i = 0; i < (this.colorIndex == 0 ? DyeColor.values().length: MaterialColor.values().length); i++){ ItemStack is = new ItemStack(this,1,i); items.add(is); } } } @Override public int colorMultiplier(ItemStack stack, int tintIndex) { if(colorIndex == 0){ return DyeColor.byMetadata(stack.getItemDamage()).getColorValue(); }else{ return MaterialColor.byMetadata(stack.getItemDamage()).getColorValue(); } } } My CustomItem Class public class HItem extends Item { private boolean colored = false; private boolean oreDictionary = false; private String oreDictionaryName = "oreHmm"; private String name = ""; public HItem(String name){ this(name,null); } public HItem(String name,CreativeTabs tabs){ setName(name); setUnlocalizedName(name); setRegistryName(name); if ((tabs == null)) { setCreativeTab(HMM.TABS[0]); } else { setCreativeTab(tabs.getTab()); } } public HItem setOreDictionary(String oreDictionaryName){ this.oreDictionary = true; this.oreDictionaryName = oreDictionaryName; return this; } public boolean isOreDictionary() { return oreDictionary; } public String getOreDictionaryName() { return oreDictionaryName; } public void setColored(boolean colored) { this.colored = colored; } public boolean isColored(){ return colored; } public String getName() { return name; } private void setName(String name) { this.name = name; } } My Recipe Json { "type": "minecraft:crafting_shapeless", "group": "hmm:wool_piece", "ingredients": [ { "item": "minecraft:dye", "data": 4 }, { "item": "hmm:wool_piece", "data": 0 } ], "result": { "item": "hmm:wool_piece", "data": 11 } } Before Crafting After Crafting Developing Kodev Minecraft Hardcore Mod! If You're Wondering, My Mod Page. http://minecraft.curseforge.com/projects/minecraft-hardcore-mod
January 18, 20196 yr Author 12 minutes ago, diesieben07 said: Your images don't work. https://imgur.com/a/sWeF0Lb Developing Kodev Minecraft Hardcore Mod! If You're Wondering, My Mod Page. http://minecraft.curseforge.com/projects/minecraft-hardcore-mod
January 18, 20196 yr Author 10 minutes ago, diesieben07 said: Well. This means "hey, when I am crafted, return myself as the result". Oh i get it Thank You for help. Developing Kodev Minecraft Hardcore Mod! If You're Wondering, My Mod Page. http://minecraft.curseforge.com/projects/minecraft-hardcore-mod
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.