diff --git a/.gitignore b/.gitignore index 5fc4ce77..8e34c2d4 100644 --- a/.gitignore +++ b/.gitignore @@ -133,15 +133,4 @@ Temporary Items [._]s[a-w][a-z] *.un~ Session.vim -.netrwhist - -# CanaryMod/Minecraft directories -config/ -crash-reports/ -databases/ -db/ -lang/ -logs/ -plugins/ -viutilslogs/ -worlds/ +.netrwhist \ No newline at end of file diff --git a/src/main/java/net/canarymod/api/entity/living/monster/RangedAttackMob.java b/src/main/java/net/canarymod/api/entity/living/monster/RangedAttackMob.java index 1905be3c..46769451 100644 --- a/src/main/java/net/canarymod/api/entity/living/monster/RangedAttackMob.java +++ b/src/main/java/net/canarymod/api/entity/living/monster/RangedAttackMob.java @@ -1,10 +1,10 @@ -package net.canarymod.api.entity.living.monster; - -/** - * Interface for distinguishing which mobs have ranged attack abilities. - * - * @author Aaron - */ -public interface RangedAttackMob { - -} +package net.canarymod.api.entity.living.monster; + +/** + * Interface for distinguishing which mobs have ranged attack abilities. + * + * @author Aaron + */ +public interface RangedAttackMob { + +} diff --git a/src/main/java/net/canarymod/api/factory/AIFactory.java b/src/main/java/net/canarymod/api/factory/AIFactory.java index d492955d..004017ed 100644 --- a/src/main/java/net/canarymod/api/factory/AIFactory.java +++ b/src/main/java/net/canarymod/api/factory/AIFactory.java @@ -1,440 +1,440 @@ -package net.canarymod.api.factory; - -import com.google.common.base.Predicate; -import net.canarymod.api.ai.AIArrowAttack; -import net.canarymod.api.ai.AIAttackOnCollide; -import net.canarymod.api.ai.AIAvoidEntity; -import net.canarymod.api.ai.AIBeg; -import net.canarymod.api.ai.AIBreakDoor; -import net.canarymod.api.ai.AIControlledByPlayer; -import net.canarymod.api.ai.AICreeperSwell; -import net.canarymod.api.ai.AIDefendVillage; -import net.canarymod.api.ai.AIEatGrass; -import net.canarymod.api.ai.AIFindEntityNearest; -import net.canarymod.api.ai.AIFindEntityNearestPlayer; -import net.canarymod.api.ai.AIFleeSun; -import net.canarymod.api.ai.AIFollowGolem; -import net.canarymod.api.ai.AIFollowOwner; -import net.canarymod.api.ai.AIFollowParent; -import net.canarymod.api.ai.AIHarvestFarmland; -import net.canarymod.api.ai.AIHurtByTarget; -import net.canarymod.api.ai.AILeapAtTarget; -import net.canarymod.api.ai.AILookAtTradePlayer; -import net.canarymod.api.ai.AILookAtVillager; -import net.canarymod.api.ai.AILookIdle; -import net.canarymod.api.ai.AIMate; -import net.canarymod.api.ai.AIMoveIndoors; -import net.canarymod.api.ai.AIMoveThroughVillage; -import net.canarymod.api.ai.AIMoveTowardsRestriction; -import net.canarymod.api.ai.AIMoveTowardsTarget; -import net.canarymod.api.ai.AINearestAttackableTarget; -import net.canarymod.api.entity.Entity; -import net.canarymod.api.entity.living.EntityLiving; -import net.canarymod.api.entity.living.IronGolem; -import net.canarymod.api.entity.living.LivingBase; -import net.canarymod.api.entity.living.animal.EntityAnimal; -import net.canarymod.api.entity.living.animal.Tameable; -import net.canarymod.api.entity.living.animal.Wolf; -import net.canarymod.api.entity.living.humanoid.Villager; -import net.canarymod.api.entity.living.monster.Creeper; -import net.canarymod.api.entity.living.monster.EntityMob; -import net.canarymod.api.entity.living.monster.RangedAttackMob; - -/** - * AI Factory - * - * @author Aaron - */ -public interface AIFactory { - - /** - * Returns a new {@link AIArrowAttack} Instance - * - * @param mob - * mob being assigned to this ai - * @param moveSpeed - * move speed towards the target - * @param attackTimeModifier - * higher numbers means longer attack times - * @param maxRangedAttackTime - * longest wait between attacks - * @param maxAttackDistance - * farthest distance the mob will attack from - * - * @return a new {@link AIArrowAttack} Instance - */ - AIArrowAttack newAIArrowAttack(RangedAttackMob mob, double moveSpeed, int attackTimeModifier, int maxRangedAttackTime, int maxAttackDistance); - - /** - * Returns a new {@link AIAttackOnCollide} Instance - * - * @param creature - * creature this AI belongs to. - * @param targetClass - * The class type of the target of this AI. - * @param moveSpeed - * speed the entity will move at when engaged in this activity. - * @param persistant - * Whether or not the mob will attempt to find the target again after - * it is out of sight or unable to reach the target because it cannot - * find any path to take. - * - * @return A new {@link AIAttackOnCollide} Instance - */ - AIAttackOnCollide newAIAttackOnCollide(EntityMob creature, Class targetClass, double moveSpeed, boolean persistant); - - /** - * Returns A new {@link AIAvoidEntity} Instance - * - * @param mob - * The mob this ai belongs to - * @param predicate - * A very specific {@link Predicate} implementation.

