diff options
author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-09-04 03:05:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-04 03:05:22 +0100 |
commit | 76719d65a90d98e228a914774d3b11ed9f01ac8e (patch) | |
tree | ce0d35f954e441e9cc4aa95aa347073728e6f4ee /src/main/java/gtPlusPlus/core/entity | |
parent | 0393b582eb3edcb5c575330804b6747577a55e27 (diff) | |
download | GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.gz GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.bz2 GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.zip |
Clean-up v2 (#729)
* Remove test items from NEI with no texture
* Add number formatting to hand pumps
* Remove heavy plates (no recipes & completely unused).
* Remove helium generator (no texture, no recipe)
* Remove fire pit and fire starter (no use, no recipe, no textures)
* Remove giant chicken and associated unused stuff, has no texture and is unobtainable. Used to be relevant but isn't anymore.
* Remove villagers with silly trades like 1 motor + 1 hull = 1 hull. Why?
* Remove trade bench, no recipe, missing textures. Unused.
* Remove farm processors, no texture, no recipe. Unused.
* Remove MAX tier components, these exist in GT now, have no recipe here and are unused.
* Hide untextured light block from NEI
* Update buildscript
* Remove unused backpacks, no recipe and contains dupe bugs. Bad.
* Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable.
* Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. part 2
* Remove dragon catcher (what?), no texture, no recipe, unused.
* Remove empty item, does nothing, has no recipe, no idea why it is here.
* Empty item v2 removal
* Revert "Empty item v2 removal"
This reverts commit 75bcd3ccfaf55bbfe2c12b2e4167d5c37636030d.
* Revert "Remove empty item, does nothing, has no recipe, no idea why it is here."
This reverts commit e41a9f484392776331c58530ab1faa5ef978ef36.
* Remove debug square. No recipe, unused.
* Number formatting overflow covers
* Remove JVM garbage collection block. Unused, no recipe.
* Remove nanotubes, no recipe for them. Unused.
* Remove "git" item, doesn't seem to work. Has no recipe.
* Remove uncraftable food with awful textures.
* Remove "bat king" mob, unused content. Does not spawn.
* Remove uncraftable doors with bad textures. Unused content.
* Remove uncraftable, unlocalised redstone stuff that crashes game when placed.
* Remove weird spawner item. No recipe, does not exist in world.
* Remove sunnarium bit, no recipe, no usage.
* Remove unused modularity table and some misc uncraftable, unused items.
* Remove Interconnecting Storage Crate, no recipe, unused.
* Delete worse debug power gen, this already exists as part of GT. Unneeded duplication.
* Delete unused placeholder circuit
* Delete uncraftable generator hatches.
* Spotless
* Remove XP tank thing, unused and uncraftable.
* Remove null item, this fluid registry only seemed to register one null fluid. All others exist?
* Remove EU -> RF battery. Unused in GTNH.
* Remove some shelf nonsense, why is this in this mod?
* Remove some weird random tools. These have no realistic usage in GTNH.
* Remove firemaker. Useless in GTNH.
* Removed helium blob. Deprecated item, not used anymore, uncraftable.
* spotlessApply (#730)
Co-authored-by: GitHub GTNH Actions <>
* Stop modulators generating unused blocks with no textures
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove some weird methods and uncraftable mining parts, probably part of deprecated multiblock.
* spotlessApply (#732)
Co-authored-by: GitHub GTNH Actions <>
* Remove gem shards, unused.
* Remove unused atoms
* Remove unused gum
* Remove unused elements/materials
* Bye bye
* Remove some unused reflection stuff
* Remove control cores, obsolete now.
* Remove mob killing thing with no texture and no recipe.
* Remove uncraftable covers
* Remove pizza gloves
* Net and rope removal, unused
* Remove force crop
* Removal of some old event stuff
* Remove unused nuclear chem items
* Remove player safe, mostly because of the horrible event code that was intercepting every block break. I can't see any real usage of this via discord.
* Remove Force material and associated other nonsense. Also remove some nuclear chem stuff.
* Remove force for realsies
* Skookum Chooker purge.
* Remove some enderio compat, these plates/dusts are added via GT5 anyway now. This is obsolete.
* spotlessApply (#733)
Co-authored-by: GitHub GTNH Actions <>
* Unused textures
* Bump dep
* Revert "Remove force for realsies"
This reverts commit 0d288912a99f9dabce56d2a2623d4d3510f4804e.
* Revert "Remove Force material and associated other nonsense. Also remove some nuclear chem stuff."
This reverts commit 3455e6e916defe1f2aef923be6f9696a6cf3095b.
* Remove nuclear items that are unused
* spotlessApply (#734)
Co-authored-by: GitHub GTNH Actions <>
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/core/entity')
6 files changed, 0 insertions, 1640 deletions
diff --git a/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java index 1254d9bdff..4be3605ff1 100644 --- a/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -3,8 +3,6 @@ package gtPlusPlus.core.entity; import cpw.mods.fml.common.registry.EntityRegistry; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.entity.monster.EntityBatKing; -import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; @@ -109,28 +107,5 @@ public class InternalEntityRegistry { 20, true); - /** - * Globals, which generate spawn eggs. (Currently required for Giant chicken spawning) - */ - EntityRegistry.registerModEntity( - 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); - ItemCustomSpawnEgg.registerEntityForSpawnEgg( - 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 deleted file mode 100644 index 1cfb2154b1..0000000000 --- a/src/main/java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java +++ /dev/null @@ -1,419 +0,0 @@ -package gtPlusPlus.core.entity.ai.batking; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IRangedAttackMob; -import net.minecraft.entity.ai.EntityAIBase; -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. */ - private final EntityBatKing mAttackingEntity; - - /** The PathEntity of our entity. */ - private PathEntity mEntityPathEntity; - - /** 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) { - mRangedAI = new Ranged(this, aMovementSpeed, someInt, 5, someFloat); - mMeleeAI = new Melee(this, aClassTarget, aMovementSpeed, aLongMemory); - mAttackingEntity = aAttacker; - mClassTarget = aClassTarget; - } - - @Override - public boolean shouldExecute() { - determineCombatStyle(); - EntityLivingBase entitylivingbase = this.mAttackingEntity.getAttackTarget(); - if (entitylivingbase == null) { - this.mEntityTarget = null; - return false; - } else if (!entitylivingbase.isEntityAlive()) { - return false; - } else if (this.mClassTarget != null && !this.mClassTarget.isAssignableFrom(entitylivingbase.getClass())) { - return false; - } else { - if (this.mIsMelee) { - return this.mMeleeAI.shouldExecute(); - } else { - this.mEntityTarget = entitylivingbase; - this.mEntityPathEntity = this.mAttackingEntity.getNavigator().getPathToEntityLiving(entitylivingbase); - return mRangedAI != null && mMeleeAI != null && hasValidTarget(); - } - } - } - - public EntityBatKing getBatKing() { - return this.mAttackingEntity; - } - - public IRangedAttackMob getBatKingAsIRangedAttackMob() { - return this.mAttackingEntity; - } - - public boolean hasValidTarget() { - return this.mEntityTarget != null; - } - - public EntityLivingBase getTarget() { - return mEntityTarget; - } - - @Override - public boolean continueExecuting() { - determineCombatStyle(); - if (mIsMelee) { - return mMeleeAI.continueExecuting(); - } else { - return mRangedAI.continueExecuting(); - } - } - - @Override - public boolean isInterruptible() { - if (mIsMelee) { - - } else { - - } - return super.isInterruptible(); - } - - @Override - public void startExecuting() { - determineCombatStyle(); - if (mIsMelee) { - mMeleeAI.startExecuting(); - } else { - mRangedAI.startExecuting(); - } - } - - @Override - public void resetTask() { - determineCombatStyle(); - if (mIsMelee) { - mMeleeAI.resetTask(); - } else { - mRangedAI.resetTask(); - } - } - - @Override - public void updateTask() { - determineCombatStyle(); - if (mIsMelee) { - mMeleeAI.updateTask(); - } else { - mRangedAI.updateTask(); - } - } - - private final void determineCombatStyle() { - boolean aisMeleeNow = this.mIsMelee; - if (this.mEntityTarget != null && EntityUtils.getDistance(getBatKing(), mEntityTarget) < 4) { - this.mIsMelee = true; - } else { - this.mIsMelee = false; - } - if (aisMeleeNow != this.mIsMelee) { - Logger.INFO( - "Bat King changed combat style from " + (aisMeleeNow ? "Melee" : "Ranged") - + " to " - + (this.mIsMelee ? "Melee" : "Ranged")); - } - } - - private class Ranged { - - 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. - */ - private int rangedAttackTime; - - private double entityMoveSpeed; - private int mCooldownTime; - private int field_96561_g; - /** - * The maximum time the AI has to wait before performing another ranged attack. - */ - private int maxRangedAttackTime; - - private float field_96562_i; - private float field_82642_h; // Max range - - public Ranged(EntityAIBatKingAttack aParent, double aMovementSpeed, int someInt, int aMaxRangedAttackTime, - float someFloat) { - this.rangedAttackTime = -1; - this.parentAI = aParent; - this.entityMoveSpeed = aMovementSpeed; - this.field_96561_g = someInt; - this.maxRangedAttackTime = aMaxRangedAttackTime; - this.field_96562_i = someFloat; - this.field_82642_h = someFloat * someFloat * 8; - parentAI.setMutexBits(3); - } - - /** - * Execute a one shot task or start executing a continuous task - */ - public void startExecuting() { - parentAI.getBatKing().getNavigator().setPath(parentAI.mEntityPathEntity, this.entityMoveSpeed); - } - - /** - * Returns whether an in-progress EntityAIBase should continue executing - */ - public boolean continueExecuting() { - return parentAI.shouldExecute() || !parentAI.getBatKing().getNavigator().noPath(); - } - - /** - * Resets the task - */ - public void resetTask() { - parentAI.mEntityTarget = null; - this.mCooldownTime = 0; - this.rangedAttackTime = -1; - } - - /** - * Updates the task - */ - public void updateTask() { - - if (MathUtils.randInt(0, 100) == 0) { - maxRangedAttackTime = MathUtils.balance(maxRangedAttackTime, 20, 40); - } - - 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) { - ++this.mCooldownTime; - } else { - this.mCooldownTime = 0; - } - - if (d0 <= (double) this.field_82642_h && this.mCooldownTime >= 20) { - parentAI.getBatKing().getNavigator().clearPathEntity(); - } else { - if (parentAI.getBatKing().getNavigator() - .tryMoveToEntityLiving(parentAI.mEntityTarget, this.entityMoveSpeed)) { - Logger.INFO("Doing Ranged Ai Task."); - } else { - Logger.INFO("Not Doing Ranged Ai Task."); - } - } - - parentAI.getBatKing().getLookHelper().setLookPositionWithEntity(parentAI.mEntityTarget, 30.0F, 30.0F); - float f; - Logger.INFO("Ranged AI - " + rangedAttackTime); - - 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); - return; - } - - f = MathHelper.sqrt_double(d0) / this.field_96562_i; - float f1 = f; - - if (f < 0.1F) { - f1 = 0.1F; - } - - if (f1 > 1.0F) { - f1 = 1.0F; - } - Logger.INFO("Trying to do a ranged attack."); - parentAI.getBatKingAsIRangedAttackMob().attackEntityWithRangedAttack(parentAI.mEntityTarget, f1); - this.rangedAttackTime = MathHelper.floor_float( - f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); - } else if (this.rangedAttackTime < 0) { - f = MathHelper.sqrt_double(d0) / this.field_96562_i; - this.rangedAttackTime = MathHelper.floor_float( - f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); - } - } - } - - private class Melee { - - private final EntityAIBatKingAttack parentAI; - - /** - * 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. - */ - boolean longMemory; - - Class classTarget; - private int field_75445_i; - private double field_151497_i; - private double field_151495_j; - private double field_151496_k; - - private int failedPathFindingPenalty; - - public Melee(EntityAIBatKingAttack aParent, Class aClassTarget, double aMoveToTargetSpeed, - boolean aLongMemory) { - this.parentAI = aParent; - this.classTarget = aClassTarget; - this.speedTowardsTarget = aMoveToTargetSpeed; - this.longMemory = aLongMemory; - parentAI.setMutexBits(3); - } - - /** - * Returns whether the EntityAIBase should begin execution. - */ - public boolean shouldExecute() { - if (!parentAI.hasValidTarget()) { - return false; - } - EntityLivingBase entitylivingbase = parentAI.getTarget(); - - if (entitylivingbase == null) { - return false; - } else if (!entitylivingbase.isEntityAlive()) { - return false; - } else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass())) { - return false; - } else { - if (--this.field_75445_i <= 0) { - parentAI.mEntityPathEntity = parentAI.mAttackingEntity.getNavigator() - .getPathToEntityLiving(entitylivingbase); - this.field_75445_i = 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); - return parentAI.mEntityPathEntity != null; - } else { - return true; - } - } - } - - /** - * Returns whether an in-progress EntityAIBase should continue executing - */ - public boolean continueExecuting() { - EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); - 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), - MathHelper.floor_double(entitylivingbase.posZ)))); - } - - /** - * Execute a one shot task or start executing a continuous task - */ - public void startExecuting() { - parentAI.mAttackingEntity.getNavigator().setPath(parentAI.mEntityPathEntity, this.speedTowardsTarget); - this.field_75445_i = 0; - } - - /** - * Resets the task - */ - public void resetTask() { - parentAI.mAttackingEntity.getNavigator().clearPathEntity(); - } - - /** - * Updates the task - */ - 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 d1 = (double) (parentAI.mAttackingEntity.width * 2.0F * parentAI.mAttackingEntity.width * 2.0F - + entitylivingbase.width); - --this.field_75445_i; - - 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) - >= 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); - - 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) { - failedPathFindingPenalty = 0; - } else { - failedPathFindingPenalty += 10; - } - } else { - failedPathFindingPenalty += 10; - } - - if (d0 > 1024.0D) { - this.field_75445_i += 10; - } else if (d0 > 256.0D) { - this.field_75445_i += 5; - } - - if (!parentAI.mAttackingEntity.getNavigator() - .tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) { - this.field_75445_i += 15; - } - } - - this.attackTick = Math.max(this.attackTick - 1, 0); - - if (d0 <= d1 && this.attackTick <= 20) { - this.attackTick = 20; - - if (parentAI.mAttackingEntity.getHeldItem() != null) { - parentAI.mAttackingEntity.swingItem(); - } - - parentAI.mAttackingEntity.attackEntityAsMob(entitylivingbase); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java b/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java deleted file mode 100644 index d100d3571b..0000000000 --- a/src/main/java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java +++ /dev/null @@ -1,117 +0,0 @@ -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; - -public class ItemEntityGiantEgg extends EntityItem { - - /** - * The maximum age of this Chicken Egg. The item will try hatch once this is reached. - */ - public int mEggAge = 10000; - - public int mEggSize = -1; - - public ItemEntityGiantEgg(World aWorld) { - super(aWorld); - } - - public ItemEntityGiantEgg(World aWorld, double aX, double aY, double aZ) { - super(aWorld, aX, aY, aZ); - } - - public ItemEntityGiantEgg(World aWorld, double aX, double aY, double aZ, ItemStack aStack) { - super(aWorld, aX, aY, aZ, aStack); - } - - private boolean spawnGiantChicken() { - try { - EntityGiantChickenBase entitychicken = new EntityGiantChickenBase(this.worldObj); - entitychicken.setGrowingAge(-MathUtils.randInt(20000, 40000)); - entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); - return this.worldObj.spawnEntityInWorld(entitychicken); - } catch (Throwable t) { - return false; - } - } - - // These eggs also do not combine. - @Override - public boolean combineItems(EntityItem p_70289_1_) { - return false; - } - - @Override - public void writeEntityToNBT(NBTTagCompound aNBT) { - super.writeEntityToNBT(aNBT); - aNBT.setInteger("mEggAge", mEggAge); - aNBT.setInteger("mTicksExisted", this.age); - } - - @Override - public void readEntityFromNBT(NBTTagCompound aNBT) { - super.readEntityFromNBT(aNBT); - mEggAge = aNBT.getInteger("mEggAge"); - } - - // They're fireproof - @Override - public void setFire(int p_70015_1_) {} - - @Override - public boolean isBurning() { - return false; - } - - @Override - public void onEntityUpdate() { - super.onEntityUpdate(); - Logger.INFO("1"); - // Large eggs don't despawn, because they will try hatch first. - if (this.lifespan != Integer.MAX_VALUE - 1) { - this.lifespan = Integer.MAX_VALUE - 1; - } - - if (this.getEntityItem() != null) { - ItemStack g = this.getEntityItem(); - NBTUtils.setInteger(g, "mTicksExisted", this.age); - NBTUtils.setInteger(g, "lifespan", this.lifespan); - NBTUtils.setBoolean(g, "playerHeld", false); - this.setEntityItemStack(g); - Logger.INFO("Writing age to NBT of stored stack item."); - } else { - ItemStack g = ItemUtils.getSimpleStack(ModItems.itemBigEgg); - NBTUtils.setInteger(g, "mTicksExisted", this.age); - NBTUtils.setInteger(g, "lifespan", this.lifespan); - NBTUtils.setBoolean(g, "playerHeld", false); - this.setEntityItemStack(g); - Logger.INFO("Writing age to NBT of new stack item."); - } - - 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 (MathUtils.randInt(100 * mEggSize, 1000) >= MathUtils.randInt(950, 1000)) { - // Spawn Chicken - if (spawnGiantChicken()) { - this.kill(); - } - } - } - } -} diff --git a/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java deleted file mode 100644 index 1c786a20b8..0000000000 --- a/src/main/java/gtPlusPlus/core/entity/monster/EntityBatKing.java +++ /dev/null @@ -1,760 +0,0 @@ -package gtPlusPlus.core.entity.monster; - -import java.lang.reflect.Field; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureAttribute; -import net.minecraft.entity.IRangedAttackMob; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIAttackOnCollide; -import net.minecraft.entity.ai.EntityAIHurtByTarget; -import net.minecraft.entity.ai.EntityAINearestAttackableTarget; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.RandomPositionGenerator; -import net.minecraft.entity.monster.EntityMob; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.entity.projectile.EntityLargeFireball; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.World; - -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; - -public class EntityBatKing extends EntityMob implements IRangedAttackMob { - - public int courseChangeCooldown; - public double waypointX; - public double waypointY; - public double waypointZ; - private Entity targetedEntity; - private int aggroCooldown; - public int prevAttackCounter; - public int attackCounter; - private int explosionStrength = 1; - - private EntityAIBatKingAttack aiAttack = new EntityAIBatKingAttack(this, null, 1.0D, 20, 60, 15.0F, true); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide( - this, - EntityPlayer.class, - 1.2D, - false); - - public EntityBatKing(World p_i1680_1_) { - super(p_i1680_1_); - this.setSize(2.5F, 1.5F); - - this.setIsBatHanging(false); - this.isImmuneToFire = true; - this.experienceValue = 1000; - - this.tasks.addTask(3, this.aiAttack); - // this.tasks.addTask(4, this.aiAttackOnCollide); - // this.tasks.addTask(4, new EntityAIRestrictSun(this)); - // this.tasks.addTask(5, new EntityAIFleeSun(this, 1.0D)); - this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); - // this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - // this.tasks.addTask(6, new EntityAILookIdle(this)); - - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); - // this.targetTasks.addTask(2, this.aiAttack); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityBat.class, 0, false)); - } - - @Override - protected void entityInit() { - super.entityInit(); - } - - /** - * Get this Entity's EnumCreatureAttribute - */ - @Override - public EnumCreatureAttribute getCreatureAttribute() { - return EnumCreatureAttribute.UNDEAD; - } - - /** - * Gets the pitch of living sounds in living entities. - */ - @Override - protected float getSoundPitch() { - return super.getSoundPitch() * 0.15F; - } - - /** - * Returns the sound this mob makes while it's alive. - */ - @Override - protected String getLivingSound() { - int aRand = MathUtils.randInt(0, 10); - if (aRand < 6) { - return null; - } else if (aRand <= 8) { - return "mob.bat.idle"; - } else { - return "mob.blaze.breathe"; - } - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - @Override - protected String getHurtSound() { - return "mob.blaze.hit"; - } - - /** - * Returns the sound this mob makes on death. - */ - @Override - protected String getDeathSound() { - return "mob.bat.death"; - } - - /** - * Returns true if this entity should push and be pushed by other entities when colliding. - */ - @Override - public boolean canBePushed() { - return true; - } - - @Override - protected void collideWithEntity(Entity aEntity) { - if (aEntity != null) { - if (aEntity instanceof EntityPlayer) { - EntityUtils.doDamage(aEntity, DamageSource.magic, (int) (((EntityPlayer) aEntity).getHealth() / 20)); - } - } - } - - @Override - protected void collideWithNearbyEntities() {} - - @Override - protected void applyEntityAttributes() { - - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange); - - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250.0D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(120.0D); - } - - public boolean getIsBatHanging() { - return false; - } - - public void setIsBatHanging(boolean p_82236_1_) { - generateParticles(this); - generateParticles(this); - generateParticles(this); - for (int i = 0; i < 32; ++i) { - // - String particleName = "lava"; - if (MathUtils.randInt(0, 3) <= 2) { - particleName = "crit"; - } - this.worldObj.spawnParticle( - particleName, - this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, - this.posY + this.rand.nextDouble() * (double) this.height, - this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, - 0.0D, - 0.0D, - 0.0D); - } - } - - /** - * Returns true if the newer Entity AI code should be run - */ - @Override - protected boolean isAIEnabled() { - return true; - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() { - super.onUpdate(); - generateParticles(this); - - if (!this.worldObj.isRemote && (this.targetedEntity == null || this.aggroCooldown-- <= 0)) { - this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); - - if (this.targetedEntity != null) { - this.aggroCooldown = 30; - if (aiAttack.hasValidTarget()) { - this.setAttackTarget(aiAttack.getTarget()); - } else { - Logger.INFO("No valid target."); - if (ReflectionUtils.doesFieldExist(aiAttack.getClass(), "mEntityTarget")) { - Logger.INFO("Found field."); - } else { - Logger.INFO("Did not find field."); - } - Field target = ReflectionUtils.getField(EntityAIBatKingAttack.class, "mEntityTarget"); - if (target != null) { - ReflectionUtils.setField(aiAttack, target, this.targetedEntity); - Logger.INFO("Set target."); - } else { - Logger.INFO("Could not set via reflection."); - } - } - } else { - Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this, 32, 20); - if (vec3 != null) { - double xPosition = vec3.xCoord; - double yPosition = vec3.yCoord; - double zPosition = vec3.zCoord; - this.getNavigator().tryMoveToXYZ(xPosition, yPosition, zPosition, 3); - } - } - } - } - - private static void generateParticles(EntityBatKing aKing) { - for (int i = 0; i < 20; ++i) { - // - if (MathUtils.randInt(0, 50) <= 1) { - String particleName = "smoke"; - if (MathUtils.randInt(0, 3) <= 2) { - particleName = "largesmoke"; - } - aKing.worldObj.spawnParticle( - particleName, - aKing.posX + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, - aKing.posY + aKing.rand.nextDouble() * (double) aKing.height, - aKing.posZ + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, - 0.0D, - 0.0D, - 0.0D); - } - if (MathUtils.randInt(0, 100) <= 1) { - String particleName = "smoke"; - int test2 = MathUtils.randInt(0, 3); - if (test2 == 2) { - particleName = "dripLava"; - } else if (test2 == 3) { - particleName = "portal"; - } - aKing.worldObj.spawnParticle( - particleName, - aKing.posX + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, - aKing.posY + aKing.rand.nextDouble() * (double) aKing.height, - aKing.posZ + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, - 0.0D, - 0.0D, - 0.0D); - } - } - } - - @Override - protected void updateAITasks() { - super.updateAITasks(); - } - - private boolean isFlying() { - if (this.onGround) { - return false; - } - return true; - } - - private boolean hasAir() { - BlockPos p = EntityUtils.findBlockPosUnderEntity(this); - int y = p.yPos; - int yOriginal = p.yPos; - - for (int u = 0; u < 5; u++) { - if (u > 50 || y <= 0) { - break; - } - if (!this.worldObj.isAirBlock(p.xPos, y, p.zPos)) { - break; - } - y--; - } - if (yOriginal != y) { - for (int i = 0; i < y; y++) { - this.jump(); - } - return true; - } - return false; - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops - */ - @Override - protected boolean canTriggerWalking() { - return false; - } - - /** - * Return whether this entity should NOT trigger a pressure plate or a tripwire. - */ - @Override - public boolean doesEntityNotTriggerPressurePlate() { - return true; - } - - /** - * Called when the entity is attacked. - */ - @Override - public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { - if (this.isEntityInvulnerable()) { - return false; - } else { - if (!this.worldObj.isRemote && this.getIsBatHanging()) { - this.setIsBatHanging(false); - } - - return super.attackEntityFrom(p_70097_1_, p_70097_2_); - } - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound p_70037_1_) { - super.readEntityFromNBT(p_70037_1_); - if (p_70037_1_.hasKey("ExplosionPower", 99)) { - this.explosionStrength = p_70037_1_.getInteger("ExplosionPower"); - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound p_70014_1_) { - super.writeEntityToNBT(p_70014_1_); - p_70014_1_.setInteger("ExplosionPower", this.explosionStrength); - } - - /** - * Attack the specified entity using a ranged attack. - */ - @Override - public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) { - Logger.INFO("Trying to do ranged attack 1 |" + (this.targetedEntity != null) + "|"); - - if (!this.isFlying() || !this.isAirBorne) { - // this.hasAir(); - /* - * for (int i=0;i<3;i++) { this.jump(); } - */ - } - - double d4 = 64.0D; - if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4 * 8) { - Logger.INFO("Trying to do ranged attack 2"); - double d5 = this.targetedEntity.posX - this.posX; - double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - - (this.posY + (double) (this.height / 2.0F)); - double d7 = this.targetedEntity.posZ - this.posZ; - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; - - ++this.attackCounter; - - if (this.canEntityBeSeen(this.targetedEntity)) { - Logger.INFO("Trying to do ranged attack 3a | " + attackCounter); - - if (this.attackCounter >= 2) { - Logger.INFO("Trying to do ranged attack 3a1"); - - this.worldObj.playAuxSFXAtEntity( - (EntityPlayer) null, - 1008, - (int) this.posX, - (int) this.posY, - (int) this.posZ, - 0); - setIsBatHanging(true); - - EntityThrowableBomb entitylargefireball = new EntityThrowableBomb( - this.worldObj, - this /* d5, d6, d7 */); - // entitylargefireball.field_92057_e = this.explosionStrength; - // entitylargefireball.accelerationX *= 2; - // entitylargefireball.accelerationY *= 2; - // entitylargefireball.accelerationZ *= 2; - double d8 = 4.0D; - Vec3 vec3 = this.getLook(1.0F); - entitylargefireball.posX = this.posX + vec3.xCoord * d8; - entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; - entitylargefireball.posZ = this.posZ + vec3.zCoord * d8; - this.worldObj.spawnEntityInWorld(entitylargefireball); - - for (int u = 0; u < MathUtils.randInt(2, 10); u++) { - if (this.attackCounter > 0) { - Logger.INFO("Trying to do ranged attack 5a"); - --this.attackCounter; - EntityArrow entityarrow = new EntityArrow( - this.worldObj, - this, - p_82196_1_, - MathUtils.randFloat(1f, 3f), - (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); - int i = MathUtils.randInt(0, 4); - int j = MathUtils.randInt(0, 3); - int k = MathUtils.randInt(0, 3); - entityarrow.setDamage( - (double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D - + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() - * 0.11F)); - - boolean boostAttack = MathUtils.randInt(0, 100) <= 21; - if (boostAttack) { - if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); - } - - if (j > 0) { - entityarrow.setKnockbackStrength(j); - } - if (k > 0) { - entityarrow.setFire(50 * k); - } - } - - this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); - Logger.INFO("Trying to do ranged attack 5a done"); - } - } - - this.attackCounter = 0; - } - } else if (this.attackCounter > 0) { - Logger.INFO("Trying to do ranged attack 3b"); - --this.attackCounter; - } - } else { - Logger.INFO("Trying to do ranged attack 4a"); - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F - / (float) Math.PI; - - if (this.attackCounter > 0) { - Logger.INFO("Trying to do ranged attack 5a"); - --this.attackCounter; - EntityArrow entityarrow = new EntityArrow( - this.worldObj, - this, - p_82196_1_, - 1.6F, - (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); - int i = MathUtils.randInt(0, 4); - int j = MathUtils.randInt(0, 3); - int k = MathUtils.randInt(0, 3); - entityarrow.setDamage( - (double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D - + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); - - boolean boostAttack = MathUtils.randInt(0, 100) <= 21; - if (boostAttack) { - if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); - } - - if (j > 0) { - entityarrow.setKnockbackStrength(j); - } - if (k > 0) { - entityarrow.setFire(50 * k); - } - } - - this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); - Logger.INFO("Trying to do ranged attack 5a done"); - } - } - } - - /** - * Returns the volume for the sounds this mob makes. - */ - @Override - protected float getSoundVolume() { - return 10.0F; - } - - /** - * Checks if the entity's current position is a valid location to spawn this entity. - */ - @Override - public boolean getCanSpawnHere() { - return super.getCanSpawnHere() && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL; - } - - /** - * Will return how many at most can spawn in a chunk at once. - */ - @Override - public int getMaxSpawnedInChunk() { - return 1; - } - - @Override - protected Item getDropItem() { - return Items.gunpowder; - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param - * par2 - Level of Looting used to kill this mob. - */ - @Override - protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { - int j = this.rand.nextInt(2) + this.rand.nextInt(1 + p_70628_2_); - int k; - - for (k = 0; k < j; ++k) { - this.dropItem(Items.ghast_tear, 1); - } - - j = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_); - - for (k = 0; k < j; ++k) { - this.dropItem(Items.gunpowder, 1); - } - } - - @Override - protected void updateEntityActionState() { - if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { - this.setDead(); - } - - this.despawnEntity(); - this.prevAttackCounter = this.attackCounter; - double d0 = this.waypointX - this.posX; - double d1 = this.waypointY - this.posY; - double d2 = this.waypointZ - this.posZ; - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - - if (d3 < 1.0D || d3 > 3600.0D) { - this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - } - - if (this.courseChangeCooldown-- <= 0) { - this.courseChangeCooldown += this.rand.nextInt(5) + 2; - d3 = (double) MathHelper.sqrt_double(d3); - - if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) { - this.motionX += d0 / d3 * 0.1D; - this.motionY += d1 / d3 * 0.1D; - this.motionZ += d2 / d3 * 0.1D; - } else { - this.waypointX = this.posX; - this.waypointY = this.posY; - this.waypointZ = this.posZ; - } - } - - if (this.targetedEntity != null && this.targetedEntity.isDead) { - this.targetedEntity = null; - } - - if (this.targetedEntity == null || this.aggroCooldown-- <= 0) { - this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); - - if (this.targetedEntity != null) { - this.aggroCooldown = 20; - } - } - - double d4 = 64.0D; - - if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4) { - double d5 = this.targetedEntity.posX - this.posX; - double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - - (this.posY + (double) (this.height / 2.0F)); - double d7 = this.targetedEntity.posZ - this.posZ; - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; - - if (this.canEntityBeSeen(this.targetedEntity)) { - if (this.attackCounter == 10) { - this.worldObj.playAuxSFXAtEntity( - (EntityPlayer) null, - 1007, - (int) this.posX, - (int) this.posY, - (int) this.posZ, - 0); - } - - ++this.attackCounter; - - if (this.attackCounter == 20) { - this.worldObj.playAuxSFXAtEntity( - (EntityPlayer) null, - 1008, - (int) this.posX, - (int) this.posY, - (int) this.posZ, - 0); - EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7); - entitylargefireball.field_92057_e = this.explosionStrength; - double d8 = 4.0D; - Vec3 vec3 = this.getLook(1.0F); - entitylargefireball.posX = this.posX + vec3.xCoord * d8; - entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; - entitylargefireball.posZ = this.posZ + vec3.zCoord * d8; - this.worldObj.spawnEntityInWorld(entitylargefireball); - this.attackCounter = -40; - } - } else if (this.attackCounter > 0) { - --this.attackCounter; - } - } else { - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F - / (float) Math.PI; - - if (this.attackCounter > 0) { - --this.attackCounter; - } - } - - if (!this.worldObj.isRemote) { - byte b1 = this.dataWatcher.getWatchableObjectByte(16); - byte b0 = (byte) (this.attackCounter > 10 ? 1 : 0); - - if (b1 != b0) { - this.dataWatcher.updateObject(16, Byte.valueOf(b0)); - } - } - } - - /** - * True if the ghast has an unobstructed line of travel to the waypoint. - */ - private boolean isCourseTraversable(double p_70790_1_, double p_70790_3_, double p_70790_5_, double p_70790_7_) { - double d4 = (this.waypointX - this.posX) / p_70790_7_; - double d5 = (this.waypointY - this.posY) / p_70790_7_; - double d6 = (this.waypointZ - this.posZ) / p_70790_7_; - AxisAlignedBB axisalignedbb = this.boundingBox.copy(); - - for (int i = 1; (double) i < p_70790_7_; ++i) { - axisalignedbb.offset(d4, d5, d6); - - /* - * if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) { return false; } - */ - } - - return true; - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - @Override - protected void fall(float p_70069_1_) {} - - /** - * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance - * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround - */ - @Override - protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {} - - /** - * Moves the entity based on the specified heading. Args: strafe, forward - */ - @Override - public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_) { - if (this.isInWater()) { - this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.800000011920929D; - this.motionY *= 0.800000011920929D; - this.motionZ *= 0.800000011920929D; - } else if (this.handleLavaMovement()) { - this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.5D; - this.motionY *= 0.5D; - this.motionZ *= 0.5D; - } else { - float f2 = 0.91F; - - if (this.onGround) { - f2 = this.worldObj.getBlock( - MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.boundingBox.minY) - 1, - MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; - } - - float f3 = 0.16277136F / (f2 * f2 * f2); - this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F); - f2 = 0.91F; - - if (this.onGround) { - f2 = this.worldObj.getBlock( - MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.boundingBox.minY) - 1, - MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; - } - - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= (double) f2; - this.motionY *= (double) f2; - this.motionZ *= (double) f2; - } - - this.prevLimbSwingAmount = this.limbSwingAmount; - double d1 = this.posX - this.prevPosX; - double d0 = this.posZ - this.prevPosZ; - float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; - - if (f4 > 1.0F) { - f4 = 1.0F; - } - - this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F; - this.limbSwing += this.limbSwingAmount; - } - - /** - * returns true if this entity is by a ladder, false otherwise - */ - @Override - public boolean isOnLadder() { - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java b/src/main/java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java deleted file mode 100644 index 45bbcab4c8..0000000000 --- a/src/main/java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java +++ /dev/null @@ -1,314 +0,0 @@ -package gtPlusPlus.core.entity.monster; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityAgeable; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIEatGrass; -import net.minecraft.entity.ai.EntityAIFollowParent; -import net.minecraft.entity.ai.EntityAILookIdle; -import net.minecraft.entity.ai.EntityAIMate; -import net.minecraft.entity.ai.EntityAIPanic; -import net.minecraft.entity.ai.EntityAISwimming; -import net.minecraft.entity.ai.EntityAITempt; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeHooks; - -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.general.ItemGemShards; -import gtPlusPlus.core.util.math.MathUtils; - -public class EntityGiantChickenBase extends EntityChicken { - - /** The time until the next egg is spawned. */ - public int timeUntilNextBigEgg; - - public EntityGiantChickenBase(World aWorld) { - super(aWorld); - this.setSize(0.6F, 1.4F); // Double - this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; - this.timeUntilNextBigEgg = this.rand.nextInt(16000) + 4000; - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); - this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); - this.tasks.addTask(3, new EntityAITempt(this, 1.0D, ModItems.itemGemShards, false)); - this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); - this.tasks.addTask(4, new EntityAIEatGrass(this)); - this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(5, new EntityAILookIdle(this)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D); - } - - /** - * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons - * use this to react to sunlight and start to burn. - */ - @Override - public void onLivingUpdate() { - super.onLivingUpdate(); - this.field_70888_h = this.field_70886_e; - this.field_70884_g = this.destPos; - this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D); - - if (this.destPos < 0.0F) { - this.destPos = 0.0F; - } - - if (this.destPos > 1.0F) { - this.destPos = 1.0F; - } - - if (!this.onGround && this.field_70889_i < 1.0F) { - this.field_70889_i = 1.0F; - } - - this.field_70889_i = (float) ((double) this.field_70889_i * 0.9D); - - if (!this.onGround && this.motionY < 0.0D) { - this.motionY *= 0.6D; - } - - if (MathUtils.randInt(0, 10000) <= 5) { - jump(); - } - - this.field_70886_e += this.field_70889_i * 2.0F; - - if (!this.worldObj.isRemote && --this.timeUntilNextEgg <= 0) { - this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.dropItem(Items.egg, 1); - this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; - } - if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0) { - this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.dropItem(ModItems.itemBigEgg, MathUtils.randInt(1, 4)); - this.timeUntilNextBigEgg = this.rand.nextInt(16000) + 4000; - } - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - @Override - protected void fall(float p_70069_1_) { - - if (MathUtils.randInt(0, 10) <= 5) { - jump(); - } - } - - @Override - protected Item getDropItem() { - return ModItems.itemBigEgg; - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param - * par2 - Level of Looting used to kill this mob. - */ - @Override - protected void dropFewItems(boolean recentHit, int lootLevel) { - int j = this.rand.nextInt(3) + this.rand.nextInt(1 + lootLevel); - - for (int k = 0; k < j; ++k) { - this.dropItem(Items.feather, 1); - } - - // Large Egg Chance - for (int k = 0; k < j * 2; ++k) { - this.dropItem( - ModItems.itemBigEgg, - MathUtils.getRandomFromArray(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2 })); - } - - // Chicken Corpses Dropped - int mBodies = MathUtils.getRandomFromArray( - new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, - 4, 4, 4, 5, 5, 6 }); - if (this.isBurning()) { - this.dropItem(Items.cooked_chicken, mBodies); - } else { - this.dropItem(Items.chicken, mBodies); - } - } - - @Override - public EntityGiantChickenBase createChild(EntityAgeable p_90011_1_) { - return new EntityGiantChickenBase(this.worldObj); - } - - /** - * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on - * the animal type) - */ - @Override - public boolean isBreedingItem(ItemStack aStack) { - return aStack != null && aStack.getItem() instanceof ItemGemShards; - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound aNBT) { - super.readEntityFromNBT(aNBT); - timeUntilNextBigEgg = aNBT.getInteger("timeUntilNextBigEgg"); - } - - /** - * Get the experience points the entity currently has. - */ - @Override - protected int getExperiencePoints(EntityPlayer p_70693_1_) { - return this.isChickenJockey() ? 20 : super.getExperiencePoints(p_70693_1_); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound aNBT) { - super.writeEntityToNBT(aNBT); - aNBT.setInteger("timeUntilNextBigEgg", timeUntilNextBigEgg); - } - - /** - * Determines if an entity can be despawned, used on idle far away entities - */ - @Override - protected boolean canDespawn() { - return this.isChickenJockey() && this.riddenByEntity == null; - } - - @Override - public void updateRiderPosition() { - super.updateRiderPosition(); - float f = MathHelper.sin(this.renderYawOffset * (float) Math.PI / 180.0F); - float f1 = MathHelper.cos(this.renderYawOffset * (float) Math.PI / 180.0F); - float f2 = 0.1F; - float f3 = 0.0F; - this.riddenByEntity.setPosition( - this.posX + (double) (f2 * f), - this.posY + (double) (this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double) f3, - this.posZ - (double) (f2 * f1)); - - if (this.riddenByEntity instanceof EntityLivingBase) { - ((EntityLivingBase) this.riddenByEntity).renderYawOffset = this.renderYawOffset; - } - } - - public boolean isChickenJockey() { - return func_152116_bZ(); - } - - public void setIsChickenJockey(boolean isJockey) { - func_152117_i(isJockey); - } - - @Override - protected Entity findPlayerToAttack() { - // TODO Auto-generated method stub - return super.findPlayerToAttack(); - } - - @Override - public boolean interact(EntityPlayer p_70085_1_) { - // TODO Auto-generated method stub - return super.interact(p_70085_1_); - } - - @Override - public void setHomeArea(int p_110171_1_, int p_110171_2_, int p_110171_3_, int p_110171_4_) { - // TODO Auto-generated method stub - super.setHomeArea(p_110171_1_, p_110171_2_, p_110171_3_, p_110171_4_); - } - - @Override - public ChunkCoordinates getHomePosition() { - // TODO Auto-generated method stub - return super.getHomePosition(); - } - - @Override - public void detachHome() { - // TODO Auto-generated method stub - super.detachHome(); - } - - @Override - public boolean hasHome() { - // TODO Auto-generated method stub - return super.hasHome(); - } - - @Override - public void eatGrassBonus() { - if (this.isChild()) { - this.addGrowth(60); - } - } - - @Override - public float getRenderSizeModifier() { - return 1.0f; - } - - @Override - protected void jump() { - this.motionY = 0.68999998688697815D; - this.motionY += 0.068999998688697815D; - if (this.isPotionActive(Potion.jump)) { - this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.5F); - } - - if (this.isSprinting()) { - float f = this.rotationYaw * 0.017453292F; - this.motionX -= (double) (MathHelper.sin(f) * 0.2F); - this.motionZ += (double) (MathHelper.cos(f) * 0.2F); - } - - this.isAirBorne = true; - - if (MathUtils.randInt(0, 10) < 10) { - jump(); - } - - ForgeHooks.onLivingJump(this); - } - - @Override - public void onStruckByLightning(EntityLightningBolt p_70077_1_) { - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - super.onStruckByLightning(p_70077_1_); - } - - @Override - public boolean shouldDismountInWater(Entity rider) { - return true; - } -} diff --git a/src/main/java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java b/src/main/java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java index cea480fda8..3f5e755626 100644 --- a/src/main/java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java +++ b/src/main/java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java @@ -14,11 +14,6 @@ import cpw.mods.fml.relauncher.SideOnly; public class EntityLightningAttack extends EntityWitherSkull { - public EntityLightningAttack(World p_i1793_1_) { - super(p_i1793_1_); - this.setSize(0.3125F, 0.3125F); - } - public EntityLightningAttack(World p_i1794_1_, EntityLivingBase p_i1794_2_, double p_i1794_3_, double p_i1794_5_, double p_i1794_7_) { super(p_i1794_1_, p_i1794_2_, p_i1794_3_, p_i1794_5_, p_i1794_7_); |