[1.8.1] Recharging Item
2 posters
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
[1.8.1] Recharging Item
Recharging Item
- Spoiler:
- ItemNamehere
- Code:
package net.minecraft.src;
import java.util.*;
public class ItemNamehere extends Item
{
public ItemNamehere(int i)
{
super(i);
maxStackSize = 1;
setMaxDamage(40);
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if(itemstack.getItemDamage() == 0)
{
itemstack.damageItem(40, entityplayer);
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() != 0)
{
itemstack.damageItem(-1, entity);
}
}
}
mod_Namehere- Code:
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Item Namehere = (new ItemNamehere(30438)).setItemName("Namehere");
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
}
public String Version()
{
return "1.8.1";
}
}
Help: ItemNamehere
1. Change the 40 in "setMaxDamage(40);" to whatever number you want. This will be how much/long it has to recharge.
2. Again, change the 40 in "itemstack.damageItem(40, entityplayer);" to the number you put in step 1. This is how much the recharge bar goes down on use.
3. Leave everything else as is.Help: mod_Namehere
1. Same as normal.
Re: [1.8.1] Recharging Item
what do you mean by recharging item
pv9avenger- Member
- Posts : 8
Join date : 2012-01-31
Age : 25
Location : Iceland
Similar topics
» [1.8.1] Item
» [SSP Modding For 1.0.0] How To Make An Item For 1.0.0
» How to make a new fuel item {answered}
» [Unanswered]How to make rechargeable item do stuff
» [SSP Modding For 1.0.0] How To Make An Item For 1.0.0
» How to make a new fuel item {answered}
» [Unanswered]How to make rechargeable item do stuff
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum