本文整理匯總了Java中net.minecraft.potion.PotionEffect.readCustomPotionEffectFromNBT方法的典型用法代碼示例。如果您正苦於以下問題:Java PotionEffect.readCustomPotionEffectFromNBT方法的具體用法?Java PotionEffect.readCustomPotionEffectFromNBT怎麽用?Java PotionEffect.readCustomPotionEffectFromNBT使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.potion.PotionEffect
的用法示例。
在下文中一共展示了PotionEffect.readCustomPotionEffectFromNBT方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getEffects
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@Override
public List<PotionEffect> getEffects(ItemStack stack) {
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9)) {
List<PotionEffect> list = new ArrayList<PotionEffect>();
NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); i++) {
NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbt);
if (potioneffect != null)
list.add(potioneffect);
}
return list;
} else
return getEffects(stack.getItemDamage());
}
示例2: getEffects
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public List<PotionEffect> getEffects(ItemStack stack)
{
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9))
{
List<PotionEffect> list1 = Lists.<PotionEffect>newArrayList();
NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
list1.add(potioneffect);
}
}
return list1;
}
else
{
List<PotionEffect> list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata()));
if (list == null)
{
list = PotionHelper.getPotionEffects(stack.getMetadata(), false);
this.effectCache.put(Integer.valueOf(stack.getMetadata()), list);
}
return list;
}
}
示例3: getEffect
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public static PotionEffect getEffect(ItemStack stack) {
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("Potion", Constants.NBT.TAG_COMPOUND)) {
NBTTagCompound nbt = stack.getTagCompound().getCompoundTag("Potion");
return PotionEffect.readCustomPotionEffectFromNBT(nbt);
}
return null;
}
示例4: readEntityFromNBT
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.setAbsorptionAmount(tagCompund.getFloat("AbsorptionAmount"));
if (tagCompund.hasKey("Attributes", 9) && this.worldObj != null && !this.worldObj.isRemote)
{
SharedMonsterAttributes.func_151475_a(this.getAttributeMap(), tagCompund.getTagList("Attributes", 10));
}
if (tagCompund.hasKey("ActiveEffects", 9))
{
NBTTagList nbttaglist = tagCompund.getTagList("ActiveEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
this.activePotionsMap.put(Integer.valueOf(potioneffect.getPotionID()), potioneffect);
}
}
}
if (tagCompund.hasKey("HealF", 99))
{
this.setHealth(tagCompund.getFloat("HealF"));
}
else
{
NBTBase nbtbase = tagCompund.getTag("Health");
if (nbtbase == null)
{
this.setHealth(this.getMaxHealth());
}
else if (nbtbase.getId() == 5)
{
this.setHealth(((NBTTagFloat)nbtbase).getFloat());
}
else if (nbtbase.getId() == 2)
{
this.setHealth((float)((NBTTagShort)nbtbase).getShort());
}
}
this.hurtTime = tagCompund.getShort("HurtTime");
this.deathTime = tagCompund.getShort("DeathTime");
this.revengeTimer = tagCompund.getInteger("HurtByTimestamp");
}
示例5: readEntityFromNBT
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
if (nbt.hasKey("Effect"))
effect = PotionEffect.readCustomPotionEffectFromNBT((NBTTagCompound) nbt.getTag("Effect"));
}
示例6: readEntityFromNBT
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
this.setAbsorptionAmount(compound.getFloat("AbsorptionAmount"));
if (compound.hasKey("Attributes", 9) && this.world != null && !this.world.isRemote)
{
SharedMonsterAttributes.setAttributeModifiers(this.getAttributeMap(), compound.getTagList("Attributes", 10));
}
if (compound.hasKey("ActiveEffects", 9))
{
NBTTagList nbttaglist = compound.getTagList("ActiveEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
this.activePotionsMap.put(potioneffect.getPotion(), potioneffect);
}
}
}
if (compound.hasKey("Health", 99))
{
this.setHealth(compound.getFloat("Health"));
}
this.hurtTime = compound.getShort("HurtTime");
this.deathTime = compound.getShort("DeathTime");
this.revengeTimer = compound.getInteger("HurtByTimestamp");
if (compound.hasKey("Team", 8))
{
String s = compound.getString("Team");
boolean flag = this.world.getScoreboard().addPlayerToTeam(this.getCachedUniqueIdString(), s);
if (!flag)
{
field_190632_a.info("Unable to add mob to team \"" + s + "\" (that team probably doesn\'t exist)");
}
}
if (compound.getBoolean("FallFlying"))
{
this.setFlag(7, true);
}
}
示例7: readEntityFromNBT
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
this.ticksExisted = compound.getInteger("Age");
this.duration = compound.getInteger("Duration");
this.waitTime = compound.getInteger("WaitTime");
this.reapplicationDelay = compound.getInteger("ReapplicationDelay");
this.durationOnUse = compound.getInteger("DurationOnUse");
this.radiusOnUse = compound.getFloat("RadiusOnUse");
this.radiusPerTick = compound.getFloat("RadiusPerTick");
this.setRadius(compound.getFloat("Radius"));
this.ownerUniqueId = compound.getUniqueId("OwnerUUID");
if (compound.hasKey("Particle", 8))
{
EnumParticleTypes enumparticletypes = EnumParticleTypes.getByName(compound.getString("Particle"));
if (enumparticletypes != null)
{
this.setParticle(enumparticletypes);
this.setParticleParam1(compound.getInteger("ParticleParam1"));
this.setParticleParam2(compound.getInteger("ParticleParam2"));
}
}
if (compound.hasKey("Color", 99))
{
this.setColor(compound.getInteger("Color"));
}
if (compound.hasKey("Potion", 8))
{
this.setPotion(PotionUtils.getPotionTypeFromNBT(compound));
}
if (compound.hasKey("Effects", 9))
{
NBTTagList nbttaglist = compound.getTagList("Effects", 10);
this.effects.clear();
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttaglist.getCompoundTagAt(i));
if (potioneffect != null)
{
this.addEffect(potioneffect);
}
}
}
}
示例8: readEntityFromNBT
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
this.setAbsorptionAmount(compound.getFloat("AbsorptionAmount"));
if (compound.hasKey("Attributes", 9) && this.worldObj != null && !this.worldObj.isRemote)
{
SharedMonsterAttributes.setAttributeModifiers(this.getAttributeMap(), compound.getTagList("Attributes", 10));
}
if (compound.hasKey("ActiveEffects", 9))
{
NBTTagList nbttaglist = compound.getTagList("ActiveEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
this.activePotionsMap.put(potioneffect.getPotion(), potioneffect);
}
}
}
if (compound.hasKey("Health", 99))
{
this.setHealth(compound.getFloat("Health"));
}
this.hurtTime = compound.getShort("HurtTime");
this.deathTime = compound.getShort("DeathTime");
this.revengeTimer = compound.getInteger("HurtByTimestamp");
if (compound.hasKey("Team", 8))
{
String s = compound.getString("Team");
this.worldObj.getScoreboard().addPlayerToTeam(this.getCachedUniqueIdString(), s);
}
if (compound.getBoolean("FallFlying"))
{
this.setFlag(7, true);
}
}