Jump to content

[1.12]Item doesn't disappearing after crafting.


Zamion101

Recommended Posts

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

V903DP.png 

                         After Crafting

16LGJY.png

Developing Kodev Minecraft Hardcore Mod!

If You're Wondering, My Mod Page. http://minecraft.curseforge.com/projects/minecraft-hardcore-mod

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.