本文整理匯總了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]);
}
}
}