MC Modding
Please register and join the community!

[1.8.1] Armor

View previous topic View next topic Go down

[1.8.1] Armor

Post by Strengthowns on Wed Jun 15, 2011 6:31 am

Armor

Spoiler:
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", "/Nameherehelmet.png");
        ModLoader.AddName(NamehereHelmet, "Namehere Helmet");
        ModLoader.AddRecipe(new ItemStack(NamehereHelmet, 1), new Object[] {
            "rrr", "r r", "  ", Character.valueOf('r'), Item.redstone
        });
        NamehereBody.iconIndex = ModLoader.addOverride("/gui/items.png", "/Nameherebody.png");
        ModLoader.AddName(NamehereBody, "Namehere Chestplate");
        ModLoader.AddRecipe(new ItemStack(NamehereBody, 1), new Object[] {
            "r r", "rrr", "rrr", Character.valueOf('r'), Item.redstone
        });
        NamehereLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/Nameherelegs.png");
        ModLoader.AddName(NamehereLegs, "Namehere Leggings");
        ModLoader.AddRecipe(new ItemStack(NamehereLegs, 1), new Object[] {
            "rrr", "r r", "r r", Character.valueOf('r'), Item.redstone
        });
        NamehereBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehereboots.png");
        ModLoader.AddName(NamehereBoots, "Namehere Boots");
        ModLoader.AddRecipe(new ItemStack(NamehereBoots, 1), new Object[] {
            "  ", "r r", "r r", Character.valueOf('r'), Item.redstone
        });
    }

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

    public static Item NamehereHelmet = (new ItemArmor(2612, 3, ModLoader.AddArmor("NamehereArmor"), 0)).setItemName("NamehereHelmet");
    public static Item NamehereBody = (new ItemArmor(2613, 3, ModLoader.AddArmor("NamehereArmor"), 1)).setItemName("NamehereBody");
    public static Item NamehereLegs = (new ItemArmor(2614, 3, ModLoader.AddArmor("NamehereArmor"), 2)).setItemName("NamehereLegs");
    public static Item NamehereBoots = (new ItemArmor(2615, 3, ModLoader.AddArmor("NamehereArmor"), 3)).setItemName("NamehereBoots");

}

Help: mod_Namehere

1. You should have read the other tutorials and know it all up to the bottom part.

2. The 261? after new ItemArmor is the ID.

3. After that, the 3 is the material I'm pretty sure.

4. The 0, 1, 2, 3 is armor types. Leave them as they are.

5. After modloader.addarmor, the NamehereArmor is what your
???_1 and ???_2 are called.

6. It reads those files from the armor file in the jar.

7. That's it! Oh, and don't forget to make those armor textures!


[size="3"]Armor Effects[/size]

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

1. Then you can add this to your mod_Namehere file:
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;
    }

2. So it would fit in like this:
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;
    }


3. This means that when your armor set is worn, you will have infinite breath.

4. To have another armor effect for different armor, you can make it something like this:
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;
        }
      if(boots.itemID == Namehere1Boots.shiftedIndex && legs.itemID == Namehere1Legs.shiftedIndex && chest.itemID == Namehere1Body.shiftedIndex && helm.itemID == Namehere1Helmet.shiftedIndex)
        {
          minecraft.thePlayer.isImmuneToFire = true;
        }
      return true;
    }

That's it! Enjoy your new armor with effects!

Creating Overlays
Spoiler:

mod_Namehere
Code:
package net.minecraft.src;

import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;

public class mod_Namehere extends BaseMod
{

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

    public mod_Namehere()
    {
        NamehereHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/Nameherehelmet.png");
        ModLoader.AddName(NamehereHelmet, "Namehere Helmet");
        ModLoader.AddRecipe(new ItemStack(NamehereHelmet, 1), new Object[] {
            "rrr", "r r", "  ", Character.valueOf('r'), Item.redstone
        });
        ModLoader.SetInGameHook(this, true, false);
    }

