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


Java IAttributeInstance.getModifier方法代碼示例

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


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

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

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

示例3: setSprintingGay

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
public void setSprintingGay(boolean sprinting)
{
	SprintEvent event = new SprintEvent(sprinting);
	event.call();

	sprinting = event.sprint;

	super.setSprinting(sprinting);
	IAttributeInstance var2 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

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

	if (sprinting)
	{
		var2.applyModifier(sprintingSpeedBoostModifier);
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:AbstractClientPlayer.java

示例4: 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:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:EntityLivingBase.java

示例5: 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:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:SharedMonsterAttributes.java

示例6: netherFortressArmor

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/** Handle wearing nether fortress armor */
private boolean netherFortressArmor(LivingHurtEvent e) {
	EntityLivingBase hurt = e.getEntityLiving();

	// do things based on the armor status
	int armorCount = getWearingSetCount(hurt, ItemArmorNether.class);
	if(armorCount > 0) {
		
		// knockback resistance
		IAttributeInstance inst = hurt.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
		AttributeModifier mod = new AttributeModifier(knockbackID, "nfakb", armorCount / 4D, 0).setSaved(false);
		if(inst.getModifier(knockbackID) == null) inst.applyModifier(mod);

		// wither thorns
		if(e.getSource().getTrueSource() != null && e.getSource().getTrueSource() instanceof EntityLivingBase) {
			EntityLivingBase attacker = (EntityLivingBase)e.getSource().getTrueSource();
			attacker.addPotionEffect(new PotionEffect(MobEffects.WITHER, armorCount * 20, armorCount > 2 ? 1 : 0));
		}

		// blast resistance I
		if(e.getSource().isExplosion()) {
			e.setAmount(e.getAmount() * (1 - armorCount / 8F));
		}
		
		return true;
	}
	return false;
}
 
開發者ID:sblectric,項目名稱:AdvancedCombat,代碼行數:29,代碼來源:ArmorHandler.java

示例7: resetStatus

import net.minecraft.entity.ai.attributes.IAttributeInstance; //導入方法依賴的package包/類
/** Reset some stuff every tick */
@SubscribeEvent
public void resetStatus(LivingUpdateEvent e) {
	EntityLivingBase guy = e.getEntityLiving();
	if(!guy.world.isRemote) {

		// nether fortress stuff
		IAttributeInstance inst = guy.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
		if(inst.getModifier(knockbackID) != null) inst.removeModifier(knockbackID);

	}
}
 
開發者ID:sblectric,項目名稱:AdvancedCombat,代碼行數:13,代碼來源:ArmorHandler.java


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