@‘ZeAmateis’:
public class ItemTestCoolDown extends Item
{
protected int cooldown = 0;
protected int twentyMin = 24000; //20 minutes d'attente avant chaques utilisations 24000 = ticks minecraft
public ItemTestCoolDown()
{
super();
this.setCreativeTab(BOTICore.blocks);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
cooldown = cooldown + 1;
if(cooldown == twentyMin)
{
((EntityPlayer) entity).addChatMessage((new ChatComponentText(EnumChatFormatting.GREEN + "You can use it now !")));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(!par2World.isRemote)
{
//CODE ICI
cooldown = 0;
}
return par1ItemStack;
}
Cadeau !
Merci beaucoup ! Sa va me faire avancer je change le sujet en résolu