HelpNation Tutorials

Learn how to mod, make, read, or just review modding tutorials and mods!


    [Creating Mods] Making Armor + Adding armor Effects[Windows + Mac][1.0] [Intermediate]

    Share
    avatar
    Original

    Posts : 8
    Join date : 2011-12-11
    Age : 21
    Location : Folsom, CA, USA

    [Creating Mods] Making Armor + Adding armor Effects[Windows + Mac][1.0] [Intermediate]

    Post  Original on Sun Dec 11, 2011 10:56 pm

    If you are on a Mac look at my Setup tutorial then you can continue
    Creating some Armor

    mod_Namehere
    Code:

    package net.minecraft.src;

    import net.minecraft.client.Minecraft;

    public class mod_Namehere extends BaseMod
    {

        public mod_Namehere()
        {
            NamehereHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Nameherehelmet.png");
            NamehereBody.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Nameherebody.png");
            NamehereLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Nameherelegs.png");
            NamehereBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Namehereboots.png");
           
            ModLoader.AddName(NamehereHelmet, "Namehere Helmet");
            ModLoader.AddName(NamehereBody, "Namehere Chestplate");
            ModLoader.AddName(NamehereLegs, "Namehere Leggings");
            ModLoader.AddName(NamehereBoots, "Namehere Boots");
           
            ModLoader.AddRecipe(new ItemStack(NamehereHelmet, 1), new Object[] {"sss", "s s", "  ", Character.valueOf('s'), Item.seeds});
            ModLoader.AddRecipe(new ItemStack(NamehereBody, 1), new Object[] {"s s", "sss", "sss", Character.valueOf('s'), Item.seeds});
            ModLoader.AddRecipe(new ItemStack(NamehereLegs, 1), new Object[] {"sss", "s s", "s s", Character.valueOf('s'), Item.seeds});
            ModLoader.AddRecipe(new ItemStack(NamehereBoots, 1), new Object[] {"  ", "s s", "s s", Character.valueOf('s'), Item.seeds});
        }
       
        static
        {
            new ItemArmor(1000, 3, ModLoader.AddArmor("NamehereArmor"), 0).setItemName("1");
            new ItemArmor(1001, 3, ModLoader.AddArmor("NamehereArmor"), 1).setItemName("2");
            new ItemArmor(1002, 3, ModLoader.AddArmor("NamehereArmor"), 2).setItemName("3");
            new ItemArmor(1003, 3, ModLoader.AddArmor("NamehereArmor"), 3).setItemName("4");
        }

        public String Version()
        {
            return "1.0.0";
        }

        public static Item NamehereHelmet;
        public static Item NamehereBody;
        public static Item NamehereLegs;
        public static Item NamehereBoots;

    }

    HELP:
    At ("NamehereArmor"), 0))
    the 0 is the type of armor

    types 0-Helmet 1-Body 2-Legs 3-Boots

    ----------------------------------------------------------------------

    Adding Effects to the Armor

    put
    Code:
    ModLoader.SetInGameHook(this, true, false);
    under all your recipes

    add
    Code:
    public boolean OnTickInGame(Minecraft minecraft)
        {
            ItemStack boots = minecraft.thePlayer.inventory.armorInventory[0];
            ItemStack legs = minecraft.thePlayer.inventory.armorInventory[1];
            ItemStack chest = minecraft.thePlayer.inventory.armorInventory[2];
            ItemStack helm = minecraft.thePlayer.inventory.armorInventory[3];

            if(boots == null || legs == null || chest == null || helm == null)
            {
                return true;
            }
            if(boots.itemID == NamehereBoots.shiftedIndex && legs.itemID == NamehereLegs.shiftedIndex && chest.itemID == NamehereBody.shiftedIndex && helm.itemID == NamehereHelmet.shiftedIndex)
            {
              minecraft.thePlayer.air = minecraft.thePlayer.maxAir;
            }
                    return true;
        }
    into

    Code:
    ModLoader.AddRecipe(new ItemStack(NamehereBoots, 1), new Object[] {
                "  ", "r r", "r r", Character.valueOf('r'), Item.redstone
            });
                    ModLoader.SetInGameHook(this, true, false);
        }
           
            public boolean OnTickInGame(Minecraft minecraft)
        {
            ItemStack boots = minecraft.thePlayer.inventory.armorInventory[0];
            ItemStack legs = minecraft.thePlayer.inventory.armorInventory[1];
            ItemStack chest = minecraft.thePlayer.inventory.armorInventory[2];
            ItemStack helm = minecraft.thePlayer.inventory.armorInventory[3];

            if(boots == null || legs == null || chest == null || helm == null)
            {
                return true;
            }
            if(boots.itemID == NamehereBoots.shiftedIndex && legs.itemID == NamehereLegs.shiftedIndex && chest.itemID == NamehereBody.shiftedIndex && helm.itemID == NamehereHelmet.shiftedIndex)
            {
              minecraft.thePlayer.air = minecraft.thePlayer.maxAir;
            }
                    return true;
        }

    at the bottom where it says minecraft.thePlayer.air = minecraft.thePlayer.maxAir;
    you can change it to minecraft.thePlayer.isImmuneToFire = true;

      Current date/time is Sun Aug 20, 2017 8:50 pm