net.minecraft.entity.SharedMonsterAttributes Java Examples

The following examples show how to use net.minecraft.entity.SharedMonsterAttributes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityMage.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
protected void handleDrinkingPotionUpdate() {
	if (this.attackTimer-- <= 0) {
		this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F,
				0.8F + this.rand.nextFloat() * 0.4F);
		this.setAggressive(false);
		ItemStack itemstack = this.getHeldItemOffhand();
		this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY);

		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);
	}
}
 
Example #2
Source File: ToolMetaItem.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
    T metaValueItem = getItem(stack);
    HashMultimap<String, AttributeModifier> modifiers = HashMultimap.create();
    modifiers.putAll(super.getAttributeModifiers(slot, stack));
    if (metaValueItem != null && slot == EntityEquipmentSlot.MAINHAND) {
        IToolStats toolStats = metaValueItem.getToolStats();
        if (toolStats == null) {
            return HashMultimap.create();
        }
        float attackDamage = getToolAttackDamage(stack);
        float attackSpeed = toolStats.getAttackSpeed(stack);

        modifiers.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", attackDamage, 0));
        modifiers.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", attackSpeed, 0));
    }
    return modifiers;
}
 
Example #3
Source File: PacketSyncClientHandler.java    From GokiStats with MIT License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(S2CStatSync message, MessageContext ctx) {
    EntityPlayer player = Minecraft.getMinecraft().player;
    if (player == null)
        return null;
    StatBase stat = StatBase.stats.get(message.stat);
    Minecraft.getMinecraft().addScheduledTask(() -> {
        if (stat == Stats.MAX_HEALTH)
            player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH)
                    .setBaseValue(20 + message.amount);
        DataHelper.setPlayerRevertStatLevel(player, stat, message.reverted);
        DataHelper.setPlayerStatLevel(player, stat, message.amount);
        GokiStats.log.debug("Loaded stat from server.");
    });
    return null;
}
 
Example #4
Source File: PotionBuffGolem.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void removeAttributesModifiersFromEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) {
    super.removeAttributesModifiersFromEntity(entity, attrMap, amplifier);

    if(entity instanceof EntityGolemBase) {
        EntityGolemBase golem = (EntityGolemBase) entity;

        IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        if(inst.getModifier(SPEED_INC_PERCENT.getID()) != null) {
            inst.removeModifier(SPEED_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth);
        if(inst.getModifier(HEALTH_INC_PERCENT.getID()) != null) {
            inst.removeModifier(HEALTH_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage);
        if(inst.getModifier(DAMAGE_INC_PERCENT.getID()) != null) {
            inst.removeModifier(DAMAGE_INC_PERCENT);
        }
    }
}
 
Example #5
Source File: ArtifactTickHandler.java    From Artifacts with MIT License 6 votes vote down vote up
private void updateSpeedBoost(int artifactSpeedBoostCount, EntityPlayer player) {
	NBTTagCompound playerData = player.getEntityData();
	int oldSpeedBoostCount = playerData.getInteger("artifactSpeedBoostCount");
	
	if(oldSpeedBoostCount != artifactSpeedBoostCount) {
		String uu = playerData.getString("artifactSpeedBoostUUID");
		UUID speedID;
		
		if(uu.equals("")) {
			speedID = UUID.randomUUID();
			playerData.setString("artifactSpeedBoostUUID", speedID.toString());
		}
		else {
			speedID = UUID.fromString(uu);
		}
		
		IAttributeInstance atinst = player.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
		
		atinst.removeModifier(new AttributeModifier(speedID, "SpeedBoostComponent", 0.05F * oldSpeedBoostCount, 2));
		atinst.applyModifier(new AttributeModifier(speedID, "SpeedBoostComponent", 0.05F * artifactSpeedBoostCount, 2));
		
		playerData.setInteger("artifactSpeedBoostCount", artifactSpeedBoostCount);
	}
}
 
Example #6
Source File: CraftLivingEntity.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setHealth(double health) {
    health = (float) health;
    if ((health < 0) || (health > getMaxHealth())) {
        // Paper - Be more informative
        throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health
                + ". (attribute base value: " + this.getHandle().getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getAttributeValue()
                + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
    }
    // Cauldron start - setHealth must be set before onDeath to respect events that may prevent death.
    getHandle().setHealth((float) health);

    if (entity instanceof EntityPlayerMP && health == 0) {
        ((EntityPlayerMP) entity).onDeath(DamageSource.GENERIC);
    }
    // Cauldron end
}
 
Example #7
Source File: PotionBuffGolem.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void applyAttributesModifiersToEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) {
    super.applyAttributesModifiersToEntity(entity, attrMap, amplifier);

    if(entity instanceof EntityGolemBase) {
        EntityGolemBase golem = (EntityGolemBase) entity;

        IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        if(inst.getModifier(SPEED_INC_PERCENT.getID()) != null) {
            inst.applyModifier(SPEED_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth);
        if(inst.getModifier(HEALTH_INC_PERCENT.getID()) != null) {
            inst.applyModifier(HEALTH_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage);
        if(inst.getModifier(DAMAGE_INC_PERCENT.getID()) != null) {
            inst.applyModifier(DAMAGE_INC_PERCENT);
        }
    }
}
 
Example #8
Source File: EntityMage.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
protected void handleAttackLogicUpdate() {
	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.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().getDistanceSq(this) > 121.0D) {
		potiontype = PotionTypes.SWIFTNESS;
	}

	if (potiontype != null) {
		this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F,
				0.8F + this.rand.nextFloat() * 0.4F);
		this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potiontype));
		this.attackTimer = 10;
		this.setAggressive(true);
		IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
		iattributeinstance.removeModifier(MODIFIER);
		iattributeinstance.applyModifier(MODIFIER);
	}
}
 
Example #9
Source File: EntityEnderminy.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
/**
 * Updates the task
 */
public void updateTask() {
  if(targetPlayer != null) {
    if(--stareTimer <= 0) {
      targetEntity = targetPlayer;
      targetPlayer = null;
      super.startExecuting();
      enderminy.playSound(SoundEvents.ENTITY_ENDERMEN_STARE, 1.0F, 1.0F);
      enderminy.setScreaming(true);
      IAttributeInstance iattributeinstance = enderminy.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
      iattributeinstance.applyModifier(EntityEnderminy.attackingSpeedBoostModifier);
    }
  } else {
    if(targetEntity != null) {
      if(targetEntity instanceof EntityPlayer && enderminy.shouldAttackPlayer((EntityPlayer) this.targetEntity)) {
        if(targetEntity.getDistanceSqToEntity(enderminy) < 16.0D) {
          enderminy.teleportRandomly();
        }
        teleportDelay = 0;
      } else if(targetEntity.getDistanceSqToEntity(enderminy) > 256.0D && this.teleportDelay++ >= 30 && enderminy.teleportToEntity(targetEntity)) {
        teleportDelay = 0;
      }
    }
    super.updateTask();
  }
}
 
Example #10
Source File: EntityEndermanFighter.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void setAttackTarget(@Nullable EntityLivingBase target)
{
    super.setAttackTarget(target);

    IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);

    if (target == null)
    {
        this.setScreaming(false);
        iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
    }
    else
    {
        if (iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST) == false)
        {
            iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST);
        }

        if (target instanceof EntityPlayer && this.isScreaming() == false)
        {
            this.setScreaming(true);
        }
    }
}
 
Example #11
Source File: EntityToroNpc.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
public boolean attackEntityAsMob(Entity entityIn) {
	float f = (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
	int knockback = 0;

	if (entityIn instanceof EntityLivingBase) {
		f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase) entityIn).getCreatureAttribute());
		knockback += EnchantmentHelper.getKnockbackModifier(this);
	}

	boolean successfulAttack = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

	if (successfulAttack) {
		handleSuccessfulAttack(entityIn, knockback);
	}

	return successfulAttack;
}
 
Example #12
Source File: DataHelper.java    From GokiStats with MIT License 6 votes vote down vote up
public static float getDamageDealt(EntityPlayer player, Entity target, DamageSource source) {
    float damage = (float) player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
    float bonusDamage = 0.0F;
    boolean targetIsLiving = target instanceof EntityLivingBase;
    boolean critical;
    ItemStack stack = player.getHeldItemMainhand();
    if (targetIsLiving) {
        bonusDamage = EnchantmentHelper.getModifierForCreature(stack, ((EntityLivingBase) target).getCreatureAttribute());
    }
    if ((damage > 0.0F) || (bonusDamage > 0.0F)) {
        critical = (player.fallDistance > 0.0F) && (!player.onGround) && (!player.isOnLadder()) && (!player.isInWater()) && (!player.isPotionActive(Potion.getPotionFromResourceLocation("blindness"))) && (player.getRidingEntity() == null) && (targetIsLiving);
        if ((critical) && (damage > 0.0F)) {
            damage *= 1.5F;
        }
        damage += bonusDamage;
    }
    return damage;
}
 
