MC Modding
Please register and join the community!

[1.8.1] Item

View previous topic View next topic Go down

[1.8.1] Item

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

Item

Spoiler:
ItemNamehere
Code:
package net.minecraft.src;

import java.util.Random;

public class ItemNamehere extends Item
{

   public ItemNamehere (int i)
   {
      super(i);
      maxStackSize = 64;
   }
}

mod_Namehere
Code:
package net.minecraft.src;

public class mod_Namehere extends BaseMod
{
  public static final Item Namehere = new Item(30000).setItemName("Namehere");

public mod_Namehere()
{
  Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
  ModLoader.AddName(Namehere, "Namehere");
  ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] {
    "XPX", "PSP", "XPX", Character.valueOf('P'), Item.porkCooked, Character.valueOf('X'), Item.redstone, Character.valueOf('S'), Item.swordStone
    });
}

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

Help: ItemNamehere

1. This file is very simple, the only thing you need to know about is the stacksize which is a no--brainer...

Help: mod_Namehere

1. In the "public static final" part, the 30,000 is the ID for it and it's different to blocks. Item ID's can go up to 32,000!

2. "setitemname blablabla" is the name for it in the coding, not in-game.

3. "Namehere.iconIndex etc." at the end of it is your item's name.

4. "Modloader.AddName" the first Namehere is the name you use in the coding, and the second one is the name in-game.

5. For the version thing, you can change the 1.7.3 to what ever you want. It will show up in the modloader error log.
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] Item

Post by rt8269 on Tue Nov 01, 2011 11:30 pm

how do i make it change to another item when i right click??

rt8269
Member

Posts : 4
Join date : 2011-10-31

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by ikke009 on Wed Nov 02, 2011 10:02 am

avatar
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 23
Location : The netherlands

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by mastereric on Wed Nov 02, 2011 6:50 pm

@Ikke009 how do I make an item so that upon right click it increases your movement speed for 30 seconds?
*Optional* Maybe make the durability bar go down so you know how much time you have left. But don't make it destroy when it reaches 0! the item is expensive.
avatar
mastereric
Member

Posts : 30
Join date : 2011-10-26

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by ikke009 on Wed Nov 02, 2011 10:26 pm

i dont know.. the loop for the durability shouldnt be too hard, just make it so that if durability => 1 then durability = durability - 1 or something..
for increased speed, maybe there is something that can help you in one of the .java files that does the sprinting?
avatar
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 23
Location : The netherlands

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by rt8269 on Fri Nov 04, 2011 10:11 pm

that is an old tut....
i just NEED help!!!
can someone look at my code??

rt8269
Member

Posts : 4
Join date : 2011-10-31

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by lcass on Fri Nov 04, 2011 10:22 pm

can you show me the error that you get and yo uwill need to post your code.

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] Item

Post by rt8269 on Sat Nov 05, 2011 12:23 am

ok there is no error but the item wont do anything when i right click. it is made for giving me a stick on right click.
Code:
package net.minecraft.src;


public class ItemSwitchbladeclosed extends Item
{

    public ItemSwitchbladeclosed(int i, int j)
    {
        super(i);
        setMaxStackSize(1);
    }

    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
    {

        return new ItemStack(Item.stick);
    }

}

rt8269
Member

Posts : 4
Join date : 2011-10-31

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by cosbraa on Sun Nov 06, 2011 12:56 am

Code:
package net.minecraft.src;


public class ItemSwitchbladeclosed extends Item
{

    public ItemSwitchbladeclosed(int i)
    {
        super(i);
        maxStackSize = 1;
    }

    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
    {
        return new ItemStack(Item.stick, 1);
    }

}
see if this works. im on my ipod so im not sure. cant remember what code was.

cosbraa
Member

Posts : 2
Join date : 2011-11-06

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by rt8269 on Mon Nov 14, 2011 7:54 pm

how do i make an item that does damage like a sword??? i looked in the itemsword.java and there are things i don't need like to be able to block. if u could help me that would be great!

rt8269
Member

Posts : 4
Join date : 2011-10-31

View user profile

Back to top Go down

Re: [1.8.1] Item

Post by lcass on Mon Nov 14, 2011 8:14 pm

Please look in the user tutorials that is for making a new type of tool

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] Item

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