Continued goal implementation
This commit is contained in:
@@ -2,6 +2,7 @@ package com.willfp.eco.core.entities.ai;
|
||||
|
||||
import com.willfp.eco.core.Eco;
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
import com.willfp.eco.core.entities.ai.goals.TargetGoal;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -16,8 +17,8 @@ public interface ControlledEntity {
|
||||
* @param goal The goal.
|
||||
* @return The entity.
|
||||
*/
|
||||
ControlledEntity addTarget(int priority,
|
||||
@NotNull EntityGoal goal);
|
||||
ControlledEntity addTargetGoal(int priority,
|
||||
@NotNull TargetGoal goal);
|
||||
|
||||
/**
|
||||
* Add a goal to the entity.
|
||||
@@ -26,8 +27,8 @@ public interface ControlledEntity {
|
||||
* @param goal The goal.
|
||||
* @return The entity.
|
||||
*/
|
||||
ControlledEntity addGoal(int priority,
|
||||
@NotNull EntityGoal goal);
|
||||
ControlledEntity addEntityGoal(int priority,
|
||||
@NotNull EntityGoal goal);
|
||||
|
||||
/**
|
||||
* Get the mob back from the controlled entity.
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.willfp.eco.core.entities.ai.goals;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public record EntityGoalNearestAttackableTarget(
|
||||
@NotNull Class<? extends LivingEntity> targetClass,
|
||||
boolean checkVisibility
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.willfp.eco.core.entities.ai.goals;
|
||||
|
||||
/**
|
||||
* A goal for entity AI.
|
||||
*/
|
||||
public interface TargetGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Avoid entities.
|
||||
*
|
||||
* @param avoidClass The entity classes to avoid.
|
||||
* @param fleeDistance The distance to flee to.
|
||||
* @param slowSpeed The slow movement speed.
|
||||
* @param fastSpeed The fast movement speed.
|
||||
* @param filter The filter for entities to check if they should be avoided.
|
||||
*/
|
||||
public record EntityGoalAvoidEntity(
|
||||
@NotNull Class<? extends LivingEntity> avoidClass,
|
||||
double fleeDistance,
|
||||
double slowSpeed,
|
||||
double fastSpeed,
|
||||
@NotNull Predicate<LivingEntity> filter
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Break doors.
|
||||
*
|
||||
* @param maxProgress The time taken to break the door (any integer above 240).
|
||||
*/
|
||||
public record EntityGoalBreakDoor(
|
||||
int maxProgress
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Breathe air.
|
||||
*/
|
||||
public record EntityGoalBreatheAir(
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Eat block.
|
||||
*/
|
||||
public record EntityGoalEatBlock(
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Flee sun.
|
||||
*
|
||||
* @param speed The speed at which to flee.
|
||||
*/
|
||||
public record EntityGoalFleeSun(
|
||||
double speed
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Float in water.
|
||||
*/
|
||||
public record EntityGoalFloat(
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Follow boats.
|
||||
*/
|
||||
public record EntityGoalFollowBoats(
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
|
||||
/**
|
||||
* Follow other mobs.
|
||||
*
|
||||
* @param speed The speed at which to follow.
|
||||
* @param minDistance The minimum follow distance.
|
||||
* @param maxDistance The maximum follow distance.
|
||||
*/
|
||||
public record EntityGoalFollowMobs(
|
||||
double speed,
|
||||
double minDistance,
|
||||
double maxDistance
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.entity;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.EntityGoal;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Interact with other mobs.
|
||||
*
|
||||
* @param targetClass The type of entity to interact with.
|
||||
* @param range The range at which to interact.
|
||||
* @param chance The chance for interaction, as a percentage.
|
||||
*/
|
||||
public record EntityGoalInteract(
|
||||
@NotNull Class<? extends LivingEntity> targetClass,
|
||||
double range,
|
||||
double chance
|
||||
) implements EntityGoal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.target;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.TargetGoal;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Hurt by entity.
|
||||
*
|
||||
* @param blacklist The entities not to attack when hurt by.
|
||||
*/
|
||||
public record TargetGoalHurtBy(
|
||||
@NotNull Class<? extends LivingEntity>... blacklist
|
||||
) implements TargetGoal {
|
||||
/**
|
||||
* Create target goal.
|
||||
*
|
||||
* @param blacklist The entities not to attack when hurt by.
|
||||
*/
|
||||
@SafeVarargs
|
||||
public TargetGoalHurtBy {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.willfp.eco.core.entities.ai.goals.target;
|
||||
|
||||
import com.willfp.eco.core.entities.ai.goals.TargetGoal;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Target nearest attackable entity.
|
||||
*
|
||||
* @param targetClass The types of entities to attack.
|
||||
* @param checkVisibility If visibility should be checked.
|
||||
*/
|
||||
public record TargetGoalNearestAttackable(
|
||||
@NotNull Class<? extends LivingEntity> targetClass,
|
||||
boolean checkVisibility
|
||||
) implements TargetGoal {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user