Proper Reformating

This commit is contained in:
Kam committed 2025-03-13 17:14:45 -04:00
1 parent ce75880aba
commit 180d257024
1179 files changed
+59847 -61583

No files matched your search

@@ -11,9 +11,8 @@ import noppes.npcs.entity.EntityNPCInterface;
import java.util.Random;
public class EntityAIAmbushTarget extends EntityAIBase
{
private EntityNPCInterface theEntity;
public class EntityAIAmbushTarget extends EntityAIBase {
private EntityNPCInterface theEntity;
private EntityLivingBase targetEntity;
private double shelterX;
private double shelterY;
@@ -25,8 +24,7 @@ public class EntityAIAmbushTarget extends EntityAIBase
private int tick;
private boolean attackFromBehind;
public EntityAIAmbushTarget(EntityNPCInterface par1EntityCreature, double par2, double par3, boolean par4)
{
public EntityAIAmbushTarget(EntityNPCInterface par1EntityCreature, double par2, double par3, boolean par4) {
this.theEntity = par1EntityCreature;
this.movementSpeed = par2;
this.theWorld = par1EntityCreature.worldObj;
@@ -38,33 +36,22 @@ public class EntityAIAmbushTarget extends EntityAIBase
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
this.targetEntity = this.theEntity.getAttackTarget();
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) < this.distance || !this.theEntity.canSee(targetEntity))
{
return false;
}
else if (delay > 0)
{
delay--;
return false;
}
else
{
Vec3 vec3 = this.findHidingSpot();
} else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < this.distance || !this.theEntity.canSee(targetEntity)) {
return false;
} else if (delay > 0) {
delay--;
return false;
} else {
Vec3 vec3 = this.findHidingSpot();
if (vec3 == null)
{
if (vec3 == null) {
return false;
}
else
{
} else {
this.shelterX = vec3.xCoord;
this.shelterY = vec3.yCoord;
this.shelterZ = vec3.zCoord;
@@ -76,83 +63,68 @@ public class EntityAIAmbushTarget extends EntityAIBase
/**
* Returns whether an in-progress EntityAIBase should continue executing
*/
public boolean continueExecuting()
{
boolean shouldHide = this.targetEntity.getDistanceSqToEntity(this.theEntity) > this.distance;
boolean isSeen = this.theEntity.canSee(targetEntity);
return (!this.theEntity.getNavigator().noPath() && shouldHide) || (!isSeen && (shouldHide || this.theEntity.ais.directLOS));
public boolean continueExecuting() {
boolean shouldHide = this.targetEntity.getDistanceSqToEntity(this.theEntity) > this.distance;
boolean isSeen = this.theEntity.canSee(targetEntity);
return (!this.theEntity.getNavigator().noPath() && shouldHide) || (!isSeen && (shouldHide || this.theEntity.ais.directLOS));
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
public void startExecuting() {
this.theEntity.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, this.movementSpeed);
}
/**
* Resets the task
*/
public void resetTask()
{
public void resetTask() {
this.theEntity.getNavigator().clearPathEntity();
if (this.theEntity.getAttackTarget() == null && this.targetEntity != null)
{
this.theEntity.setAttackTarget(targetEntity);
if (this.theEntity.getAttackTarget() == null && this.targetEntity != null) {
this.theEntity.setAttackTarget(targetEntity);
}
if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < this.distance)
{
this.delay = 60;
if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < this.distance) {
this.delay = 60;
}
}
/**
* 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);
}
private Vec3 findHidingSpot()
{
Random random = this.theEntity.getRNG();
Vec3 idealPos = null;
private Vec3 findHidingSpot() {
Random random = this.theEntity.getRNG();
Vec3 idealPos = null;
for (int i = 1; i <= 8; i++)
{
for (int y = -2; y <= 2; y++)
{
for (int x = -i; x <= i; x++)
{
for (int z = -i; z <= i; z++)
{
double j = MathHelper.floor_double(this.theEntity.posX + x) + 0.5D;
double k = MathHelper.floor_double(this.theEntity.boundingBox.minY + y);
double l = MathHelper.floor_double(this.theEntity.posZ + z) + 0.5D;
for (int i = 1; i <= 8; i++) {
for (int y = -2; y <= 2; y++) {
for (int x = -i; x <= i; x++) {
for (int z = -i; z <= i; z++) {
double j = MathHelper.floor_double(this.theEntity.posX + x) + 0.5D;
double k = MathHelper.floor_double(this.theEntity.boundingBox.minY + y);
double l = MathHelper.floor_double(this.theEntity.posZ + z) + 0.5D;
if (this.theWorld.getBlock((int)j, (int)k, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 1, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 2, (int)l).isOpaqueCube())
{
Vec3 vec1 = Vec3.createVectorHelper(this.targetEntity.posX, this.targetEntity.posY + (double)this.targetEntity.getEyeHeight(), this.targetEntity.posZ);
Vec3 vec2 = Vec3.createVectorHelper(j, k + (double)this.theEntity.getEyeHeight(), l);
MovingObjectPosition movingobjectposition = this.theWorld.rayTraceBlocks(vec1, vec2);
if (movingobjectposition != null)
{
if (this.shelterX != j && this.shelterY != k && this.shelterZ != l)
{
idealPos = Vec3.createVectorHelper(j, k, l);
}
}
}
}
}
}
if (this.theWorld.getBlock((int) j, (int) k, (int) l).isOpaqueCube() && !this.theWorld.getBlock((int) j, (int) k + 1, (int) l).isOpaqueCube() && !this.theWorld.getBlock((int) j, (int) k + 2, (int) l).isOpaqueCube()) {
Vec3 vec1 = Vec3.createVectorHelper(this.targetEntity.posX, this.targetEntity.posY + (double) this.targetEntity.getEyeHeight(), this.targetEntity.posZ);
Vec3 vec2 = Vec3.createVectorHelper(j, k + (double) this.theEntity.getEyeHeight(), l);
MovingObjectPosition movingobjectposition = this.theWorld.rayTraceBlocks(vec1, vec2);
if (movingobjectposition != null) {
if (this.shelterX != j && this.shelterY != k && this.shelterZ != l) {
idealPos = Vec3.createVectorHelper(j, k, l);
}
}
}
}
}
}
if (idealPos != null)
{
return idealPos;
}
if (idealPos != null) {
return idealPos;
}
}
delay = 60;
return null;