diff options
| author | Jason Mitchell <mitchej@gmail.com> | 2023-01-28 19:32:44 -0800 |
|---|---|---|
| committer | Jason Mitchell <mitchej@gmail.com> | 2023-01-28 19:32:44 -0800 |
| commit | 55f64675b42ac8d3c557cc850f78664bee006f6f (patch) | |
| tree | 2afd26dd3d5e6f763119bc192b57c66a1a075922 /src/main/java/gtPlusPlus/core/entity | |
| parent | 0f5dfd01b877b6a1019e0671b88d07974aae68c0 (diff) | |
| download | GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.tar.gz GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.tar.bz2 GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.zip | |
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gtPlusPlus/core/entity')
16 files changed, 374 insertions, 310 deletions
diff --git a/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java b/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java index 63d94fafee..ec189bf6ae 100644 --- a/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java +++ b/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java @@ -1,13 +1,15 @@ package gtPlusPlus.core.entity; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.world.explosions.ExplosionHandler; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.world.explosions.ExplosionHandler; + public class EntityPrimedMiningExplosive extends EntityTNTPrimed { + /** How long the fuse is */ private EntityLivingBase tntPlacedBy; @@ -19,8 +21,8 @@ public class EntityPrimedMiningExplosive extends EntityTNTPrimed { this.yOffset = this.height / 2.0F; } - public EntityPrimedMiningExplosive( - final World world, final double x, final double y, final double z, final EntityLivingBase placingEntity) { + public EntityPrimedMiningExplosive(final World world, final double x, final double y, final double z, + final EntityLivingBase placingEntity) { this(world); this.setPosition(x, y, z); final float f = (float) (Math.random() * Math.PI * 2.0D); @@ -364,11 +366,17 @@ public class EntityPrimedMiningExplosive extends EntityTNTPrimed { ExplosionHandler explode = new ExplosionHandler(); explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, false, true); - /*this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true);*/ + /* + * this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); + * this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, + * this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); + * this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, + * this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); + * this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, + * this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); + * this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, + * this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); + */ } /** diff --git a/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java b/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java index ca4229bec3..d010624b8c 100644 --- a/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java +++ b/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.entity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; @@ -10,7 +8,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class EntityTeleportFX extends Entity { + /** 'x' location the eye should float towards. */ private double targetX; /** 'y' location the eye should float towards. */ @@ -20,7 +22,6 @@ public class EntityTeleportFX extends Entity { private int despawnTimer; private boolean shatterOrDrop; - private static final String __OBFID = "CL_00001716"; public EntityTeleportFX(final World p_i1757_1_) { super(p_i1757_1_); @@ -42,8 +43,8 @@ public class EntityTeleportFX extends Entity { return p_70112_1_ < (d1 * d1); } - public EntityTeleportFX( - final World p_i1758_1_, final double p_i1758_2_, final double p_i1758_4_, final double p_i1758_6_) { + public EntityTeleportFX(final World p_i1758_1_, final double p_i1758_2_, final double p_i1758_4_, + final double p_i1758_6_) { super(p_i1758_1_); this.despawnTimer = 0; this.setSize(0.25F, 0.25F); @@ -106,9 +107,8 @@ public class EntityTeleportFX extends Entity { final float f = MathHelper.sqrt_double((this.motionX * this.motionX) + (this.motionZ * this.motionZ)); this.rotationYaw = (float) ((Math.atan2(this.motionX, this.motionZ) * 180.0D) / Math.PI); - for (this.rotationPitch = (float) ((Math.atan2(this.motionY, f) * 180.0D) / Math.PI); - (this.rotationPitch - this.prevRotationPitch) < -180.0F; - this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) ((Math.atan2(this.motionY, f) * 180.0D) / Math.PI); (this.rotationPitch + - this.prevRotationPitch) < -180.0F; this.prevRotationPitch -= 360.0F) { ; } @@ -181,8 +181,13 @@ public class EntityTeleportFX extends Entity { this.setDead(); if (this.shatterOrDrop) { - this.worldObj.spawnEntityInWorld(new EntityItem( - this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye))); + this.worldObj.spawnEntityInWorld( + new EntityItem( + this.worldObj, + this.posX, + this.posY, + this.posZ, + new ItemStack(Items.ender_eye))); } else { this.worldObj.playAuxSFX( 2003, diff --git a/src/main/java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java b/src/main/java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java index 7d471bff4a..15563ef508 100644 --- a/src/main/java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java +++ b/src/main/java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java @@ -1,12 +1,9 @@ package gtPlusPlus.core.entity; -import gtPlusPlus.api.damage.DamageTeslaTower; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.util.minecraft.EntityUtils; import java.util.List; import java.util.Random; import java.util.UUID; + import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.effect.EntityWeatherEffect; @@ -17,12 +14,20 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; +import gtPlusPlus.api.damage.DamageTeslaTower; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.util.minecraft.EntityUtils; + public class EntityTeslaTowerLightning extends EntityWeatherEffect { + /** Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. */ private int lightningState; /** A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt */ public long boltVertex; - /** Determines the time before the EntityLightningBolt is destroyed. It is a random integer decremented over time. */ + /** + * Determines the time before the EntityLightningBolt is destroyed. It is a random integer decremented over time. + */ private int boltLivingTime; private final UUID boltID; @@ -30,8 +35,8 @@ public class EntityTeslaTowerLightning extends EntityWeatherEffect { private final Entity boltValidDamageTarget; - public EntityTeslaTowerLightning( - World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_, Entity valid, UUID owner) { + public EntityTeslaTowerLightning(World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_, + Entity valid, UUID owner) { super(p_i1703_1_); Logger.INFO("Plasma Bolt - Created."); Random rand = new XSTR(p_i1703_1_.getSeed()); @@ -44,8 +49,7 @@ public class EntityTeslaTowerLightning extends EntityWeatherEffect { this.boltOwnerID = owner; // Puts fires out - if (!p_i1703_1_.isRemote - && p_i1703_1_.getGameRules().getGameRuleBooleanValue("doFireTick") + if (!p_i1703_1_.isRemote && p_i1703_1_.getGameRules().getGameRuleBooleanValue("doFireTick") && (p_i1703_1_.difficultySetting == EnumDifficulty.NORMAL || p_i1703_1_.difficultySetting == EnumDifficulty.HARD) && p_i1703_1_.doChunksNearChunkExist( @@ -139,8 +143,7 @@ public class EntityTeslaTowerLightning extends EntityWeatherEffect { this.lightningState = 1; this.boltVertex = rand.nextLong(); // Puts fires out. - if (!this.worldObj.isRemote - && this.worldObj.getGameRules().getGameRuleBooleanValue("doFireTick") + if (!this.worldObj.isRemote && this.worldObj.getGameRules().getGameRuleBooleanValue("doFireTick") && this.worldObj.doChunksNearChunkExist( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), diff --git a/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java index 39ee41f45a..e4f82ea80e 100644 --- a/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -25,7 +25,13 @@ public class InternalEntityRegistry { // EntityRegistry.registerGlobalEntityID(EntityPrimedMiningExplosive.class, "MiningCharge", // EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 0, 0), Utils.rgbtoHexValue(125, 125, 125)); EntityRegistry.registerModEntity( - EntityPrimedMiningExplosive.class, "MiningCharge", mEntityID++, GTplusplus.instance, 64, 20, true); + EntityPrimedMiningExplosive.class, + "MiningCharge", + mEntityID++, + GTplusplus.instance, + 64, + 20, + true); // EntityRegistry.registerGlobalEntityID(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", // EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(200, 0, 200), Utils.rgbtoHexValue(125, 125, @@ -53,44 +59,92 @@ public class InternalEntityRegistry { // EntityRegistry.registerGlobalEntityID(EntityToxinballSmall.class, "toxinBall", // EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 25, 0), Utils.rgbtoHexValue(0, 125, 0)); EntityRegistry.registerModEntity( - EntityToxinballSmall.class, "toxinBall", mEntityID++, GTplusplus.instance, 64, 20, true); + EntityToxinballSmall.class, + "toxinBall", + mEntityID++, + GTplusplus.instance, + 64, + 20, + true); // EntityRegistry.registerGlobalEntityID(EntityStaballoyConstruct.class, "constructStaballoy", // EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 75, 0), Utils.rgbtoHexValue(50, 220, 50)); EntityRegistry.registerModEntity( - EntityStaballoyConstruct.class, "constructStaballoy", mEntityID++, GTplusplus.instance, 64, 20, true); + EntityStaballoyConstruct.class, + "constructStaballoy", + mEntityID++, + GTplusplus.instance, + 64, + 20, + true); ItemCustomSpawnEgg.registerEntityForSpawnEgg( - 0, "constructStaballoy", Utils.rgbtoHexValue(20, 200, 20), Utils.rgbtoHexValue(20, 20, 20)); + 0, + "constructStaballoy", + Utils.rgbtoHexValue(20, 200, 20), + Utils.rgbtoHexValue(20, 20, 20)); // EntityRegistry.registerGlobalEntityID(EntitySickBlaze.class, "sickBlaze", // EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 75, 0), Utils.rgbtoHexValue(75, 175, 75)); - EntityRegistry.registerModEntity( - EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 20, true); + EntityRegistry + .registerModEntity(EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 20, true); ItemCustomSpawnEgg.registerEntityForSpawnEgg( - 1, "sickBlaze", Utils.rgbtoHexValue(40, 180, 40), Utils.rgbtoHexValue(75, 75, 75)); + 1, + "sickBlaze", + Utils.rgbtoHexValue(40, 180, 40), + Utils.rgbtoHexValue(75, 75, 75)); // EntityRegistry.registerGlobalEntityID(EntityTeslaTowerLightning.class, "plasmaBolt", // EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(125, 125, // 125)); EntityRegistry.registerModEntity( - EntityTeslaTowerLightning.class, "plasmaBolt", mEntityID++, GTplusplus.instance, 64, 5, true); + EntityTeslaTowerLightning.class, + "plasmaBolt", + mEntityID++, + GTplusplus.instance, + 64, + 5, + true); EntityRegistry.registerModEntity( - EntityThrowableBomb.class, "EntityThrowableBomb", mEntityID++, GTplusplus.instance, 64, 10, true); + EntityThrowableBomb.class, + "EntityThrowableBomb", + mEntityID++, + GTplusplus.instance, + 64, + 10, + true); EntityRegistry.registerModEntity( - EntityLightningAttack.class, "EntityLightningAttack", mEntityID++, GTplusplus.instance, 64, 20, true); + EntityLightningAttack.class, + "EntityLightningAttack", + mEntityID++, + GTplusplus.instance, + 64, + 20, + true); /** * Globals, which generate spawn eggs. (Currently required for Giant chicken spawning) */ EntityRegistry.registerModEntity( - EntityGiantChickenBase.class, "bigChickenFriendly", mEntityID++, GTplusplus.instance, 64, 20, true); + EntityGiantChickenBase.class, + "bigChickenFriendly", + mEntityID++, + GTplusplus.instance, + 64, + 20, + true); ItemCustomSpawnEgg.registerEntityForSpawnEgg( - 2, "bigChickenFriendly", Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); - EntityRegistry.registerModEntity( - EntityBatKing.class, "batKing", mEntityID++, GTplusplus.instance, 64, 20, true); + 2, + "bigChickenFriendly", + Utils.rgbtoHexValue(255, 0, 0), + Utils.rgbtoHexValue(175, 175, 175)); + EntityRegistry + .registerModEntity(EntityBatKing.class, "batKing", mEntityID++, GTplusplus.instance, 64, 20, true); ItemCustomSpawnEgg.registerEntityForSpawnEgg( - 3, "batKing", Utils.rgbtoHexValue(175, 175, 0), Utils.rgbtoHexValue(0, 175, 175)); + 3, + "batKing", + Utils.rgbtoHexValue(175, 175, 0), + Utils.rgbtoHexValue(0, 175, 175)); } } diff --git a/src/main/java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java b/src/main/java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java index 810c3eadff..1cfb2154b1 100644 --- a/src/main/java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java +++ b/src/main/java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.entity.ai.batking; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.entity.monster.EntityBatKing; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.ai.EntityAIBase; @@ -11,31 +7,30 @@ import net.minecraft.pathfinding.PathEntity; import net.minecraft.pathfinding.PathPoint; import net.minecraft.util.MathHelper; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.entity.monster.EntityBatKing; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; + public class EntityAIBatKingAttack extends EntityAIBase { private final Ranged mRangedAI; private final Melee mMeleeAI; private boolean mIsMelee = false; - /** The Bat King in control of this AI. */ + /** The Bat King in control of this AI. */ private final EntityBatKing mAttackingEntity; /** The PathEntity of our entity. */ private PathEntity mEntityPathEntity; - /** The current target of Bat King in control of this AI. */ + /** The current target of Bat King in control of this AI. */ private EntityLivingBase mEntityTarget; private final Class mClassTarget; - public EntityAIBatKingAttack( - EntityBatKing aAttacker, - Class aClassTarget, - double aMovementSpeed, - int someInt, - int aMaxRangedAttackTime, - float someFloat, - boolean aLongMemory) { + public EntityAIBatKingAttack(EntityBatKing aAttacker, Class aClassTarget, double aMovementSpeed, int someInt, + int aMaxRangedAttackTime, float someFloat, boolean aLongMemory) { mRangedAI = new Ranged(this, aMovementSpeed, someInt, 5, someFloat); mMeleeAI = new Melee(this, aClassTarget, aMovementSpeed, aLongMemory); mAttackingEntity = aAttacker; @@ -138,8 +133,10 @@ public class EntityAIBatKingAttack extends EntityAIBase { this.mIsMelee = false; } if (aisMeleeNow != this.mIsMelee) { - Logger.INFO("Bat King changed combat style from " + (aisMeleeNow ? "Melee" : "Ranged") + " to " - + (this.mIsMelee ? "Melee" : "Ranged")); + Logger.INFO( + "Bat King changed combat style from " + (aisMeleeNow ? "Melee" : "Ranged") + + " to " + + (this.mIsMelee ? "Melee" : "Ranged")); } } @@ -148,8 +145,8 @@ public class EntityAIBatKingAttack extends EntityAIBase { private final EntityAIBatKingAttack parentAI; /** - * A decrementing tick that spawns a ranged attack once this value reaches 0. It - * is then set back to the maxRangedAttackTime. + * A decrementing tick that spawns a ranged attack once this value reaches 0. It is then set back to the + * maxRangedAttackTime. */ private int rangedAttackTime; @@ -164,11 +161,7 @@ public class EntityAIBatKingAttack extends EntityAIBase { private float field_96562_i; private float field_82642_h; // Max range - public Ranged( - EntityAIBatKingAttack aParent, - double aMovementSpeed, - int someInt, - int aMaxRangedAttackTime, + public Ranged(EntityAIBatKingAttack aParent, double aMovementSpeed, int someInt, int aMaxRangedAttackTime, float someFloat) { this.rangedAttackTime = -1; this.parentAI = aParent; @@ -191,8 +184,7 @@ public class EntityAIBatKingAttack extends EntityAIBase { * Returns whether an in-progress EntityAIBase should continue executing */ public boolean continueExecuting() { - return parentAI.shouldExecute() - || !parentAI.getBatKing().getNavigator().noPath(); + return parentAI.shouldExecute() || !parentAI.getBatKing().getNavigator().noPath(); } /** @@ -213,11 +205,10 @@ public class EntityAIBatKingAttack extends EntityAIBase { maxRangedAttackTime = MathUtils.balance(maxRangedAttackTime, 20, 40); } - double d0 = parentAI.getBatKing() - .getDistanceSq( - parentAI.mEntityTarget.posX, - parentAI.mEntityTarget.boundingBox.minY, - parentAI.mEntityTarget.posZ); + double d0 = parentAI.getBatKing().getDistanceSq( + parentAI.mEntityTarget.posX, + parentAI.mEntityTarget.boundingBox.minY, + parentAI.mEntityTarget.posZ); boolean flag = parentAI.getBatKing().getEntitySenses().canSee(parentAI.mEntityTarget); if (flag) { @@ -229,8 +220,7 @@ public class EntityAIBatKingAttack extends EntityAIBase { if (d0 <= (double) this.field_82642_h && this.mCooldownTime >= 20) { parentAI.getBatKing().getNavigator().clearPathEntity(); } else { - if (parentAI.getBatKing() - .getNavigator() + if (parentAI.getBatKing().getNavigator() .tryMoveToEntityLiving(parentAI.mEntityTarget, this.entityMoveSpeed)) { Logger.INFO("Doing Ranged Ai Task."); } else { @@ -244,8 +234,14 @@ public class EntityAIBatKingAttack extends EntityAIBase { if (--this.rangedAttackTime == 0) { if (d0 > (double) this.field_82642_h || !flag) { - Logger.INFO("Stopping ranged attack. " + flag + "|" + (d0 > (double) this.field_82642_h) + "|" + d0 - + "|" + (double) this.field_82642_h); + Logger.INFO( + "Stopping ranged attack. " + flag + + "|" + + (d0 > (double) this.field_82642_h) + + "|" + + d0 + + "|" + + (double) this.field_82642_h); return; } @@ -276,15 +272,13 @@ public class EntityAIBatKingAttack extends EntityAIBase { private final EntityAIBatKingAttack parentAI; /** - * An amount of decrementing ticks that allows the entity to attack once the - * tick reaches 0. + * An amount of decrementing ticks that allows the entity to attack once the tick reaches 0. */ int attackTick; /** The speed with which the mob will approach the target */ double speedTowardsTarget; /** - * When true, the mob will continue chasing its target, even if it can't find a - * path to them right now. + * When true, the mob will continue chasing its target, even if it can't find a path to them right now. */ boolean longMemory; @@ -296,8 +290,8 @@ public class EntityAIBatKingAttack extends EntityAIBase { private int failedPathFindingPenalty; - public Melee( - EntityAIBatKingAttack aParent, Class aClassTarget, double aMoveToTargetSpeed, boolean aLongMemory) { + public Melee(EntityAIBatKingAttack aParent, Class aClassTarget, double aMoveToTargetSpeed, + boolean aLongMemory) { this.parentAI = aParent; this.classTarget = aClassTarget; this.speedTowardsTarget = aMoveToTargetSpeed; @@ -322,8 +316,8 @@ public class EntityAIBatKingAttack extends EntityAIBase { return false; } else { if (--this.field_75445_i <= 0) { - parentAI.mEntityPathEntity = - parentAI.mAttackingEntity.getNavigator().getPathToEntityLiving(entitylivingbase); + parentAI.mEntityPathEntity = parentAI.mAttackingEntity.getNavigator() + .getPathToEntityLiving(entitylivingbase); this.field_75445_i = 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); return parentAI.mEntityPathEntity != null; } else { @@ -337,12 +331,9 @@ public class EntityAIBatKingAttack extends EntityAIBase { */ public boolean continueExecuting() { EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); - return entitylivingbase == null - ? false - : (!entitylivingbase.isEntityAlive() - ? false - : (!this.longMemory - ? !parentAI.mAttackingEntity.getNavigator().noPath() + return entitylivingbase == null ? false + : (!entitylivingbase.isEntityAlive() ? false + : (!this.longMemory ? !parentAI.mAttackingEntity.getNavigator().noPath() : parentAI.mAttackingEntity.isWithinHomeDistance( MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), @@ -370,8 +361,8 @@ public class EntityAIBatKingAttack extends EntityAIBase { public void updateTask() { EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); parentAI.mAttackingEntity.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); - double d0 = parentAI.mAttackingEntity.getDistanceSq( - entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); + double d0 = parentAI.mAttackingEntity + .getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); double d1 = (double) (parentAI.mAttackingEntity.width * 2.0F * parentAI.mAttackingEntity.width * 2.0F + entitylivingbase.width); --this.field_75445_i; @@ -379,24 +370,19 @@ public class EntityAIBatKingAttack extends EntityAIBase { if ((this.longMemory || parentAI.mAttackingEntity.getEntitySenses().canSee(entitylivingbase)) && this.field_75445_i <= 0 && (this.field_151497_i == 0.0D && this.field_151495_j == 0.0D && this.field_151496_k == 0.0D - || entitylivingbase.getDistanceSq( - this.field_151497_i, this.field_151495_j, this.field_151496_k) + || entitylivingbase + .getDistanceSq(this.field_151497_i, this.field_151495_j, this.field_151496_k) >= 1.0D || parentAI.mAttackingEntity.getRNG().nextFloat() < 0.05F)) { this.field_151497_i = entitylivingbase.posX; this.field_151495_j = entitylivingbase.boundingBox.minY; this.field_151496_k = entitylivingbase.posZ; - this.field_75445_i = failedPathFindingPenalty - + 4 - + parentAI.mAttackingEntity.getRNG().nextInt(7); + this.field_75445_i = failedPathFindingPenalty + 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); if (parentAI.mAttackingEntity.getNavigator().getPath() != null) { - PathPoint finalPathPoint = - parentAI.mAttackingEntity.getNavigator().getPath().getFinalPathPoint(); - if (finalPathPoint != null - && entitylivingbase.getDistanceSq( - finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) - < 1) { + PathPoint finalPathPoint = parentAI.mAttackingEntity.getNavigator().getPath().getFinalPathPoint(); + if (finalPathPoint != null && entitylivingbase + .getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) { failedPathFindingPenalty = 0; } else { failedPathFindingPenalty += 10; @@ -411,8 +397,7 @@ public class EntityAIBatKingAttack extends EntityAIBase { this.field_75445_i += 5; } - if (!parentAI.mAttackingEntity - .getNavigator() + if (!parentAI.mAttackingEntity.getNavigator() .tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) { this.field_75445_i += 15; } diff --git a/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java b/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java index 95693d24c9..d100d3571b 100644 --- a/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java +++ b/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java @@ -1,20 +1,21 @@ package gtPlusPlus.core.entity.item; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.NBTUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; public class ItemEntityGiantEgg extends EntityItem { /** - * The maximum age of this Chicken Egg. The item will try hatch once this is reached. + * The maximum age of this Chicken Egg. The item will try hatch once this is reached. */ public int mEggAge = 10000; @@ -98,14 +99,13 @@ public class ItemEntityGiantEgg extends EntityItem { if (this.age >= 1000) { // Cache the value for efficiency - if (mEggSize == -1) - mEggSize = (this.getEntityItem() != null - ? (this.getEntityItem().hasTagCompound() - ? (this.getEntityItem().getTagCompound().hasKey("size") - ? this.getEntityItem().getTagCompound().getInteger("size") - : 1) - : 1) - : 1); + if (mEggSize == -1) mEggSize = (this.getEntityItem() != null + ? (this.getEntityItem().hasTagCompound() + ? (this.getEntityItem().getTagCompound().hasKey("size") + ? this.getEntityItem().getTagCompound().getInteger("size") + : 1) + : 1) + : 1); if (MathUtils.randInt(100 * mEggSize, 1000) >= MathUtils.randInt(950, 1000)) { // Spawn Chicken if (spawnGiantChicken()) { diff --git a/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java index 0a35d550a4..049d47cc21 100644 --- a/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java +++ b/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java @@ -1,13 +1,7 @@ package gtPlusPlus.core.entity.monster; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.entity.ai.batking.EntityAIBatKingAttack; -import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import java.lang.reflect.Field; + import net.minecraft.entity.Entity; import net.minecraft.e |
