mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 19:43:07 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -9,8 +9,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
|
||||
public class EntityAIZigZagTarget extends EntityAIBase
|
||||
{
|
||||
public class EntityAIZigZagTarget extends EntityAIBase {
|
||||
private EntityCreature theEntity;
|
||||
private EntityLivingBase targetEntity;
|
||||
private double movePosX;
|
||||
@@ -22,8 +21,7 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
private double speed;
|
||||
private float tacticalRange;
|
||||
|
||||
public EntityAIZigZagTarget(EntityCreature par1EntityCreature, double par2, float par4)
|
||||
{
|
||||
public EntityAIZigZagTarget(EntityCreature par1EntityCreature, double par2, float par4) {
|
||||
this.theEntity = par1EntityCreature;
|
||||
this.speed = par2;
|
||||
this.tacticalRange = par4;
|
||||
@@ -33,44 +31,34 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
/**
|
||||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
public boolean shouldExecute() {
|
||||
this.targetEntity = this.theEntity.getAttackTarget();
|
||||
|
||||
if (this.targetEntity == null)
|
||||
{
|
||||
if (this.targetEntity == null) {
|
||||
return false;
|
||||
}
|
||||
else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double)(this.tacticalRange * this.tacticalRange))
|
||||
{
|
||||
} else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double) (this.tacticalRange * this.tacticalRange)) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
PathEntity pathentity = this.theEntity.getNavigator().getPathToEntityLiving(targetEntity);
|
||||
} else {
|
||||
PathEntity pathentity = this.theEntity.getNavigator().getPathToEntityLiving(targetEntity);
|
||||
|
||||
if (pathentity != null)
|
||||
{
|
||||
if (pathentity.getCurrentPathLength() >= this.tacticalRange)
|
||||
{
|
||||
PathPoint pathpoint = pathentity.getPathPointFromIndex(MathHelper.floor_double(this.tacticalRange / 2.0D));
|
||||
this.entityPosX = pathpoint.xCoord;
|
||||
this.entityPosY = pathpoint.yCoord;
|
||||
this.entityPosZ = pathpoint.zCoord;
|
||||
|
||||
Vec3 vec3 = RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.theEntity, (int) tacticalRange, 3, Vec3.createVectorHelper(this.entityPosX, this.entityPosY, this.entityPosZ));
|
||||
|
||||
if (vec3 != null)
|
||||
{
|
||||
if (this.targetEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.targetEntity.getDistanceSq(entityPosX, entityPosY, entityPosZ))
|
||||
{
|
||||
this.movePosX = vec3.xCoord;
|
||||
this.movePosY = vec3.yCoord;
|
||||
this.movePosZ = vec3.zCoord;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pathentity != null) {
|
||||
if (pathentity.getCurrentPathLength() >= this.tacticalRange) {
|
||||
PathPoint pathpoint = pathentity.getPathPointFromIndex(MathHelper.floor_double(this.tacticalRange / 2.0D));
|
||||
this.entityPosX = pathpoint.xCoord;
|
||||
this.entityPosY = pathpoint.yCoord;
|
||||
this.entityPosZ = pathpoint.zCoord;
|
||||
|
||||
Vec3 vec3 = RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.theEntity, (int) tacticalRange, 3, Vec3.createVectorHelper(this.entityPosX, this.entityPosY, this.entityPosZ));
|
||||
|
||||
if (vec3 != null) {
|
||||
if (this.targetEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.targetEntity.getDistanceSq(entityPosX, entityPosY, entityPosZ)) {
|
||||
this.movePosX = vec3.xCoord;
|
||||
this.movePosY = vec3.yCoord;
|
||||
this.movePosZ = vec3.zCoord;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -79,24 +67,21 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
/**
|
||||
* Returns whether an in-progress EntityAIBase should continue executing
|
||||
*/
|
||||
public boolean continueExecuting()
|
||||
{
|
||||
return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double)(this.tacticalRange * this.tacticalRange);
|
||||
public boolean continueExecuting() {
|
||||
return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double) (this.tacticalRange * this.tacticalRange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a one shot task or start executing a continuous task
|
||||
*/
|
||||
public void startExecuting()
|
||||
{
|
||||
public void startExecuting() {
|
||||
this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.speed);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the task
|
||||
*/
|
||||
public void updateTask()
|
||||
{
|
||||
this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F);
|
||||
public void updateTask() {
|
||||
this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user