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