当前位置: 首页>>代码示例>>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;未经允许,请勿转载。