我想将R改回0但由于某种原因它不会这样做。
protected void addPotionEffects(ItemStack item, World world, EntityPlayer player)
{
{
if (R == 3) {
player.addPotionEffect(new PotionEffect(potionEffect[0], potionDuration[0] * 20, potionTier[0]));
player.addPotionEffect(new PotionEffect(potionEffect[1], potionDuration[1] * 20, potionTier[1]));
player.addPotionEffect(new PotionEffect(potionEffect[2], potionDuration[2] * 20, potionTier[2]));
player.addPotionEffect(new PotionEffect(potionEffect[3], potionDuration[3] * 20, potionTier[3]));
player.addPotionEffect(new PotionEffect(potionEffect[4], potionDuration[4] * 20, potionTier[4]));
R = 0;
} else {
player.addPotionEffect(new PotionEffect(potionEffect[1], potionDuration[1] * 20, potionTier[1]));
player.addPotionEffect(new PotionEffect(potionEffect[2], potionDuration[2] * 20, potionTier[2]));
player.addPotionEffect(new PotionEffect(potionEffect[3], potionDuration[3] * 20, potionTier[3]));
player.addPotionEffect(new PotionEffect(potionEffect[4], potionDuration[4] * 20, potionTier[4]));
}
return;
}
}
我是Java的初学者,这个脚本适用于Minecraft。
当我喝牛奶或等到potionDuration[0]
完成时,我不能在比赛中输掉potionEffect [0]。
顺便提一下R = 0
并在每次药水消耗时获得R = Math.abs(R+1);
。
我在脚本或其他地方没有错误。
以下是整个脚本:pastebin.com/ciaLjXZH
那我该怎么做才能解决这个问题?
答案 0 :(得分:0)
修正了它。
我有:
private int R1 = 0;
private int R2 = 0;
但它必须是:
public int R1 = 0;
public int R2 = 0;
感谢所有帮助