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


Java IAttributeInstance.removeModifier方法代碼示例

本文整理匯總了Java中net.minecraft.entity.ai.attributes.IAttributeInstance.removeModifier方法的典型用法代碼示例。如果您正苦於以下問題:Java IAttributeInstance.removeModifier方法的具體用法?Java IAttributeInstance.removeModifier怎麽用?Java IAttributeInstance.removeModifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.ai.attributes.IAttributeInstance的用法示例。


在下文中一共展示了IAttributeInstance.removeModifier方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setAttackTarget

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
@Override
public void setAttackTarget(@Nullable EntityLivingBase entitylivingbaseIn) {
	if (isTamed() && entitylivingbaseIn == getOwner()) {
		return;
	}
	super.setAttackTarget(entitylivingbaseIn);
	IAttributeInstance iattributeinstance = getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);

	if (entitylivingbaseIn == null) {
		dataManager.set(SCREAMING, Boolean.valueOf(false));
		iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
	}
	else {
		dataManager.set(SCREAMING, Boolean.valueOf(true));
		if (isTamed() && isSitting()) {
			setSitting(false);
		}
		if (!iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST)) {
			iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST);
		}
	}
}
 
開發者ID:p455w0rd,項目名稱:EndermanEvolution,代碼行數:23,代碼來源:EntityFrienderman.java

示例2: applyModifiersToAttributeInstance

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
private static void applyModifiersToAttributeInstance(IAttributeInstance instance, NBTTagCompound compound)
{
    instance.setBaseValue(compound.getDouble("Base"));

    if (compound.hasKey("Modifiers", 9))
    {
        NBTTagList nbttaglist = compound.getTagList("Modifiers", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            AttributeModifier attributemodifier = readAttributeModifierFromNBT(nbttaglist.getCompoundTagAt(i));

            if (attributemodifier != null)
            {
                AttributeModifier attributemodifier1 = instance.getModifier(attributemodifier.getID());

                if (attributemodifier1 != null)
                {
                    instance.removeModifier(attributemodifier1);
                }

                instance.applyModifier(attributemodifier);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:SharedMonsterAttributes.java

示例3: setSprinting

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/**
 * Set sprinting switch for Entity.
 */
public void setSprinting(boolean sprinting)
{
    super.setSprinting(sprinting);
    IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);

    if (iattributeinstance.getModifier(SPRINTING_SPEED_BOOST_ID) != null)
    {
        iattributeinstance.removeModifier(SPRINTING_SPEED_BOOST);
    }

    if (sprinting)
    {
        iattributeinstance.applyModifier(SPRINTING_SPEED_BOOST);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:EntityLivingBase.java

示例4: applyModifiersToAttributeInstance

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
private static void applyModifiersToAttributeInstance(IAttributeInstance p_111258_0_, NBTTagCompound p_111258_1_)
{
    p_111258_0_.setBaseValue(p_111258_1_.getDouble("Base"));

    if (p_111258_1_.hasKey("Modifiers", 9))
    {
        NBTTagList nbttaglist = p_111258_1_.getTagList("Modifiers", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            AttributeModifier attributemodifier = readAttributeModifierFromNBT(nbttaglist.getCompoundTagAt(i));

            if (attributemodifier != null)
            {
                AttributeModifier attributemodifier1 = p_111258_0_.getModifier(attributemodifier.getID());

                if (attributemodifier1 != null)
                {
                    p_111258_0_.removeModifier(attributemodifier1);
                }

                p_111258_0_.applyModifier(attributemodifier);
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:SharedMonsterAttributes.java

示例5: setSprinting

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/**
 * Set sprinting switch for Entity.
 */
public void setSprinting(boolean sprinting)
{
    super.setSprinting(sprinting);
    IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

    if (iattributeinstance.getModifier(sprintingSpeedBoostModifierUUID) != null)
    {
        iattributeinstance.removeModifier(sprintingSpeedBoostModifier);
    }

    if (sprinting)
    {
        iattributeinstance.applyModifier(sprintingSpeedBoostModifier);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:EntityLivingBase.java

示例6: setChild

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/**
 * Set whether this zombie is a child.
 */
public void setChild(boolean childZombie)
{
    this.getDataWatcher().updateObject(12, Byte.valueOf((byte)(childZombie ? 1 : 0)));

    if (this.worldObj != null && !this.worldObj.isRemote)
    {
        IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        iattributeinstance.removeModifier(babySpeedBoostModifier);

        if (childZombie)
        {
            iattributeinstance.applyModifier(babySpeedBoostModifier);
        }
    }

    this.setChildSize(childZombie);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:EntityZombie.java

示例7: applyAttributeModifiers

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void applyAttributeModifiers(AbstractAttributeMap attributeMap, int amplifier) {
	for (Map.Entry<IAttribute, AttributeModifier> entry : modifierMap.entrySet()) {
		IAttributeInstance attribute = attributeMap.getAttributeInstance(entry.getKey());
		if (attribute == null) continue;

		AttributeModifier modifier = entry.getValue();
		attribute.removeModifier(modifier);
		attribute.applyModifier(new AttributeModifier(modifier.getID(), this.getName() + " " + amplifier, modifier.getAmount() * (double) (amplifier + 1), modifier.getOperation()));
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:11,代碼來源:BrewAtributeModifier.java

示例8: removeAttributeModifiers

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void removeAttributeModifiers(AbstractAttributeMap attributeMapIn, int amplifier) {
	for (Map.Entry<IAttribute, AttributeModifier> entry : modifierMap.entrySet()) {
		IAttributeInstance attribute = attributeMapIn.getAttributeInstance(entry.getKey());
		if (attribute == null) continue;

		attribute.removeModifier(entry.getValue());
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:9,代碼來源:BrewAtributeModifier.java

示例9: resetTask

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void resetTask()
{
    this.player = null;
    this.enderman.setScreaming(false);
    IAttributeInstance iattributeinstance = this.enderman.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
    iattributeinstance.removeModifier(EntityEnderman.attackingSpeedBoostModifier);
    super.resetTask();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:9,代碼來源:EntityEnderman.java

示例10: removeAttributesModifiersFromEntity

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, AbstractAttributeMap attributeMapIn, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = attributeMapIn.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:Potion.java

示例11: removeAttributesModifiersFromEntity

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:Potion.java

示例12: updateAITasks

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
protected void updateAITasks()
{
    IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

    if (this.isAngry())
    {
        if (!this.isChild() && !iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER))
        {
            iattributeinstance.applyModifier(ATTACK_SPEED_BOOST_MODIFIER);
        }

        --this.angerLevel;
    }
    else if (iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER))
    {
        iattributeinstance.removeModifier(ATTACK_SPEED_BOOST_MODIFIER);
    }

    if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0)
    {
        this.playSound("mob.zombiepig.zpigangry", this.getSoundVolume() * 2.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 1.8F);
    }

    if (this.angerLevel > 0 && this.angerTargetUUID != null && this.getAITarget() == null)
    {
        EntityPlayer entityplayer = this.worldObj.getPlayerEntityByUUID(this.angerTargetUUID);
        this.setRevengeTarget(entityplayer);
        this.attackingPlayer = entityplayer;
        this.recentlyHit = this.getRevengeTimer();
    }

    super.updateAITasks();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:34,代碼來源:EntityPigZombie.java

示例13: applyAttributesModifiersToEntity

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, AbstractAttributeMap attributeMapIn, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = attributeMapIn.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:15,代碼來源:Potion.java

示例14: onLivingUpdate

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/**
 * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
 * use this to react to sunlight and start to burn.
 */
public void onLivingUpdate()
{
    if (!this.worldObj.isRemote)
    {
        if (this.getAggressive())
        {
            if (this.witchAttackTimer-- <= 0)
            {
                this.setAggressive(false);
                ItemStack itemstack = this.getHeldItem();
                this.setCurrentItemOrArmor(0, (ItemStack)null);

                if (itemstack != null && itemstack.getItem() == Items.potionitem)
                {
                    List<PotionEffect> list = Items.potionitem.getEffects(itemstack);

                    if (list != null)
                    {
                        for (PotionEffect potioneffect : list)
                        {
                            this.addPotionEffect(new PotionEffect(potioneffect));
                        }
                    }
                }

                this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeModifier(MODIFIER);
            }
        }
        else
        {
            int i = -1;

            if (this.rand.nextFloat() < 0.15F && this.isInsideOfMaterial(Material.water) && !this.isPotionActive(Potion.waterBreathing))
            {
                i = 8237;
            }
            else if (this.rand.nextFloat() < 0.15F && this.isBurning() && !this.isPotionActive(Potion.fireResistance))
            {
                i = 16307;
            }
            else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth())
            {
                i = 16341;
            }
            else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
            {
                i = 16274;
            }
            else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
            {
                i = 16274;
            }

            if (i > -1)
            {
                this.setCurrentItemOrArmor(0, new ItemStack(Items.potionitem, 1, i));
                this.witchAttackTimer = this.getHeldItem().getMaxItemUseDuration();
                this.setAggressive(true);
                IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
                iattributeinstance.removeModifier(MODIFIER);
                iattributeinstance.applyModifier(MODIFIER);
            }
        }

        if (this.rand.nextFloat() < 7.5E-4F)
        {
            this.worldObj.setEntityState(this, (byte)15);
        }
    }

    super.onLivingUpdate();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:77,代碼來源:EntityWitch.java

示例15: onLivingUpdate

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/**
 * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
 * use this to react to sunlight and start to burn.
 */
public void onLivingUpdate()
{
    if (!this.worldObj.isRemote)
    {
        if (this.isDrinkingPotion())
        {
            if (this.witchAttackTimer-- <= 0)
            {
                this.setAggressive(false);
                ItemStack itemstack = this.getHeldItemMainhand();
                this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, (ItemStack)null);

                if (itemstack != null && itemstack.getItem() == Items.POTIONITEM)
                {
                    List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemstack);

                    if (list != null)
                    {
                        for (PotionEffect potioneffect : list)
                        {
                            this.addPotionEffect(new PotionEffect(potioneffect));
                        }
                    }
                }

                this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(MODIFIER);
            }
        }
        else
        {
            PotionType potiontype = null;

            if (this.rand.nextFloat() < 0.15F && this.isInsideOfMaterial(Material.WATER) && !this.isPotionActive(MobEffects.WATER_BREATHING))
            {
                potiontype = PotionTypes.WATER_BREATHING;
            }
            else if (this.rand.nextFloat() < 0.15F && (this.isBurning() || this.getLastDamageSource() != null && this.getLastDamageSource().isFireDamage()) && !this.isPotionActive(MobEffects.FIRE_RESISTANCE))
            {
                potiontype = PotionTypes.FIRE_RESISTANCE;
            }
            else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth())
            {
                potiontype = PotionTypes.HEALING;
            }
            else if (this.rand.nextFloat() < 0.5F && this.getAttackTarget() != null && !this.isPotionActive(MobEffects.SPEED) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
            {
                potiontype = PotionTypes.SWIFTNESS;
            }

            if (potiontype != null)
            {
                this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potiontype));
                this.witchAttackTimer = this.getHeldItemMainhand().getMaxItemUseDuration();
                this.setAggressive(true);
                this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F);
                IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
                iattributeinstance.removeModifier(MODIFIER);
                iattributeinstance.applyModifier(MODIFIER);
            }
        }

        if (this.rand.nextFloat() < 7.5E-4F)
        {
            this.worldObj.setEntityState(this, (byte)15);
        }
    }

    super.onLivingUpdate();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:74,代碼來源:EntityWitch.java


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