本文整理汇总了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);
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}