Skip to content
Mrbysco edited this page Jan 19, 2024 · 2 revisions

Importing the package

To apply tweaks you first need to have the package imported:
import mods.angrymobs.AITweaks;

More information

In order for Attack related tweaks to do anything the mob will have to have an HurtByTarget AI goal.

  • priority represents the priority of the AI goal.
  • attackDamage represents amount of damage the attack does. (1.0F = half a heart)

Adding Melee Attack Tweak

To add a melee attack AI you call the addMeleeAttackTweak method which uses the following parameters:
EntityType entity, int priority, double speed, float attackDamage, boolean useLongMemory

  • useLongMemory represents if the mob will lose interest when it can't find you / see you. (Most vanilla mobs have it set to false)
  • speed represents the speed at which the mob move to you when attacking.

Usually the attack goals have a priority of 1.
An example would be the following:
AITweaks.addMeleeAttackTweak(<entitytype:minecraft:chicken>, 1, 1.0F, 1.0D, false);
Which will add the melee AI goal to chickens

Adding Projectile Attack Tweak

To add a projectile attack AI you call the addProjectileAttackTweak method which uses the following parameters:
EntityType entity, EntityType projectileEntity, String soundLocation, int priority, float attackDamage, float velocity

  • soundLocation represents the location of the sound that gets played when a projectile is shot. (Example: minecraft:entity.arrow.shoot)
  • velocity represents the velocity of the projectile shot.

Usually the attack goals have a priority of 1.
An example would be the following:
AITweaks.addProjectileAttackTweak(<entitytype:minecraft:chicken>, <entitytype:minecraft:egg>, "minecraft:entity.egg.throw", 1, 1.0F, 1.0F);
Which will add the projectile AI goal to chickens that makes them shoot eggs at you when angry (Eggs don't do damage)

Adding Hurt By Target Tweak

To add Hurt By Target AI you call the addHurtByTargetTweak method which uses the following parameters:
EntityType entity, int priority, boolean callReinforcements

  • callReinforcements represents the ability for the mob to call in reinforcements if it gets attacked.

Usually the Hurt By Target goals have a priority of 1.
An example would be the following:
AITweaks.addHurtByTargetTweak(<entitytype:minecraft:chicken>, 1, true);
Which will add the Hurt By Target AI goal so that they attack back when attacked.

Adding Leap At Target Tweak

To add Leap At Target AI you call the addLeapTweak method which uses the following parameters:
EntityType entity, int priority, float leapMotion

  • leapMotion represents how high the mob will jump.

Usually the leaping goals have a priority of 4.
An example would be the following:
AITweaks.addLeapTweak(<entitytype:minecraft:chicken>, 4, 0.3F);
Which will add the Leap At Target AI goal so that the chicken will jump at it's target.

Adding Attack Nearest Target Tweak

To add Attack Nearest Target AI you call the addAttackNearestTweak method which uses the following parameters:
EntityType entity, EntityType targetEntity, int priority, boolean checkSight

  • targetEntity represents the entity the mob will actively target. (This needs to be a living entity. So you can't target projectiles / items)
  • checkSight represents if the mob will only attack nearby targets. (This is usually set to true)

Usually the Attack Nearest Target goals have a priority of 2.
An example would be the following:
AITweaks.addAttackNearestTweak(<entitytype:minecraft:chicken>, <entitytype:minecraft:player>, 2, true);
Which will add the Attack Nearest Target AI goal so that the chicken actively attack set target.

Adding Avoid Entity tweak (1.2)

To add Avoid Entity AI you call the addAvoidEntityTweak method which uses the following parameters:
EntityType entity, EntityType targetEntity, int priority, float maxDistance, double walkSpeedModifier, double sprintSpeedModifier

  • targetEntity represents the entity the mob will actively target. (This needs to be a living entity. So you can't target projectiles / items)
  • maxDistance represents the max distance it will use to detect if it's near an entity that it should avoid. (This is usually set to 6.0F)
  • walkSpeedModifier represents the walking speed modifier used. (This is usually set to 1.0)(
  • sprintSpeedModifier represents the sprint speed modifier used. (This is usually set to 1.2)

Usually the Avoid Entity goals have a priority of 3.
An example would be the following:
AITweaks.addAvoidEntityTweak(<entitytype:minecraft:pig>, <entitytype:minecraft:player>, 3, 6.0F, 1.0D, 1.2D);
Which will add the Avoid Entity AI goal so that the pig actively avoids players.

Adding Look At Entity tweak (1.2)

To add Avoid Entity AI you call the addLookAtEntityTweak method which uses the following parameters:
EntityType entity, EntityType targetEntity, int priority, float lookDistance

  • targetEntity represents the entity the mob will actively target. (This needs to be a living entity. So you can't target projectiles / items)
  • lookDistance represents the distance it will use to detect if it's near an entity that it look at. (This is usually set to 8.0F)

Usually the Look At Entity goals have a priority of 6.
An example would be the following:
AITweaks.addLookAtEntityTweak(<entitytype:minecraft:sheep>, <entitytype:minecraft:player>, 6, 8.0F);
Which will add the Look At Entity AI goal so that the sheep actively look at players.

Example

You can find an example script here