Как прописать эффект , чтобы он срабатывал с некоторым шансом?
package assets.testmod.src;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class Cola extends ItemFood {
public Cola(int par1, int par2, float par3, boolean par4)
{
super(par1, par2, par4);
maxStackSize = 4;
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(ModInfo.MODID + ":Cola"); }
public ItemStack onFoodEaten(ItemStack is, World world, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 0));
return is;
} }
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class Cola extends ItemFood {
public Cola(int par1, int par2, float par3, boolean par4)
{
super(par1, par2, par4);
maxStackSize = 4;
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(ModInfo.MODID + ":Cola"); }
public ItemStack onFoodEaten(ItemStack is, World world, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 0));
return is;
} }
Последнее редактирование: