Jump to content

Recommended Posts

Posted

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

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

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