- * The Predicate implementation of {@link Predicate#apply(java.lang.Object)} - * will be passed type of {@link net.canarymod.api.entity.Entity}. Your method - * will need to assert true if the AI should avoid the given entity type. Or - * false if it does not need to avoid the entityType. - * @param radius - * Radius of area to check around mob - * @param farSpeed - * movement speed when far from avoided entity. - * @param nearSpeed - * movement speed when near avoided entity - * - * @return A new {@link AIAvoidEntity} Instance - */ - AIAvoidEntity newAIAvoidEntity(EntityMob mob, Predicate predicate, float radius, double farSpeed, double nearSpeed); - - /** - * Returns A new {@link AIBeg} Instance - * - * @param wolf - * Wolf that owns this AI. - * @param minBegDistance - * distance threshold for a wolf to start begging. - * If a player is farther away, it won't beg. - * - * @return A new {@link AIBeg} Instance - */ - AIBeg newAIBeg(Wolf wolf, float minBegDistance); - - /** - * Returns A new {@link AIBreakDoor} Instance. - * This AI class will allow the owner to break down doors in its way. - * - * @param entity - * The entity that owns this AI - * - * @return A new {@link AIBreakDoor} Instance - */ - AIBreakDoor newAIBreakDoor(EntityLiving entity); - - /** - * Returns A new {@link AIControlledByPlayer} Instance. - * - * @param entity - * The entity that owns this AI. - * @param speed - * The speed at which the entity will move. - * - * @return A new {@link AIControlledByPlayer} Instance. - */ - AIControlledByPlayer newAIControlledByPlayer(EntityLiving entity, float speed); - - /** - * Returns A new {@link AICreeperSwell} Instance. - * - * @param creeper - * The {@link Creeper} that owns this AI. - * - * @return A new {@link AICreeperSwell} Instance. - */ - AICreeperSwell newAICreeperSwell(Creeper creeper); - - /** - * Returns A new {@link AIDefendVillage} Instance. - * - * @param ironGolem - * The {@link IronGolem} this AI belongs to. - * - * @return A new {@link AIDefendVillage} Instance. - */ - AIDefendVillage newAIDefendVillage(IronGolem ironGolem); - - /** - * Returns A new {@link AIEatGrass} Instance. - * - * @param entity - * The entity that owns this ai. - * - * @return A new {@link AIEatGrass} Instance. - */ - AIEatGrass newAIEatGrass(EntityLiving entity); - - /** - * Returns A new {@link AIEntityNearest} Instance. - * - * @param entityLiving - * THe Entity that owns this ai. - * @param entityClass - * The class type this entity should target. - * - * @return A new {@link AIEntityNearest} Instance. - */ - AIFindEntityNearest newAIFindEntityNearest(EntityLiving entityLiving, Class entityClass); - - /** - * Returns A new {@link AIEntityNearestPlayer} Instance. - * - * @param entityLiving - * THe Entity that owns this ai. - * - * @return A new {@link AIEntityNearestPlayer} Instance. - */ - AIFindEntityNearestPlayer newAIFindEntityNearestPlayer(EntityLiving entityLiving); - - /** - * Returns A new {@link AIFleeSun} Instance. - * - * @param mob - * the entity that owns this AI. - * @param speed - * the speed at which the mob will move. - * - * @return A new {@link AIFleeSun} Instance. - */ - AIFleeSun newAIFleeSun(EntityMob mob, double speed); - - /** - * Returns A new {@link AIFollowGolem} Instance. - * - * @param villager - * The {@link Villager} that owns this AI. - * - * @return A new {@link AIFollowGolem} Instance. - */ - AIFollowGolem newAIFollowGolem(Villager villager); - - /** - * Returns A new {@link AIFollowOwner} Instance. - * - * @param entity - * the {@link Tameable} entity this AI belongs to. - * @param speed - * Speed at which the entity will move - * @param minDistance - * how close the entity will try to get to its owner. - * @param maxDistance - * distance from owner the entity will try to stay in. - * - * @return A new {@link AIFollowOwner} Instance. - */ - AIFollowOwner newAIFollowOwner(Tameable entity, double speed, float minDistance, float maxDistance); - - /** - * Returns A new {@link AIFollowParent} Instance. - * - * @param animal - * the {@link EntityAnimal} this AI belongs to. - * @param speed - * the speed the animal will move at. - * - * @return A new {@link AIFollowParent} Instance. - */ - AIFollowParent newAIFollowParent(EntityAnimal animal, double speed); - - /** - * Returns A new {@link AIHarvestFarmland} Instance. - * - * @param villager - * The {@link VIllager} this AI belongs to - * @param speed - * speed the villager will walk at. - * - * @return A new {@link AIHarvestFarmland} Instance. - */ - AIHarvestFarmland newAIHarvestFarmland(Villager villager, double speed); - - /** - * Returns A new {@link AIHurtByTarget} Instance. - * - * @param entity - * The {@link EntityMob} this AI belongs to. - * @param callForHelp - * whether or not this mob should rally allies. - * @param targets - * entity classy types to target wiht this logic. - * - * @return A new {@link AIHurtByTarget} Instance. - */ - AIHurtByTarget newAIHurtByTarget(EntityMob entity, boolean callForHelp, Class... targets); - - /** - * Returns A new {@link AILeapAtTarget} Instance. - * - * @param entity - * The entity this AI belongs to. - * @param leapMotionY - * Y motion the leap will be. - * - * @return A new {@link AILeapAtTarget} Instance. - */ - AILeapAtTarget newAILeapAtTarget(EntityLiving entity, float leapMotionY); - - /** - * Returns A new {@link AILookAtTradePlayer} Instance. - * - * @param villager - * The {@link Villager} This AI belongs to. - * - * @return A new {@link AILookAtTradePlayer} Instance. - */ - AILookAtTradePlayer newAILookAtTradePlayer(Villager villager); - - /** - * Returns A new {@link AILookAtVillager} Instance. - * - * @param golem - * the {@link IronGolem} that owns this AI. - * - * @return A new {@link AILookAtVillager} Instance. - */ - AILookAtVillager newAILookAtVillager(IronGolem golem); - - /** - * Returns A new {@link AILookIdle} Instance. - * - * @param entity - * The entity this AI belongs to. - * - * @return A new {@link AILookIdle} Instance. - */ - AILookIdle newAILookIdle(EntityLiving entity); - - /** - * Returns A new {@link AIMate} Instance. - * - * @param animal - * the {@link EntityAnimal} this AI belongs to. - * @param speed - * the speed the animal will move at. - * - * @return A new {@link AIMate} Instance. - */ - AIMate newAIMate(EntityAnimal animal, double speed); - - /** - * Returns A new {@link AIMoveIndoors} Instance. - * - * @param entity - * The {@link EntityMob} that owns this AI. - * - * @return A new {@link AIMoveIndoors} Instance. - */ - AIMoveIndoors newAIMoveIndoors(EntityMob entity); - - /** - * Returns A new {@link AIMoveThroughVillage} Instance. - * - * @param entity - * The {@link EntityMob} that owns this AI. - * @param speed - * the speed the animal will move at. - * @param isNoctournal - * whether or not this creature is active at night time. - * - * @return A new {@link AIMoveThroughVillage} Instance. - */ - AIMoveThroughVillage newAIMoveThroughVillage(EntityMob entity, double speed, boolean isNoctournal); - - /** - * Returns A new {@link AIMoveTowardsRestriction} Instance. - * - * @param entity - * The {@link EntityMob} that owns this AI. - * @param speed - * the speed the animal will move at. - * - * @return A new {@link AIMoveTowardsRestriction} Instance. - */ - AIMoveTowardsRestriction newAIMoveTowardsRestriction(EntityMob entity, double speed); - - /** - * Returns A new {@link AIMoveTowardsRestriction} Instance. - * - * @param entity - * The {@link EntityMob} that owns this AI. - * @param speed - * the speed the animal will move at. - * @param maxDistance - * the max distance away targets can be - * - * @return A new {@link AIMoveTowardsRestriction} Instance. - */ - AIMoveTowardsTarget newAIMoveTowardsTarget(EntityMob entity, double speed, float maxDistance); - - /** - * Returns A new {@link AINearestAttackableTarget} Instance. - * - * @param entity - * The {@link EntityMob} - * @param target - * the class type of entities this mob should target. - * @param targetChanve - * Change to target. - * Must be a positive number. Chanve that AI is targeted will be random - * integer from this number. If the random Integer is equal to 0 then the - * target will fail, there for 1 will provide a 50% change of target, 10 - * will have a 90% chance of target, and 100 will have a 99% chance of target. - * @param shouldCheckSight - * whether or not the entity must be visible - * @param nearbyOnly - * if the entity should only target nearby entities. - * - * @return A new {@link AINearestAttackableTarget} Instance. - */ - AINearestAttackableTarget newAINearestAttackableTarget(EntityMob entity, Class target, int targetChanve, boolean shouldCheckSight, boolean nearbyOnly); - - /*public AIOcelotAttack newAIOcelotAttack(); - - AIOcelotSit newAIOcelotSit(); - - AIOpenDoor newAIOpenDoor(); - - AIOwnerHurtByTarget newAIOwnerHurtByTarget(); - - AIOwnerHurtTarget newAIOwnerHurtTarget(); - - AIPanic newAIPanic(); - - AIPlay newAIPlay(); - - AIRestrictOpenDoor newAIRestrictOpenDoor(); - - AIRestrictSun newAIRestrictSun(); - - AIRunAroundLikeCrazy newAIRunAroundLikeCrazy(); - - AISit newAISit(); - - AISwimming newAISwimming(); - - AITarget newAITarget(); - - AITargetNonTamed newAITargetNonTamed(); - - AITempt newAITempt(); - - AITradePlayer newAITradePlayer(); - - AIVillagerInteract newAIVillagerInteract(); - - AIVillagerMate newAIVillagerMate(); - - AIWander newAIWander(); - - AIWatchClosest newAIWatchClosest(); - - AIWatchClosest2 newAIWatchClosest2(); - /**/ +package net.canarymod.api.factory; + +import com.google.common.base.Predicate; +import net.canarymod.api.ai.AIArrowAttack; +import net.canarymod.api.ai.AIAttackOnCollide; +import net.canarymod.api.ai.AIAvoidEntity; +import net.canarymod.api.ai.AIBeg; +import net.canarymod.api.ai.AIBreakDoor; +import net.canarymod.api.ai.AIControlledByPlayer; +import net.canarymod.api.ai.AICreeperSwell; +import net.canarymod.api.ai.AIDefendVillage; +import net.canarymod.api.ai.AIEatGrass; +import net.canarymod.api.ai.AIFindEntityNearest; +import net.canarymod.api.ai.AIFindEntityNearestPlayer; +import net.canarymod.api.ai.AIFleeSun; +import net.canarymod.api.ai.AIFollowGolem; +import net.canarymod.api.ai.AIFollowOwner; +import net.canarymod.api.ai.AIFollowParent; +import net.canarymod.api.ai.AIHarvestFarmland; +import net.canarymod.api.ai.AIHurtByTarget; +import net.canarymod.api.ai.AILeapAtTarget; +import net.canarymod.api.ai.AILookAtTradePlayer; +import net.canarymod.api.ai.AILookAtVillager; +import net.canarymod.api.ai.AILookIdle; +import net.canarymod.api.ai.AIMate; +import net.canarymod.api.ai.AIMoveIndoors; +import net.canarymod.api.ai.AIMoveThroughVillage; +import net.canarymod.api.ai.AIMoveTowardsRestriction; +import net.canarymod.api.ai.AIMoveTowardsTarget; +import net.canarymod.api.ai.AINearestAttackableTarget; +import net.canarymod.api.entity.Entity; +import net.canarymod.api.entity.living.EntityLiving; +import net.canarymod.api.entity.living.IronGolem; +import net.canarymod.api.entity.living.LivingBase; +import net.canarymod.api.entity.living.animal.EntityAnimal; +import net.canarymod.api.entity.living.animal.Tameable; +import net.canarymod.api.entity.living.animal.Wolf; +import net.canarymod.api.entity.living.humanoid.Villager; +import net.canarymod.api.entity.living.monster.Creeper; +import net.canarymod.api.entity.living.monster.EntityMob; +import net.canarymod.api.entity.living.monster.RangedAttackMob; + +/** + * AI Factory + * + * @author Aaron + */ +public interface AIFactory { + + /** + * Returns a new {@link AIArrowAttack} Instance + * + * @param mob + * mob being assigned to this ai + * @param moveSpeed + * move speed towards the target + * @param attackTimeModifier + * higher numbers means longer attack times + * @param maxRangedAttackTime + * longest wait between attacks + * @param maxAttackDistance + * farthest distance the mob will attack from + * + * @return a new {@link AIArrowAttack} Instance + */ + AIArrowAttack newAIArrowAttack(RangedAttackMob mob, double moveSpeed, int attackTimeModifier, int maxRangedAttackTime, int maxAttackDistance); + + /** + * Returns a new {@link AIAttackOnCollide} Instance + * + * @param creature + * creature this AI belongs to. + * @param targetClass + * The class type of the target of this AI. + * @param moveSpeed + * speed the entity will move at when engaged in this activity. + * @param persistant + * Whether or not the mob will attempt to find the target again after + * it is out of sight or unable to reach the target because it cannot + * find any path to take. + * + * @return A new {@link AIAttackOnCollide} Instance + */ + AIAttackOnCollide newAIAttackOnCollide(EntityMob creature, Class targetClass, double moveSpeed, boolean persistant); + + /** + * Returns A new {@link AIAvoidEntity} Instance + * + * @param mob + * The mob this ai belongs to + * @param predicate + * A very specific {@link Predicate} implementation.

+ * The Predicate implementation of {@link Predicate#apply(java.lang.Object)} + * will be passed type of {@link net.canarymod.api.entity.Entity}. Your method + * will need to assert true if the AI should avoid the given entity type. Or + * false if it does not need to avoid the entityType. + * @param radius + * Radius of area to check around mob + * @param farSpeed + * movement speed when far from avoided entity. + * @param nearSpeed + * movement speed when near avoided entity + * + * @return A new {@link AIAvoidEntity} Instance + */ + AIAvoidEntity newAIAvoidEntity(EntityMob mob, Predicate predicate, float radius, double farSpeed, double nearSpeed); + + /** + * Returns A new {@link AIBeg} Instance + * + * @param wolf + * Wolf that owns this AI. + * @param minBegDistance + * distance threshold for a wolf to start begging. + * If a player is farther away, it won't beg. + * + * @return A new {@link AIBeg} Instance + */ + AIBeg newAIBeg(Wolf wolf, float minBegDistance); + + /** + * Returns A new {@link AIBreakDoor} Instance. + * This AI class will allow the owner to break down doors in its way. + * + * @param entity + * The entity that owns this AI + * + * @return A new {@link AIBreakDoor} Instance + */ + AIBreakDoor newAIBreakDoor(EntityLiving entity); + + /** + * Returns A new {@link AIControlledByPlayer} Instance. + * + * @param entity + * The entity that owns this AI. + * @param speed + * The speed at which the entity will move. + * + * @return A new {@link AIControlledByPlayer} Instance. + */ + AIControlledByPlayer newAIControlledByPlayer(EntityLiving entity, float speed); + + /** + * Returns A new {@link AICreeperSwell} Instance. + * + * @param creeper + * The {@link Creeper} that owns this AI. + * + * @return A new {@link AICreeperSwell} Instance. + */ + AICreeperSwell newAICreeperSwell(Creeper creeper); + + /** + * Returns A new {@link AIDefendVillage} Instance. + * + * @param ironGolem + * The {@link IronGolem} this AI belongs to. + * + * @return A new {@link AIDefendVillage} Instance. + */ + AIDefendVillage newAIDefendVillage(IronGolem ironGolem); + + /** + * Returns A new {@link AIEatGrass} Instance. + * + * @param entity + * The entity that owns this ai. + * + * @return A new {@link AIEatGrass} Instance. + */ + AIEatGrass newAIEatGrass(EntityLiving entity); + + /** + * Returns A new {@link AIEntityNearest} Instance. + * + * @param entityLiving + * THe Entity that owns this ai. + * @param entityClass + * The class type this entity should target. + * + * @return A new {@link AIEntityNearest} Instance. + */ + AIFindEntityNearest newAIFindEntityNearest(EntityLiving entityLiving, Class entityClass); + + /** + * Returns A new {@link AIEntityNearestPlayer} Instance. + * + * @param entityLiving + * THe Entity that owns this ai. + * + * @return A new {@link AIEntityNearestPlayer} Instance. + */ + AIFindEntityNearestPlayer newAIFindEntityNearestPlayer(EntityLiving entityLiving); + + /** + * Returns A new {@link AIFleeSun} Instance. + * + * @param mob + * the entity that owns this AI. + * @param speed + * the speed at which the mob will move. + * + * @return A new {@link AIFleeSun} Instance. + */ + AIFleeSun newAIFleeSun(EntityMob mob, double speed); + + /** + * Returns A new {@link AIFollowGolem} Instance. + * + * @param villager + * The {@link Villager} that owns this AI. + * + * @return A new {@link AIFollowGolem} Instance. + */ + AIFollowGolem newAIFollowGolem(Villager villager); + + /** + * Returns A new {@link AIFollowOwner} Instance. + * + * @param entity + * the {@link Tameable} entity this AI belongs to. + * @param speed + * Speed at which the entity will move + * @param minDistance + * how close the entity will try to get to its owner. + * @param maxDistance + * distance from owner the entity will try to stay in. + * + * @return A new {@link AIFollowOwner} Instance. + */ + AIFollowOwner newAIFollowOwner(Tameable entity, double speed, float minDistance, float maxDistance); + + /** + * Returns A new {@link AIFollowParent} Instance. + * + * @param animal + * the {@link EntityAnimal} this AI belongs to. + * @param speed + * the speed the animal will move at. + * + * @return A new {@link AIFollowParent} Instance. + */ + AIFollowParent newAIFollowParent(EntityAnimal animal, double speed); + + /** + * Returns A new {@link AIHarvestFarmland} Instance. + * + * @param villager + * The {@link VIllager} this AI belongs to + * @param speed + * speed the villager will walk at. + * + * @return A new {@link AIHarvestFarmland} Instance. + */ + AIHarvestFarmland newAIHarvestFarmland(Villager villager, double speed); + + /** + * Returns A new {@link AIHurtByTarget} Instance. + * + * @param entity + * The {@link EntityMob} this AI belongs to. + * @param callForHelp + * whether or not this mob should rally allies. + * @param targets + * entity classy types to target wiht this logic. + * + * @return A new {@link AIHurtByTarget} Instance. + */ + AIHurtByTarget newAIHurtByTarget(EntityMob entity, boolean callForHelp, Class... targets); + + /** + * Returns A new {@link AILeapAtTarget} Instance. + * + * @param entity + * The entity this AI belongs to. + * @param leapMotionY + * Y motion the leap will be. + * + * @return A new {@link AILeapAtTarget} Instance. + */ + AILeapAtTarget newAILeapAtTarget(EntityLiving entity, float leapMotionY); + + /** + * Returns A new {@link AILookAtTradePlayer} Instance. + * + * @param villager + * The {@link Villager} This AI belongs to. + * + * @return A new {@link AILookAtTradePlayer} Instance. + */ + AILookAtTradePlayer newAILookAtTradePlayer(Villager villager); + + /** + * Returns A new {@link AILookAtVillager} Instance. + * + * @param golem + * the {@link IronGolem} that owns this AI. + * + * @return A new {@link AILookAtVillager} Instance. + */ + AILookAtVillager newAILookAtVillager(IronGolem golem); + + /** + * Returns A new {@link AILookIdle} Instance. + * + * @param entity + * The entity this AI belongs to. + * + * @return A new {@link AILookIdle} Instance. + */ + AILookIdle newAILookIdle(EntityLiving entity); + + /** + * Returns A new {@link AIMate} Instance. + * + * @param animal + * the {@link EntityAnimal} this AI belongs to. + * @param speed + * the speed the animal will move at. + * + * @return A new {@link AIMate} Instance. + */ + AIMate newAIMate(EntityAnimal animal, double speed); + + /** + * Returns A new {@link AIMoveIndoors} Instance. + * + * @param entity + * The {@link EntityMob} that owns this AI. + * + * @return A new {@link AIMoveIndoors} Instance. + */ + AIMoveIndoors newAIMoveIndoors(EntityMob entity); + + /** + * Returns A new {@link AIMoveThroughVillage} Instance. + * + * @param entity + * The {@link EntityMob} that owns this AI. + * @param speed + * the speed the animal will move at. + * @param isNoctournal + * whether or not this creature is active at night time. + * + * @return A new {@link AIMoveThroughVillage} Instance. + */ + AIMoveThroughVillage newAIMoveThroughVillage(EntityMob entity, double speed, boolean isNoctournal); + + /** + * Returns A new {@link AIMoveTowardsRestriction} Instance. + * + * @param entity + * The {@link EntityMob} that owns this AI. + * @param speed + * the speed the animal will move at. + * + * @return A new {@link AIMoveTowardsRestriction} Instance. + */ + AIMoveTowardsRestriction newAIMoveTowardsRestriction(EntityMob entity, double speed); + + /** + * Returns A new {@link AIMoveTowardsRestriction} Instance. + * + * @param entity + * The {@link EntityMob} that owns this AI. + * @param speed + * the speed the animal will move at. + * @param maxDistance + * the max distance away targets can be + * + * @return A new {@link AIMoveTowardsRestriction} Instance. + */ + AIMoveTowardsTarget newAIMoveTowardsTarget(EntityMob entity, double speed, float maxDistance); + + /** + * Returns A new {@link AINearestAttackableTarget} Instance. + * + * @param entity + * The {@link EntityMob} + * @param target + * the class type of entities this mob should target. + * @param targetChanve + * Change to target. + * Must be a positive number. Chanve that AI is targeted will be random + * integer from this number. If the random Integer is equal to 0 then the + * target will fail, there for 1 will provide a 50% change of target, 10 + * will have a 90% chance of target, and 100 will have a 99% chance of target. + * @param shouldCheckSight + * whether or not the entity must be visible + * @param nearbyOnly + * if the entity should only target nearby entities. + * + * @return A new {@link AINearestAttackableTarget} Instance. + */ + AINearestAttackableTarget newAINearestAttackableTarget(EntityMob entity, Class target, int targetChanve, boolean shouldCheckSight, boolean nearbyOnly); + + /*public AIOcelotAttack newAIOcelotAttack(); + + AIOcelotSit newAIOcelotSit(); + + AIOpenDoor newAIOpenDoor(); + + AIOwnerHurtByTarget newAIOwnerHurtByTarget(); + + AIOwnerHurtTarget newAIOwnerHurtTarget(); + + AIPanic newAIPanic(); + + AIPlay newAIPlay(); + + AIRestrictOpenDoor newAIRestrictOpenDoor(); + + AIRestrictSun newAIRestrictSun(); + + AIRunAroundLikeCrazy newAIRunAroundLikeCrazy(); + + AISit newAISit(); + + AISwimming newAISwimming(); + + AITarget newAITarget(); + + AITargetNonTamed newAITargetNonTamed(); + + AITempt newAITempt(); + + AITradePlayer newAITradePlayer(); + + AIVillagerInteract newAIVillagerInteract(); + + AIVillagerMate newAIVillagerMate(); + + AIWander newAIWander(); + + AIWatchClosest newAIWatchClosest(); + + AIWatchClosest2 newAIWatchClosest2(); + /**/ } \ No newline at end of file diff --git a/src/main/java/net/canarymod/commandsys/PlayerSelector.java b/src/main/java/net/canarymod/commandsys/PlayerSelector.java index ebd54afe..107bf26c 100644 --- a/src/main/java/net/canarymod/commandsys/PlayerSelector.java +++ b/src/main/java/net/canarymod/commandsys/PlayerSelector.java @@ -1,47 +1,47 @@ -package net.canarymod.commandsys; - -import net.canarymod.api.entity.living.humanoid.Player; -import net.canarymod.chat.MessageReceiver; - -/** - * A class that handles the "@" attribute - * - * @author Ehud (EhudB) - * @author Almog (Swift) - */ -public interface PlayerSelector { - - /** - * Get one player that matches the pattern - * - * @param caller - * the {@link MessageReceiver} that sent the pattern - * @param pattern - * the pattern that was sent - * - * @return the one {@link Player} that matches the pattern, if multiple or none returns null - */ - Player matchOnePlayer(MessageReceiver caller, String pattern); - - /** - * Get all players that matches the pattern - * - * @param caller - * the {@link MessageReceiver} that sent the pattern - * @param pattern - * the pattern that was sent - * - * @return all players that matches the pattern - */ - Player[] matchPlayers(MessageReceiver caller, String pattern); - - /** - * Returns if the pattern can match more then one player - * - * @param pattern - * the pattern to check - * - * @return if the pattern matches more the one player - */ - boolean matchesMultiplePlayers(String pattern); -} +package net.canarymod.commandsys; + +import net.canarymod.api.entity.living.humanoid.Player; +import net.canarymod.chat.MessageReceiver; + +/** + * A class that handles the "@" attribute + * + * @author Ehud (EhudB) + * @author Almog (Swift) + */ +public interface PlayerSelector { + + /** + * Get one player that matches the pattern + * + * @param caller + * the {@link MessageReceiver} that sent the pattern + * @param pattern + * the pattern that was sent + * + * @return the one {@link Player} that matches the pattern, if multiple or none returns null + */ + Player matchOnePlayer(MessageReceiver caller, String pattern); + + /** + * Get all players that matches the pattern + * + * @param caller + * the {@link MessageReceiver} that sent the pattern + * @param pattern + * the pattern that was sent + * + * @return all players that matches the pattern + */ + Player[] matchPlayers(MessageReceiver caller, String pattern); + + /** + * Returns if the pattern can match more then one player + * + * @param pattern + * the pattern to check + * + * @return if the pattern matches more the one player + */ + boolean matchesMultiplePlayers(String pattern); +} diff --git a/src/main/java/net/canarymod/hook/entity/ChickenLayEggHook.java b/src/main/java/net/canarymod/hook/entity/ChickenLayEggHook.java index e5525024..e8dcb25c 100644 --- a/src/main/java/net/canarymod/hook/entity/ChickenLayEggHook.java +++ b/src/main/java/net/canarymod/hook/entity/ChickenLayEggHook.java @@ -1,85 +1,85 @@ -package net.canarymod.hook.entity; - -import net.canarymod.api.entity.living.animal.Chicken; -import net.canarymod.api.inventory.Item; -import net.canarymod.hook.CancelableHook; - -/** - * Chicken lay egg hook, called when a chicken lay an egg. - * - * @author Ehud (EhudB) - */ -public class ChickenLayEggHook extends CancelableHook { - - private Chicken chicken; - private Item egg; - private int nextEggIn; - - /** - * Creates a new ChickenLayEggHook - * - * @param chicken - * the chicken that laid the egg - * @param egg - * the egg that has been laid - * @param nextEggIn - * the time until next egg will be laid - */ - public ChickenLayEggHook(Chicken chicken, Item egg, int nextEggIn) { - this.chicken = chicken; - this.egg = egg; - this.nextEggIn = nextEggIn; - } - - /** - * Get the {@link Chicken} the laid the egg - * - * @return the chicken that laid the egg - */ - public Chicken getChicken() { - return this.chicken; - } - - /** - * Get the egg that was laid - * - * @return the egg that was laid - */ - public Item getEgg() { - return this.egg.clone(); - } - - /** - * Change the egg that should be laid - * - * @param egg - * the egg that should be laid - */ - public void setEgg(Item egg) { - this.egg = egg; - } - - /** - * Get the time until the next egg will be laid for the chicken that laid the egg - * - * @return time until next egg will be laid from the current chicken - */ - public int getNextEggIn() { - return this.nextEggIn; - } - - /** - * Set the time until next egg will be laid from the chicken that laid the egg - * - * @param nextEggIn - * time until next egg will be laid - */ - public void setNextEggIn(int nextEggIn) { - this.nextEggIn = nextEggIn; - } - - @Override - public String toString() { - return String.format("%s[Chicken=%s, Egg=%s, Time Until Next Egg=%s", getHookName(), chicken, egg, nextEggIn); - } -} +package net.canarymod.hook.entity; + +import net.canarymod.api.entity.living.animal.Chicken; +import net.canarymod.api.inventory.Item; +import net.canarymod.hook.CancelableHook; + +/** + * Chicken lay egg hook, called when a chicken lay an egg. + * + * @author Ehud (EhudB) + */ +public class ChickenLayEggHook extends CancelableHook { + + private Chicken chicken; + private Item egg; + private int nextEggIn; + + /** + * Creates a new ChickenLayEggHook + * + * @param chicken + * the chicken that laid the egg + * @param egg + * the egg that has been laid + * @param nextEggIn + * the time until next egg will be laid + */ + public ChickenLayEggHook(Chicken chicken, Item egg, int nextEggIn) { + this.chicken = chicken; + this.egg = egg; + this.nextEggIn = nextEggIn; + } + + /** + * Get the {@link Chicken} the laid the egg + * + * @return the chicken that laid the egg + */ + public Chicken getChicken() { + return this.chicken; + } + + /** + * Get the egg that was laid + * + * @return the egg that was laid + */ + public Item getEgg() { + return this.egg.clone(); + } + + /** + * Change the egg that should be laid + * + * @param egg + * the egg that should be laid + */ + public void setEgg(Item egg) { + this.egg = egg; + } + + /** + * Get the time until the next egg will be laid for the chicken that laid the egg + * + * @return time until next egg will be laid from the current chicken + */ + public int getNextEggIn() { + return this.nextEggIn; + } + + /** + * Set the time until next egg will be laid from the chicken that laid the egg + * + * @param nextEggIn + * time until next egg will be laid + */ + public void setNextEggIn(int nextEggIn) { + this.nextEggIn = nextEggIn; + } + + @Override + public String toString() { + return String.format("%s[Chicken=%s, Egg=%s, Time Until Next Egg=%s", getHookName(), chicken, egg, nextEggIn); + } +} diff --git a/src/main/java/net/canarymod/hook/entity/SlimeSplitHook.java b/src/main/java/net/canarymod/hook/entity/SlimeSplitHook.java index 5012a4fb..5ef99d18 100644 --- a/src/main/java/net/canarymod/hook/entity/SlimeSplitHook.java +++ b/src/main/java/net/canarymod/hook/entity/SlimeSplitHook.java @@ -1,53 +1,53 @@ -package net.canarymod.hook.entity; - -import net.canarymod.api.entity.living.monster.Slime; -import net.canarymod.hook.Hook; - -import java.util.List; - -/** - * Slime split hook, Contains information about a slime split. - * - * @author Ehud (EhudB) - */ -public class SlimeSplitHook extends Hook { - - private Slime originalSlime; - private List childSlimes; - - /** - * Constructs a new SlimeSplitHook - * - * @param originalSlime - * the original {@link Slime} that died - * @param childSlimes - * the {@link Slime}s that should spawn - */ - public SlimeSplitHook(Slime originalSlime, List childSlimes) { - this.originalSlime = originalSlime; - this.childSlimes = childSlimes; - } - - /** - * Get the original {@link Slime} that died - * - * @return the {@link Slime} that died - */ - public Slime getOriginalSlime() { - return this.originalSlime; - } - - /** - * Get the {@link Slime}s that should be spawned - * - * @return a list of {@link Slime}s that will spawn - */ - public List getChildSlimes() { - return this.childSlimes; - } - - @Override - public String toString() { - return String.format("%s[Original Slime=%s, Child Slimes=%s", getHookName(), originalSlime, childSlimes); - } -} +package net.canarymod.hook.entity; + +import net.canarymod.api.entity.living.monster.Slime; +import net.canarymod.hook.Hook; + +import java.util.List; + +/** + * Slime split hook, Contains information about a slime split. + * + * @author Ehud (EhudB) + */ +public class SlimeSplitHook extends Hook { + + private Slime originalSlime; + private List childSlimes; + + /** + * Constructs a new SlimeSplitHook + * + * @param originalSlime + * the original {@link Slime} that died + * @param childSlimes + * the {@link Slime}s that should spawn + */ + public SlimeSplitHook(Slime originalSlime, List childSlimes) { + this.originalSlime = originalSlime; + this.childSlimes = childSlimes; + } + + /** + * Get the original {@link Slime} that died + * + * @return the {@link Slime} that died + */ + public Slime getOriginalSlime() { + return this.originalSlime; + } + + /** + * Get the {@link Slime}s that should be spawned + * + * @return a list of {@link Slime}s that will spawn + */ + public List getChildSlimes() { + return this.childSlimes; + } + + @Override + public String toString() { + return String.format("%s[Original Slime=%s, Child Slimes=%s", getHookName(), originalSlime, childSlimes); + } +} diff --git a/src/main/java/net/canarymod/hook/player/BedEnterHook.java b/src/main/java/net/canarymod/hook/player/BedEnterHook.java index 9044345f..388a9928 100644 --- a/src/main/java/net/canarymod/hook/player/BedEnterHook.java +++ b/src/main/java/net/canarymod/hook/player/BedEnterHook.java @@ -1,51 +1,51 @@ -package net.canarymod.hook.player; - -import net.canarymod.api.entity.living.humanoid.Player; -import net.canarymod.api.world.blocks.Block; -import net.canarymod.hook.CancelableHook; - -/** - * Bed enter hook, called when a player enters a bed - * - * @author Ehud (EhudB) - */ -public class BedEnterHook extends CancelableHook { - private Player player; - private Block bed; - - /** - * Create a new BedEnterHook - * - * @param player - * the player that entered the bed - * @param bed - * the bed that the player entered - */ - public BedEnterHook(Player player, Block bed) { - this.player = player; - this.bed = bed; - } - - /** - * Gets the {@link Player} entering the bed - * - * @return player - */ - public Player getPlayer() { - return player; - } - - /** - * Get the bed {@link Block} the {@link Player} is entering - * - * @return bed block player is entering - */ - public Block getBed() { - return bed; - } - - @Override - public String toString() { - return String.format("%s[Player=%s, Block=%s]", getHookName(), player, bed); - } -} +package net.canarymod.hook.player; + +import net.canarymod.api.entity.living.humanoid.Player; +import net.canarymod.api.world.blocks.Block; +import net.canarymod.hook.CancelableHook; + +/** + * Bed enter hook, called when a player enters a bed + * + * @author Ehud (EhudB) + */ +public class BedEnterHook extends CancelableHook { + private Player player; + private Block bed; + + /** + * Create a new BedEnterHook + * + * @param player + * the player that entered the bed + * @param bed + * the bed that the player entered + */ + public BedEnterHook(Player player, Block bed) { + this.player = player; + this.bed = bed; + } + + /** + * Gets the {@link Player} entering the bed + * + * @return player + */ + public Player getPlayer() { + return player; + } + + /** + * Get the bed {@link Block} the {@link Player} is entering + * + * @return bed block player is entering + */ + public Block getBed() { + return bed; + } + + @Override + public String toString() { + return String.format("%s[Player=%s, Block=%s]", getHookName(), player, bed); + } +} diff --git a/src/main/java/net/canarymod/hook/player/BedExitHook.java b/src/main/java/net/canarymod/hook/player/BedExitHook.java index 6f466c79..412f2caa 100644 --- a/src/main/java/net/canarymod/hook/player/BedExitHook.java +++ b/src/main/java/net/canarymod/hook/player/BedExitHook.java @@ -1,51 +1,51 @@ -package net.canarymod.hook.player; - -import net.canarymod.api.entity.living.humanoid.Player; -import net.canarymod.api.world.blocks.Block; -import net.canarymod.hook.Hook; - -/** - * Bed exit hook, called when a player leaves a bed - * - * @author Ehud (EhudB) - */ -public class BedExitHook extends Hook { - private Player player; - private Block bed; - - /** - * Create a new BedExitHook - * - * @param player - * the player that left the bed - * @param bed - * the bed the player left - */ - public BedExitHook(Player player, Block bed) { - this.player = player; - this.bed = bed; - } - - /** - * Gets the {@link Player} leaving the bed - * - * @return player - */ - public Player getPlayer() { - return player; - } - - /** - * Get the bed {@link Block} the {@link Player} is leaving - * - * @return bed block player is leaving - */ - public Block getBed() { - return bed; - } - - @Override - public String toString() { - return String.format("%s[Player=%s, Block=%s]", getHookName(), player, bed); - } -} +package net.canarymod.hook.player; + +import net.canarymod.api.entity.living.humanoid.Player; +import net.canarymod.api.world.blocks.Block; +import net.canarymod.hook.Hook; + +/** + * Bed exit hook, called when a player leaves a bed + * + * @author Ehud (EhudB) + */ +public class BedExitHook extends Hook { + private Player player; + private Block bed; + + /** + * Create a new BedExitHook + * + * @param player + * the player that left the bed + * @param bed + * the bed the player left + */ + public BedExitHook(Player player, Block bed) { + this.player = player; + this.bed = bed; + } + + /** + * Gets the {@link Player} leaving the bed + * + * @return player + */ + public Player getPlayer() { + return player; + } + + /** + * Get the bed {@link Block} the {@link Player} is leaving + * + * @return bed block player is leaving + */ + public Block getBed() { + return bed; + } + + @Override + public String toString() { + return String.format("%s[Player=%s, Block=%s]", getHookName(), player, bed); + } +}