diff options
| author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
| commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
| tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/core/entity | |
| parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
| download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip | |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/core/entity')
16 files changed, 4013 insertions, 3485 deletions
diff --git a/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java b/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java index 9abd07392d..63d94fafee 100644 --- a/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java +++ b/src/main/java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java @@ -1,216 +1,397 @@ 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; + + public EntityPrimedMiningExplosive(final World world) { + super(world); + this.fuse = 160; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + this.yOffset = this.height / 2.0F; + } + + 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); + this.motionX = -((float) Math.sin(f)) * 0.02F; + this.motionY = 0.20000000298023224D; + this.motionZ = -((float) Math.cos(f)) * 0.02F; + this.fuse = 160; + this.prevPosX = x; + this.prevPosY = y; + this.prevPosZ = z; + this.tntPlacedBy = placingEntity; + } + + @Override + protected void entityInit() {} + + /** + * 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; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + @Override + public boolean canBeCollidedWith() { + return !this.isDead; + } + + /** + * Called to update the entity's position/logic. + */ + @Override + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.onGround) { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY *= -0.5D; + } + + if (this.fuse-- <= 0) { + this.setDead(); + + if (!this.worldObj.isRemote) { + this.explode(); + } + } else { + + int t = MathUtils.randInt(0, 15); + + if (t <= 2) { + int e = MathUtils.randInt(0, 3); + if (e <= 1) { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largesmoke", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "cloud", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "flame", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } else if (e == 2) { + this.worldObj.spawnParticle( + "explode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } + } else if (t <= 4) { + int e = MathUtils.randInt(0, 5); + if (e <= 1) { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largesmoke", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "cloud", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "flame", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } else if (e == 2) { + this.worldObj.spawnParticle( + "explode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } + } else if (t <= 6) { + int e = MathUtils.randInt(0, 4); + if (e <= 1) { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largesmoke", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "cloud", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "flame", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } else if (e == 2) { + this.worldObj.spawnParticle( + "explode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } + } else if (t <= 8) { + int e = MathUtils.randInt(0, 1); + if (e <= 1) { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largesmoke", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "cloud", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "flame", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } else if (e == 2) { + this.worldObj.spawnParticle( + "explode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } + } else if (t <= 10) { + int e = MathUtils.randInt(0, 6); + if (e <= 1) { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largesmoke", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "cloud", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "flame", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } else if (e >= 2) { + this.worldObj.spawnParticle( + "explode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + MathUtils.randDouble(0, 1), + this.posY + MathUtils.randDouble(0, 1), + this.posZ + MathUtils.randDouble(0, 1), + 0.0D, + 0.0D, + 0.0D); + } + } + } + } + + private void explode() { + final float f = 100.0F; + + 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);*/ + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + protected void writeEntityToNBT(final NBTTagCompound tag) { + tag.setByte("Fuse", (byte) this.fuse); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + protected void readEntityFromNBT(final NBTTagCompound tag) { + this.fuse = tag.getByte("Fuse"); + } -public class EntityPrimedMiningExplosive extends EntityTNTPrimed -{ - /** How long the fuse is */ - private EntityLivingBase tntPlacedBy; - - public EntityPrimedMiningExplosive(final World world){ - super(world); - this.fuse = 160; - this.preventEntitySpawning = true; - this.setSize(0.98F, 0.98F); - this.yOffset = this.height / 2.0F; - } - - 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); - this.motionX = -((float)Math.sin(f)) * 0.02F; - this.motionY = 0.20000000298023224D; - this.motionZ = -((float)Math.cos(f)) * 0.02F; - this.fuse = 160; - this.prevPosX = x; - this.prevPosY = y; - this.prevPosZ = z; - this.tntPlacedBy = placingEntity; - } - - @Override - protected void entityInit() {} - - /** - * 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; - } - - /** - * Returns true if other Entities should be prevented from moving through this Entity. - */ - @Override - public boolean canBeCollidedWith() - { - return !this.isDead; - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.motionY -= 0.03999999910593033D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; - - if (this.onGround) - { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - this.motionY *= -0.5D; - } - - if (this.fuse-- <= 0) - { - this.setDead(); - - if (!this.worldObj.isRemote) - { - this.explode(); - } - } - else - { - - int t = MathUtils.randInt(0, 15); - - if (t <= 2){ - int e = MathUtils.randInt(0, 3); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 4){ - int e = MathUtils.randInt(0, 5); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 6){ - int e = MathUtils.randInt(0, 4); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 8){ - int e = MathUtils.randInt(0, 1); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 10){ - int e = MathUtils.randInt(0, 6); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e >= 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - - } - } - - private void explode() - { - final float f = 100.0F; - - 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);*/ - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - protected void writeEntityToNBT(final NBTTagCompound tag) - { - tag.setByte("Fuse", (byte)this.fuse); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - protected void readEntityFromNBT(final NBTTagCompound tag) - { - this.fuse = tag.getByte("Fuse"); - } - - /** - * returns null or the entityliving it was placed or ignited by - */ - @Override - public EntityLivingBase getTntPlacedBy() - { - return this.tntPlacedBy; - } -}
\ No newline at end of file + /** + * returns null or the entityliving it was placed or ignited by + */ + @Override + public EntityLivingBase getTntPlacedBy() { + return this.tntPlacedBy; + } +} diff --git a/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java b/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java index ea667b8667..ca4229bec3 100644 --- a/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java +++ b/src/main/java/gtPlusPlus/core/entity/EntityTeleportFX.java @@ -2,7 +2,6 @@ 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; @@ -11,237 +10,228 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityTeleportFX extends Entity -{ - /** 'x' location the eye should float towards. */ - private double targetX; - /** 'y' location the eye should float towards. */ - private double targetY; - /** 'z' location the eye should float towards. */ - private double targetZ; - private int despawnTimer; - private boolean shatterOrDrop; - private static final String __OBFID = "CL_00001716"; - - public EntityTeleportFX(final World p_i1757_1_) - { - super(p_i1757_1_); - this.setSize(0.25F, 0.25F); - } - - @Override - protected void entityInit() {} - - /** - * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge - * length * 64 * renderDistanceWeight Args: distance - */ - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(final double p_70112_1_) - { - double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; - d1 *= 64.0D; - 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_) - { - super(p_i1758_1_); - this.despawnTimer = 0; - this.setSize(0.25F, 0.25F); - this.setPosition(p_i1758_2_, p_i1758_4_, p_i1758_6_); - this.yOffset = 0.0F; - } - - /** - * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args: - * strongholdX, strongholdY, strongholdZ - */ - public void moveTowards(final double p_70220_1_, final int p_70220_3_, final double p_70220_4_) - { - final double d2 = p_70220_1_ - this.posX; - final double d3 = p_70220_4_ - this.posZ; - final float f = MathHelper.sqrt_double((d2 * d2) + (d3 * d3)); - - if (f > 12.0F) - { - this.targetX = this.posX + ((d2 / f) * 12.0D); - this.targetZ = this.posZ + ((d3 / f) * 12.0D); - this.targetY = this.posY + 8.0D; - } - else - { - this.targetX = p_70220_1_; - this.targetY = p_70220_3_; - this.targetZ = p_70220_4_; - } - - this.despawnTimer = 0; - this.shatterOrDrop = this.rand.nextInt(5) > 0; - } - - /** - * Sets the velocity to the args. Args: x, y, z - */ - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(final double p_70016_1_, final double p_70016_3_, final double p_70016_5_) - { - this.motionX = p_70016_1_; - this.motionY = p_70016_3_; - this.motionZ = p_70016_5_; - - if ((this.prevRotationPitch == 0.0F) && (this.prevRotationYaw == 0.0F)) - { - final float f = MathHelper.sqrt_double((p_70016_1_ * p_70016_1_) + (p_70016_5_ * p_70016_5_)); - this.prevRotationYaw = this.rotationYaw = (float)((Math.atan2(p_70016_1_, p_70016_5_) * 180.0D) / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)((Math.atan2(p_70016_3_, f) * 180.0D) / Math.PI); - } - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - super.onUpdate(); - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - 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) - { - ; |
