當前位置: 首頁>>代碼示例>>Java>>正文


Java PotionEffect.readCustomPotionEffectFromNBT方法代碼示例

本文整理匯總了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());
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:18,代碼來源:LingeringPotion.java

示例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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:34,代碼來源:ItemPotion.java

示例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;
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:8,代碼來源:TippedArrow.java

示例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");
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:55,代碼來源:EntityLivingBase.java

示例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"));
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:7,代碼來源:EntityTippedArrow.java

示例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);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:54,代碼來源:EntityLivingBase.java

示例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);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:54,代碼來源:EntityAreaEffectCloud.java

示例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);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:49,代碼來源:EntityLivingBase.java


注:本文中的net.minecraft.potion.PotionEffect.readCustomPotionEffectFromNBT方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。