Run formatter

This commit is contained in:
Nicholas Ignoffo 2017-08-15 21:30:48 -07:00
parent 61c44a831b
commit 08258fd6ef
606 changed files with 13464 additions and 22975 deletions

View file

@ -1,9 +1,8 @@
package WayofTime.bloodmagic.entity.ai;
import java.util.List;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.entity.mob.EntityDemonBase;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.RandomPositionGenerator;
@ -11,35 +10,36 @@ import net.minecraft.pathfinding.Path;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.math.Vec3d;
import WayofTime.bloodmagic.entity.mob.EntityDemonBase;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import java.util.List;
public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
{
public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase {
private final Predicate<Entity> canBeSeenSelector;
/** The entity we are attached to */
/**
* The entity we are attached to
*/
protected EntityDemonBase theEntity;
protected T closestLivingEntity;
private double farSpeed;
private double nearSpeed;
private double safeHealDistance = 3;
protected T closestLivingEntity;
private float avoidDistance;
/** The PathEntity of our entity */
/**
* The PathEntity of our entity
*/
private Path entityPathEntity;
/** The PathNavigate of our entity */
/**
* The PathNavigate of our entity
*/
private PathNavigate entityPathNavigate;
private Class<T> classToAvoid;
private Predicate<? super T> avoidTargetSelector;
public EntityAIRetreatToHeal(EntityDemonBase theEntityIn, Class<T> classToAvoidIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn)
{
public EntityAIRetreatToHeal(EntityDemonBase theEntityIn, Class<T> classToAvoidIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn) {
this(theEntityIn, classToAvoidIn, Predicates.<T>alwaysTrue(), avoidDistanceIn, farSpeedIn, nearSpeedIn);
}
public EntityAIRetreatToHeal(EntityDemonBase theEntityIn, Class<T> classToAvoidIn, Predicate<? super T> avoidTargetSelectorIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn)
{
public EntityAIRetreatToHeal(EntityDemonBase theEntityIn, Class<T> classToAvoidIn, Predicate<? super T> avoidTargetSelectorIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn) {
this.canBeSeenSelector = p_apply_1_ -> p_apply_1_.isEntityAlive() && EntityAIRetreatToHeal.this.theEntity.getEntitySenses().canSee(p_apply_1_);
this.theEntity = theEntityIn;
this.classToAvoid = classToAvoidIn;
@ -55,32 +55,25 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
* Returns whether the EntityAIBase should begin execution.
*/
@Override
public boolean shouldExecute()
{
if (!this.theEntity.shouldEmergencyHeal())
{
public boolean shouldExecute() {
if (!this.theEntity.shouldEmergencyHeal()) {
return false;
}
//This part almost doesn't matter
List<T> list = this.theEntity.getEntityWorld().getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector));
if (list.isEmpty())
{
if (list.isEmpty()) {
return true; //No entities nearby, so I can freely heal
} else
{
} else {
this.closestLivingEntity = list.get(0);
Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, new Vec3d(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ));
if (vec3d == null)
{
if (vec3d == null) {
return false; //Nowhere to run, gotta fight!
} else if (this.closestLivingEntity.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity))
{
} else if (this.closestLivingEntity.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) {
return false; //I'll be headed off if I choose this direction.
} else
{
} else {
this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3d.x, vec3d.y, vec3d.z);
return this.entityPathEntity != null;
}
@ -91,8 +84,7 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
* Returns whether an in-progress EntityAIBase should continue executing
*/
@Override
public boolean shouldContinueExecuting()
{
public boolean shouldContinueExecuting() {
return this.theEntity.shouldEmergencyHeal();//!this.entityPathNavigate.noPath();
}
@ -100,10 +92,8 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
* Execute a one shot task or start executing a continuous task
*/
@Override
public void startExecuting()
{
if (this.entityPathEntity != null)
{
public void startExecuting() {
if (this.entityPathEntity != null) {
this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed);
}
}
@ -112,8 +102,7 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
* Resets the task
*/
@Override
public void resetTask()
{
public void resetTask() {
this.closestLivingEntity = null;
}
@ -121,33 +110,26 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
* Updates the task
*/
@Override
public void updateTask()
{
if (this.closestLivingEntity != null)
{
if (this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) < 49.0D)
{
public void updateTask() {
if (this.closestLivingEntity != null) {
if (this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) < 49.0D) {
this.theEntity.getNavigator().setSpeed(this.nearSpeed);
} else
{
} else {
this.theEntity.getNavigator().setSpeed(this.farSpeed);
}
if (this.theEntity.ticksExisted % 20 == 0 && this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) >= safeHealDistance * safeHealDistance)
{
if (this.theEntity.ticksExisted % 20 == 0 && this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) >= safeHealDistance * safeHealDistance) {
healEntity();
return;
}
}
if (this.theEntity.ticksExisted % 20 == 0)
{
if (this.theEntity.ticksExisted % 20 == 0) {
healEntity();
}
}
public void healEntity()
{
public void healEntity() {
this.theEntity.performEmergencyHeal(2);
}
}