本文整理汇总了Java中net.minecraft.potion.PotionEffect.onUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java PotionEffect.onUpdate方法的具体用法?Java PotionEffect.onUpdate怎么用?Java PotionEffect.onUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.potion.PotionEffect
的用法示例。
在下文中一共展示了PotionEffect.onUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePotionEffects
import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
protected void updatePotionEffects()
{
Iterator<Integer> iterator = this.activePotionsMap.keySet().iterator();
while (iterator.hasNext())
{
Integer integer = (Integer)iterator.next();
PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(integer);
if (!potioneffect.onUpdate(this))
{
if (!this.worldObj.isRemote)
{
iterator.remove();
this.onFinishedPotionEffect(potioneffect);
}
}
else if (potioneffect.getDuration() % 600 == 0)
{
this.onChangedPotionEffect(potioneffect, false);
}
}
if (this.potionsNeedUpdate)
{
if (!this.worldObj.isRemote)
{
this.updatePotionMetadata();
}
this.potionsNeedUpdate = false;
}
int i = this.dataWatcher.getWatchableObjectInt(7);
boolean flag1 = this.dataWatcher.getWatchableObjectByte(8) > 0;
if (i > 0)
{
boolean flag = false;
if (!this.isInvisible())
{
flag = this.rand.nextBoolean();
}
else
{
flag = this.rand.nextInt(15) == 0;
}
if (flag1)
{
flag &= this.rand.nextInt(5) == 0;
}
if (flag && i > 0)
{
double d0 = (double)(i >> 16 & 255) / 255.0D;
double d1 = (double)(i >> 8 & 255) / 255.0D;
double d2 = (double)(i >> 0 & 255) / 255.0D;
this.worldObj.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
}
}
}
示例2: updatePotionEffects
import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
protected void updatePotionEffects()
{
Iterator<Potion> iterator = this.activePotionsMap.keySet().iterator();
try
{
while (iterator.hasNext())
{
Potion potion = (Potion)iterator.next();
PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(potion);
if (!potioneffect.onUpdate(this))
{
if (!this.world.isRemote)
{
iterator.remove();
this.onFinishedPotionEffect(potioneffect);
}
}
else if (potioneffect.getDuration() % 600 == 0)
{
this.onChangedPotionEffect(potioneffect, false);
}
}
}
catch (ConcurrentModificationException var11)
{
;
}
if (this.potionsNeedUpdate)
{
if (!this.world.isRemote)
{
this.updatePotionMetadata();
}
this.potionsNeedUpdate = false;
}
int i = ((Integer)this.dataManager.get(POTION_EFFECTS)).intValue();
boolean flag1 = ((Boolean)this.dataManager.get(HIDE_PARTICLES)).booleanValue();
if (i > 0)
{
boolean flag;
if (this.isInvisible())
{
flag = this.rand.nextInt(15) == 0;
}
else
{
flag = this.rand.nextBoolean();
}
if (flag1)
{
flag &= this.rand.nextInt(5) == 0;
}
if (flag && i > 0)
{
double d0 = (double)(i >> 16 & 255) / 255.0D;
double d1 = (double)(i >> 8 & 255) / 255.0D;
double d2 = (double)(i >> 0 & 255) / 255.0D;
this.world.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
}
}
}
示例3: updatePotionEffects
import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
protected void updatePotionEffects()
{
Iterator<Potion> iterator = this.activePotionsMap.keySet().iterator();
while (iterator.hasNext())
{
Potion potion = (Potion)iterator.next();
PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(potion);
if (!potioneffect.onUpdate(this))
{
if (!this.worldObj.isRemote)
{
iterator.remove();
this.onFinishedPotionEffect(potioneffect);
}
}
else if (potioneffect.getDuration() % 600 == 0)
{
this.onChangedPotionEffect(potioneffect, false);
}
}
if (this.potionsNeedUpdate)
{
if (!this.worldObj.isRemote)
{
this.updatePotionMetadata();
}
this.potionsNeedUpdate = false;
}
int i = ((Integer)this.dataManager.get(POTION_EFFECTS)).intValue();
boolean flag1 = ((Boolean)this.dataManager.get(HIDE_PARTICLES)).booleanValue();
if (i > 0)
{
boolean flag;
if (this.isInvisible())
{
flag = this.rand.nextInt(15) == 0;
}
else
{
flag = this.rand.nextBoolean();
}
if (flag1)
{
flag &= this.rand.nextInt(5) == 0;
}
if (flag && i > 0)
{
double d0 = (double)(i >> 16 & 255) / 255.0D;
double d1 = (double)(i >> 8 & 255) / 255.0D;
double d2 = (double)(i >> 0 & 255) / 255.0D;
this.worldObj.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
}
}
}