Example #13
Source File: EntityCyberZombie.java    From Cyberware with MIT License 6 votes vote down vote up
@Override
public void onLivingUpdate()
{
	if (!this.hasWare && !this.worldObj.isRemote)
	{
		if (!isBrute() && this.worldObj.rand.nextFloat() < (LibConstants.NATURAL_BRUTE_CHANCE / 100F))
		{
			this.setBrute();
		}
		CyberwareDataHandler.addRandomCyberware(this, isBrute());
		if (isBrute())
		{
			this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).applyModifier(new AttributeModifier("Brute Bonus", 6D, 0));
			this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).applyModifier(new AttributeModifier("Brute Bonus", 1D, 0));
		}
		this.setHealth(this.getMaxHealth());
		hasWare = true;
	}
	if (isBrute() && this.height != (1.95F * 1.2F))
	{
		this.setSizeNormal(0.6F * 1.2F, 1.95F * 1.2F);
	}
	super.onLivingUpdate();
}
 
Example #14
Source File: ArtifactTickHandler.java    From Artifacts with MIT License 5 votes vote down vote up
private void updateHealthBoost(int artifactHealthBoostCount, EntityPlayer player) {
	NBTTagCompound playerData = player.getEntityData();
	int oldHealthBoostCount = playerData.getInteger("artifactHealthBoostCount");
	
	if(oldHealthBoostCount != artifactHealthBoostCount) {
		String uu = playerData.getString("artifactHealthBoostUUID");
		UUID healthID;
		
		if(uu.equals("")) {
			healthID = UUID.randomUUID();
			playerData.setString("artifactHealthBoostUUID", healthID.toString());
		}
		else {
			healthID = UUID.fromString(uu);
		}
		
		IAttributeInstance atinst = player.getEntityAttribute(SharedMonsterAttributes.maxHealth);
		
		atinst.removeModifier(new AttributeModifier(healthID, "HealthBoostComponent", 5F * oldHealthBoostCount, 0));
		atinst.applyModifier(new AttributeModifier(healthID, "HealthBoostComponent", 5F * artifactHealthBoostCount, 0));
		
		if(player.getHealth() > player.getMaxHealth()) {
			player.setHealth(player.getMaxHealth());
		}
		int diff = (artifactHealthBoostCount - oldHealthBoostCount);
		if(diff > 0 && player.getHealth() < player.getMaxHealth()) {
			player.heal(5*diff);
		}
		
		playerData.setInteger("artifactHealthBoostCount", artifactHealthBoostCount);
	}
}
 
Example #15
Source File: EntityBas.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.4D);
	this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(200D * ToroQuestConfiguration.bossHealthMultiplier);
	this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5D * ToroQuestConfiguration.bossAttackDamageMultiplier);
	this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(16.0D);
}
 
Example #16
Source File: EntityDireSlime.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public void setSlimeSize(int size,boolean doFullHeal) {
  super.setSlimeSize(size,doFullHeal);
  SlimeConf conf = SlimeConf.getConfForSize(size);
  getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(conf.attackDamage);
  getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(conf.health);
  setHealth(getMaxHealth());
}
 
Example #17
Source File: EntityOwl.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
protected void applyEntityAttributes() {
  super.applyEntityAttributes();
  getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(4.0D);
  getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
  MobInfo.OWL.applyAttributes(this);
  
}
 
Example #18
Source File: ItemHandUpgrade.java    From Cyberware with MIT License 5 votes vote down vote up
public void removeUnarmedDamage(EntityLivingBase entity, ItemStack stack)
{
	if (stack.getItemDamage() == 1)
	{
		HashMultimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
		
		multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(strengthId, "Claws Claws upgrade", 5.5F, 0));
		entity.getAttributeMap().removeAttributeModifiers(multimap);
	}
}
 
Example #19
Source File: ItemTerraTool.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
{
	Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(slot);

	if (slot == EntityEquipmentSlot.MAINHAND)
	{
		multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier 2", (double)this.damageVsEntity, 0));
		multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", (double)this.attackSpeed, 0));
	}

	return multimap;
}
 
Example #20
Source File: EntitySpiritBlight.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void applyEntityAttributes() {
	super.applyEntityAttributes();
	getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(75.0D);
	getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(3.0D);
	//this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0.6D);
}
 
Example #21
Source File: AutoTool.java    From ForgeHax with MIT License 5 votes vote down vote up
private double getAttackDamage(InvItem item) {
  return Optional.ofNullable(
      item.getItemStack()
          .getAttributeModifiers(EntityEquipmentSlot.MAINHAND)
          .get(SharedMonsterAttributes.ATTACK_DAMAGE.getName()))
      .map(at -> at.stream().findAny().map(AttributeModifier::getAmount).orElse(0.D))
      .orElse(0.D);
}
 