    public boolean OnTickInGame(Minecraft minecraft)
    {
        if(minecraft == null)
        {
            minecraft = ModLoader.getMinecraftInstance();
        }
        if(minecraft.thePlayer == null || minecraft.theWorld == null)
        {
            return false;
        }
        if(minecraft != null && !minecraft.gameSettings.thirdPersonView && minecraft.thePlayer.inventory.armorItemInSlot(3) != null && minecraft.thePlayer.inventory.armorItemInSlot(3).itemID != Block.pumpkin.blockID && minecraft.thePlayer.inventory.armorItemInSlot(3).itemID == NamehereHelmet.shiftedIndex)
        {
            overlay(minecraft, "%blur%/Myfolder/Namehereoverlay.png");
        }
        return true;
    }

    public void overlay(Minecraft minecraft, String s)
    {
        ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
        int i = scaledresolution.getScaledWidth();
        int j = scaledresolution.getScaledHeight();
        GL11.glEnable(3042 /*GL_BLEND*/);
        GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(770, 771);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
        GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, minecraft.renderEngine.getTexture(s));
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, j, -90D, 0.0D, 1.0D);
        tessellator.addVertexWithUV(i, j, -90D, 1.0D, 1.0D);
        tessellator.addVertexWithUV(i, 0.0D, -90D, 1.0D, 0.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, -90D, 0.0D, 0.0D);
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
        GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(3042 /*GL_BLEND*/);
    }

    public static Item NamehereHelmet = (new ItemArmor(5001, 3, ModLoader.AddArmor("Namehere"), 0)).setItemName("NamehereHelmet");

}

Help: mod_Namehere

1. You know everything up till this bit:
Code:
if(minecraft != null && !minecraft.gameSettings.thirdPersonView && minecraft.thePlayer.inventory.armorItemInSlot(3) != null && minecraft.thePlayer.inventory.armorItemInSlot(3).itemID != Block.pumpkin.blockID && minecraft.thePlayer.inventory.armorItemInSlot(3).itemID == NamehereHelmet.shiftedIndex)

Change the NamehereHelmet at the end of it to what you want the overlay to be used for.

2. Just underneath that is this:
Code:
overlay(minecraft, "%blur%/Myfolder/Namehereoverlay.png");

Leave that %blur% at the front of it, and the Namehereoverlay is what it uses when you wear the helmet.

3. Leave the other stuff as is.

4. The overlay's dimensions that you make should be 512x512.
avatar
Strengthowns
Admin

Posts : 79
Join date : 2011-06-14
Location : Right here!

View user profile http://www.mcmodding.4umer.com

Back to top Go down

Re: [1.8.1] Armor

Post by MasterRedstone114 on Fri Oct 28, 2011 12:25 am

Will you focus more on theez forumz rather Than your modding tutorials on the mc forums?

MasterRedstone114
Member

Posts : 1
Join date : 2011-10-28

View user profile

Back to top Go down

Re: [1.8.1] Armor

Post by the undecided t on Thu Nov 03, 2011 6:39 pm

Where would i look to find the different abilities possible for the armor?
avatar
the undecided t
Helper

Posts : 45
Join date : 2011-10-20
Age : 21

View user profile http://www.blacklistgaming.org/forums

Back to top Go down

Re: [1.8.1] Armor

Post by lcass on Thu Nov 03, 2011 7:30 pm

you would user this code
have a look throgh while doing it
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;
        }
      if(boots.itemID == Namehere1Boots.shiftedIndex && legs.itemID == Namehere1Legs.shiftedIndex && chest.itemID == Namehere1Body.shiftedIndex && helm.itemID == Namehere1Helmet.shiftedIndex)
        {
          minecraft.thePlayer.isImmuneToFire = true;
        }
      return true;
    }

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [1.8.1] Armor

Post by lcass on Thu Nov 03, 2011 7:30 pm

you would just need to see which ones you could theplayeris.

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [1.8.1] Armor

Post by Minecraftn00b123 on Sat Nov 12, 2011 6:50 pm

i dont know where to put this in my mod_namehere...... when i put it somewhere it says for the package net.minecraft.src; that it cannot be resolved to a type. help?

Minecraftn00b123
Member

Posts : 7
Join date : 2011-11-08

View user profile

Back to top Go down

Re: [1.8.1] Armor

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum