Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -1,32 +1,35 @@
|
|||
package WayofTime.bloodmagic.entity.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.entity.mob.EntityAspectedDemonBase;
|
||||
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.entity.mob.EntityAspectedDemonBase;
|
||||
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
|
||||
|
||||
public class EntityAIProtectAlly extends EntityAIBase
|
||||
{
|
||||
/** The entity owner of this AITask */
|
||||
import java.util.List;
|
||||
|
||||
public class EntityAIProtectAlly extends EntityAIBase {
|
||||
/**
|
||||
* The entity owner of this AITask
|
||||
*/
|
||||
private final EntityCorruptedSheep entity;
|
||||
/** The world the grass eater entity is eating from */
|
||||
/**
|
||||
* The world the grass eater entity is eating from
|
||||
*/
|
||||
private final World world;
|
||||
/** Number of ticks since the entity started to eat grass */
|
||||
/**
|
||||
* Number of ticks since the entity started to eat grass
|
||||
*/
|
||||
int castTimer;
|
||||
|
||||
public EntityAIProtectAlly(EntityCorruptedSheep entity)
|
||||
{
|
||||
public EntityAIProtectAlly(EntityCorruptedSheep entity) {
|
||||
this.entity = entity;
|
||||
this.world = entity.getEntityWorld();
|
||||
this.setMutexBits(7);
|
||||
}
|
||||
|
||||
public int getCastTimer()
|
||||
{
|
||||
public int getCastTimer() {
|
||||
return this.castTimer;
|
||||
}
|
||||
|
||||
|
@ -34,16 +37,12 @@ public class EntityAIProtectAlly extends EntityAIBase
|
|||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
public boolean shouldExecute() {
|
||||
AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).grow(5);
|
||||
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType()));
|
||||
for (EntityLivingBase testEntity : list)
|
||||
{
|
||||
if (testEntity != this.entity)
|
||||
{
|
||||
if (this.entity.canProtectAlly(testEntity))
|
||||
{
|
||||
for (EntityLivingBase testEntity : list) {
|
||||
if (testEntity != this.entity) {
|
||||
if (this.entity.canProtectAlly(testEntity)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +55,7 @@ public class EntityAIProtectAlly extends EntityAIBase
|
|||
* Execute a one shot task or start executing a continuous task
|
||||
*/
|
||||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
public void startExecuting() {
|
||||
this.castTimer = 100;
|
||||
this.world.setEntityState(this.entity, (byte) 53);
|
||||
this.entity.getNavigator().clearPathEntity();
|
||||
|
@ -67,8 +65,7 @@ public class EntityAIProtectAlly extends EntityAIBase
|
|||
* Resets the task
|
||||
*/
|
||||
@Override
|
||||
public void resetTask()
|
||||
{
|
||||
public void resetTask() {
|
||||
this.castTimer = 0;
|
||||
}
|
||||
|
||||
|
@ -76,8 +73,7 @@ public class EntityAIProtectAlly extends EntityAIBase
|
|||
* Returns whether an in-progress EntityAIBase should continue executing
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldContinueExecuting()
|
||||
{
|
||||
public boolean shouldContinueExecuting() {
|
||||
return castTimer > 0;
|
||||
}
|
||||
|
||||
|
@ -85,19 +81,14 @@ public class EntityAIProtectAlly extends EntityAIBase
|
|||
* Updates the task
|
||||
*/
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
public void updateTask() {
|
||||
this.castTimer = Math.max(0, this.castTimer - 1);
|
||||
if (castTimer == 0)
|
||||
{
|
||||
if (castTimer == 0) {
|
||||
AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).grow(5);
|
||||
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType()));
|
||||
for (EntityLivingBase testEntity : list)
|
||||
{
|
||||
if (testEntity != this.entity)
|
||||
{
|
||||
if (this.entity.applyProtectionToAlly(testEntity))
|
||||
{
|
||||
for (EntityLivingBase testEntity : list) {
|
||||
if (testEntity != this.entity) {
|
||||
if (this.entity.applyProtectionToAlly(testEntity)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue