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


Java IAttributeInstance.hasModifier方法代碼示例

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


在下文中一共展示了IAttributeInstance.hasModifier方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: setAttackTarget

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/**
 * Sets the active target the Task system uses for tracking
 */
public void setAttackTarget(@Nullable EntityLivingBase entitylivingbaseIn)
{
    super.setAttackTarget(entitylivingbaseIn);
    IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);

    if (entitylivingbaseIn == null)
    {
        this.targetChangeTime = 0;
        this.dataManager.set(SCREAMING, Boolean.valueOf(false));
        iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
    }
    else
    {
        this.targetChangeTime = this.ticksExisted;
        this.dataManager.set(SCREAMING, Boolean.valueOf(true));

        if (!iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST))
        {
            iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:EntityEnderman.java

示例3: onAdd

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
@Override
public void onAdd(EntityPlayer player, int slot) {
	IAttributeInstance attributeHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
	AttributeModifier modifierHealth = new AttributeModifier(UUID.fromString("83cd6b7e-a838-11e7-abc4-cec278b6b50" + slot), "ringOfBloodHealth4" + slot, 4, 0).setSaved(true);
	if(!attributeHealth.hasModifier(modifierHealth))	
		attributeHealth.applyModifier(modifierHealth);
	
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:9,代碼來源:RingOfBlood.java

示例4: onAdd

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
@Override
public void onAdd(EntityPlayer player, int slot) {
	IAttributeInstance attributeHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
	AttributeModifier modifierHealth = new AttributeModifier(UUID.fromString("d20525ee-98b2-402f-b298-61bc19a9e0c5"), "elementalPendantHealth4", 4, 0).setSaved(true);
	if(!attributeHealth.hasModifier(modifierHealth))	
		attributeHealth.applyModifier(modifierHealth);
	
	IAttributeInstance attributeArmour = player.getEntityAttribute(SharedMonsterAttributes.ARMOR);
	AttributeModifier modifierArmour = new AttributeModifier(UUID.fromString("82b79e32-3c85-4132-b121-03807793338c"), "elementalPendantArmour2", 2, 0).setSaved(true);
	if(!attributeArmour.hasModifier(modifierArmour))	
		attributeArmour.applyModifier(modifierArmour);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:13,代碼來源:ElementalPendant.java

示例5: onAdd

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
@Override
public void onAdd(EntityPlayer player, int slot) {
	IAttributeInstance attributeHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
	AttributeModifier modifierHealth = new AttributeModifier(UUID.fromString("72eb8438-8f2b-11e7-bb31-be2e44b06b34"), "criminalPendantHealth6", 6, 0).setSaved(true);
	if(!attributeHealth.hasModifier(modifierHealth))	
		attributeHealth.applyModifier(modifierHealth);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:8,代碼來源:CriminalPendant.java

示例6: 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

示例7: updateAITasks

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

    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(SoundEvents.ENTITY_ZOMBIE_PIG_ANGRY, 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.world.getPlayerEntityByUUID(this.angerTargetUUID);
        this.setRevengeTarget(entityplayer);
        this.attackingPlayer = entityplayer;
        this.recentlyHit = this.getRevengeTimer();
    }

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

示例8: updateAITasks

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

    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(SoundEvents.ENTITY_ZOMBIE_PIG_ANGRY, 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:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:EntityPigZombie.java


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