NMS-API es una API simple para controlar la IA de mobs usando NMS.
- Borrar y reemplazar IA de cualquier mob
- Agregar comportamientos personalizados
- Compatible con PAPER/LEAF/PURPUR 1.21.8+
El aldeano vanilla no tiene atributo de daño, tampoco tiene un goal para atacar al jugador, con esta api podemos hacerlo mas simple.
preview.1.mp4
MobGoalBuilder.of(mob)
.clearGoals()
.withMeleeAttack(1, 1.2, true)
.withNearestPlayerTarget(1, true)
.withRandomStroll(2, 1.0)
.build();List<Location> waypoints = List.of(loc1, loc2, loc3);
MobGoalBuilder.of(mob)
.withWaypointPatrol(1, waypoints, 1.0)
.build();clearGoals()
→ Borra toda la IA original del mob
withAttackDamage(double damage)
→ Define el daño de ataque del mob
withMeleeAttack(int priority, double speed, boolean pauseWhenIdle)
→ Agrega ataque al mob si no tiene
withMoveTowardsTarget(int priority, double speed, float distance)
→ Hace que el mob avance hacia su objetivo
withWaypointPatrol(int priority, List<Location> waypoints, double speed)
→ Sigue las pociciones establecidad por waypoints
withRandomStroll(int priority, double speed)
→ Se mueve aleatoriamente
withFleeFromPlayers(int priority, float distance, double walkSpeed, double sprintSpeed)
→ Hace que el mob huya de jugadores
withNearestPlayerTarget(int priority, boolean mustSee)
→ Ataca al jugador más cercano
withHurtByTarget(int priority, Class<?>... ignored)
→ Responde atacando a quien lo ataco
withLookAtNearestPlayer(int priority, float distance)
→ Hace que el mob mire al jugador cercano
withRandomLookaround(int priority)
→ Hace que el mob mire alrededor aleatoriamente
withFollowRange(double range)
→ Define el rango de detección de objetivos
addGoal(int priority, Goal goal)
→ Agrega un Goal NMS personalizado
addTargetGoal(int priority, TargetGoal goal)
→ Agrega un TargetGoal NMS personalizado
dependencies {
compileOnly files("libs/NMSAPI.jar")
} <dependency>
<groupId>me.zandri.nMS</groupId>
<artifactId>NMSAPI</artifactId>
<version>LATEST</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/NMSAPI.jar</systemPath>
</dependency>