Example #22
Source File: EntitySpiritWight.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void applyEntityAttributes() {
	super.applyEntityAttributes();
	getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(100.0);
	getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D);
	//this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0.6D);
}
 
Example #23
Source File: ItemBoneUpgrade.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public void onAdded(EntityLivingBase entity, ItemStack stack)
{
	if (stack.getItemDamage() == 0)
	{
		HashMultimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
		
		multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(healthId, "Bone hp upgrade", 4F * stack.stackSize, 0));
		entity.getAttributeMap().applyAttributeModifiers(multimap);
	}
}
 
Example #24
Source File: ItemHeartUpgrade.java    From Cyberware with MIT License 5 votes vote down vote up
protected float applyArmorCalculations(EntityLivingBase e, DamageSource source, float damage)
{
    if (!source.isUnblockable())
    {
        damage = CombatRules.getDamageAfterAbsorb(damage, (float)e.getTotalArmorValue(), (float)e.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue());
    }

    return damage;
}
 
Example #25
Source File: EntityMonolithEye.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
protected void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(2.0D);
	this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.0D);
	this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(6.0D * ToroQuestConfiguration.bossAttackDamageMultiplier);
	this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(16.0D);
}
 
Example #26
Source File: EssentialsMissingHandler.java    From Cyberware with MIT License 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void overlayPre(ClientTickEvent event)
{
	if (event.phase == Phase.START && Minecraft.getMinecraft() != null && Minecraft.getMinecraft().thePlayer != null)
	{
		EntityPlayer e = Minecraft.getMinecraft().thePlayer;

		HashMultimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
		multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(speedId, "Missing leg speed", -100F, 0));
		e.getAttributeMap().removeAttributeModifiers(multimap);
	}
}
 
Example #27
Source File: EntityFairy.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getAttributeMap().registerAttribute(SharedMonsterAttributes.FLYING_SPEED);
	this.getAttributeMap().registerAttribute(EntityPlayer.REACH_DISTANCE);
	this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1.0D);
	this.getEntityAttribute(SharedMonsterAttributes.FLYING_SPEED).setBaseValue(RandUtil.nextDouble(2, 3));
	this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(1);
	this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(64);
	this.getEntityAttribute(EntityPlayer.REACH_DISTANCE).setBaseValue(5);
}
 
Example #28
Source File: EntityBackupZombie.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(35.0D);
	this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.23D);
	this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3.0D);
	this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(2.0D);
}
 
Example #29
Source File: UnicornMoveHelper.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdateMoveHelper() {
	if (this.action == EntityMoveHelper.Action.MOVE_TO) {
		this.action = EntityMoveHelper.Action.WAIT;
		this.entity.setNoGravity(true);
		double d0 = this.posX - this.entity.posX;
		double d1 = this.posY - this.entity.posY;
		double d2 = this.posZ - this.entity.posZ;
		double d3 = d0 * d0 + d1 * d1 + d2 * d2;

		if (d3 < 2.500000277905201E-7D) {
			this.entity.setMoveVertical(0.0F);
			this.entity.setMoveForward(0.0F);
			return;
		}

		float f = (float) (MathHelper.atan2(d2, d0) * (180D / Math.PI)) - 90.0F;
		this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw, f, 10.0F);
		float f1;

		if (this.entity.onGround) {
			f1 = (float) (this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
		} else {
			f1 = (float) (this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.FLYING_SPEED).getAttributeValue());
		}

		this.entity.setAIMoveSpeed((float) speed);
		double d4 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
		float f2 = (float) (-(MathHelper.atan2(d1, d4) * (180D / Math.PI)));
		this.entity.rotationPitch = this.limitAngle(this.entity.rotationPitch, f2, 10.0F);
		this.entity.setMoveVertical(d1 > 0.0D ? f1 : -f1);
	} else {
		this.entity.setNoGravity(true);
		this.entity.setMoveVertical(0.0F);
		this.entity.setMoveForward(0.0F);
	}
}
 
Example #30
Source File: ItemSword.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
{
    Multimap<String, AttributeModifier> multimap = HashMultimap.create();

    if (slot == EntityEquipmentSlot.MAINHAND)
    {
        double damage = attackDamage != null ? attackDamage : defaultAttackDamage;
        double speed = attackSpeed != null ? attackSpeed : defaultAttackSpeed;
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", damage, 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", speed, 0));
    }
    return multimap;
}