Minestom/demo/src/main/java/net/minestom/demo/entity/ChickenCreature.java

45 lines
1.6 KiB
Java
Raw Normal View History

2022-01-01 18:27:52 +01:00
package net.minestom.demo.entity;
2019-08-10 08:44:35 +02:00
2021-02-23 00:28:24 +01:00
import com.google.common.collect.ImmutableList;
import net.minestom.server.attribute.Attribute;
2021-03-09 00:43:35 +01:00
import net.minestom.server.entity.EntityCreature;
import net.minestom.server.entity.EntityType;
import net.minestom.server.entity.ai.goal.RandomStrollGoal;
2020-08-07 13:21:59 +02:00
2021-03-09 00:43:35 +01:00
public class ChickenCreature extends EntityCreature {
2019-08-10 08:44:35 +02:00
2021-03-09 00:43:35 +01:00
public ChickenCreature() {
super(EntityType.CHICKEN);
2020-04-09 14:25:42 +02:00
2021-02-23 00:28:24 +01:00
addAIGroup(
ImmutableList.of(
// new DoNothingGoal(this, 500, 0.1f),
// new MeleeAttackGoal(this, 500, 2, TimeUnit.MILLISECOND),
new RandomStrollGoal(this, 2)
),
ImmutableList.of(
// new LastEntityDamagerTarget(this, 15),
// new ClosestEntityTarget(this, 15, LivingEntity.class)
)
);
2020-08-06 12:33:45 +02:00
2021-02-24 11:38:42 +01:00
// Another way to register previously added EntityAIGroup, using specialized builder:
// addAIGroup(
// new EntityAIGroupBuilder()
// .addGoalSelector(new DoNothingGoal(this, 500, .1F))
// .addGoalSelector(new MeleeAttackGoal(this, 500, 2, TimeUnit.MILLISECOND))
// .addGoalSelector(new RandomStrollGoal(this, 2))
// .addTargetSelector(new LastEntityDamagerTarget(this, 15))
// .addTargetSelector(new ClosestEntityTarget(this, 15, LivingEntity.class))
// .build()
// );
2021-02-24 11:38:42 +01:00
getAttribute(Attribute.MOVEMENT_SPEED).setBaseValue(0.1f);
2019-08-10 08:44:35 +02:00
}
@Override
2020-08-06 11:56:43 +02:00
public void spawn() {
2019-08-30 01:17:46 +02:00
2019-08-29 02:15:52 +02:00
}
2019-08-10 08:44:35 +02:00
}