Jump to content

Simple 1.6.4 Armor mod


DominuS_RU

Recommended Posts

Hello everyone. I made very simple 1.6.4 mod, but i have a bug with crafting table.

 

When I put my same armor things to the crafting table,  I can craft it to the same thing! Two to one!

Aga5Uq7.jpg

It's wonderful! How can I fix it? Thanks.

 

My code:

 

Main class

package com.example.examplemod;

 

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.event.FMLInitializationEvent;

 

@Mod(modid = Main.MODID, version = Main.MODNAME)

public class Main

{

    public static final String MODID = "mesminemod";

    public static final String MODNAME = "SFSI";

   

    @EventHandler

    public void init(FMLInitializationEvent event)

    {

        Armor.Init();

    }

}

 

Armor class

package com.example.examplemod;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.Item;

import net.minecraftforge.common.EnumHelper;

 

/**

* Created by Alexey(DominuS) on 19.01.2015.

*/

public class Armor {

 

    public static EnumArmorMaterial Armor_Group_1 = EnumHelper.addArmorMaterial("Armor_Group_1", 50, new int[] {80, 80, 80, 80}, 30);

    public static EnumArmorMaterial Armor_Group_2 = EnumHelper.addArmorMaterial("Armor_Group_2", 50, new int[] {50, 50, 50, 50}, 30);

 

    public static Item Helmet_Group_1;

    public static Item Chestplate_Group_1;

    public static Item Leggins_Group_1;

    public static Item Boots_Group_1;

 

    public static Item Helmet_Group_2;

    public static Item Chestplate_Group_2;

    public static Item Leggins_Group_2;

    public static Item Boots_Group_2;

 

 

    public static void Init(){

        GameRegistry.registerItem(Helmet_Group_1 = new ArmorRegisterer(501, "Helmet_Group_1", Armor_Group_1, "g1", 0, 700), null);

        GameRegistry.registerItem(Chestplate_Group_1 = new ArmorRegisterer(502 ,"Chestplate_Group_1", Armor_Group_1, "g1", 1, 700), null);

        GameRegistry.registerItem(Leggins_Group_1 = new ArmorRegisterer(503 ,"Leggins_Group_1", Armor_Group_1, "g1", 2, 700), null);

        GameRegistry.registerItem(Boots_Group_1 = new ArmorRegisterer(504 ,"Boots_Group_1", Armor_Group_1, "g1", 3, 700), null);

 

        GameRegistry.registerItem(Helmet_Group_2 = new ArmorRegisterer(505 ,"Helmet_Group_2", Armor_Group_2, "g2", 0, 680), null);

        GameRegistry.registerItem(Chestplate_Group_2 = new ArmorRegisterer(506 ,"Chestplate_Group_2", Armor_Group_2, "g2", 1, 680), null);

        GameRegistry.registerItem(Leggins_Group_2 = new ArmorRegisterer(507 ,"Leggins_Group_2", Armor_Group_2, "g2", 2, 680), null);

        GameRegistry.registerItem(Boots_Group_2 = new ArmorRegisterer(508 ,"Boots_Group_2", Armor_Group_2, "g2", 3, 680), null);

    }

}

 

ArmorRegisterer class

package com.example.examplemod;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.entity.Entity;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

 

/**

* Created by Alexey(DominuS) on 19.01.2015.

*/

public class ArmorRegisterer extends ItemArmor {

 

    private String textureName;

    private String iconName;

 

 

    public ArmorRegisterer(int id,String name,EnumArmorMaterial material,String textureName,int type,int maxDamage) {

        super(id, material, 0, type);

        iconName = textureName;

        this.textureName = textureName;

        this.setUnlocalizedName(name);

        this.setTextureName(Main.MODID + ":armor/" + textureName);

        this.setMaxDamage(maxDamage);

        this.setCreativeTab(CreativeTab.Tab);

 

    }

 

    @SideOnly(Side.CLIENT)

    public void registerIcons(IconRegister reg){

        if (this.armorType == 0){

            this.itemIcon = reg.registerIcon(Main.MODID + ":armor/" + iconName + "_helmet");

        }else if (this.armorType == 1){

            this.itemIcon = reg.registerIcon(Main.MODID + ":armor/" + iconName + "_chestplate");

        }else if (this.armorType == 2){

            this.itemIcon = reg.registerIcon(Main.MODID + ":armor/" + iconName + "_leggins");

        }else if (this.armorType == 3){

            this.itemIcon = reg.registerIcon(Main.MODID + ":armor/" + iconName + "_boots");

        }

    }

 

    @SideOnly(Side.CLIENT)

    @Override

    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)

    {

        return Main.MODID + ":textures/items/armor/" + textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png";

    }

}

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.