diff --git a/common/MysticWorld/Entity/EntityChargeAir.java b/common/MysticWorld/Entity/EntityChargeAir.java index cd6066a..5dc256b 100644 --- a/common/MysticWorld/Entity/EntityChargeAir.java +++ b/common/MysticWorld/Entity/EntityChargeAir.java @@ -1,22 +1,12 @@ package mysticworld.entity; -import java.util.List; - import mysticworld.MysticWorld; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EntityChargeAir extends Entity { - public EntityPlayer shootingEntity; - private int ticksInAir = 0; +public class EntityChargeAir extends EntityCharge { private float particleScale = 1.0f; private double powerHeight = 0.75D; @@ -25,108 +15,18 @@ public class EntityChargeAir extends Entity { } public EntityChargeAir(World par1World, EntityPlayer par2EntityPlayer, float pScale, double pHeight) { - super(par1World); - this.setSize(0.25F, 0.25F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI)); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.shootingEntity = par2EntityPlayer; + super(par1World,par2EntityPlayer); this.particleScale = pScale; this.powerHeight = pHeight; } @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public float getBrightness(float par1) { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float par1) { - return 15728880; - } - - @Override - public float getCollisionBorderSize() { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - @Override - public void onUpdate() { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { - this.setDead(); - } else { - super.onUpdate(); - Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, true, true, false); - vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) { - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - if (movingobjectposition != null) { - this.onImpact(movingobjectposition); - } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f2 = this.getMotionFactor(); - if (this.isInWater()) { - for (int k = 0; k < 4; ++k) { - float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); - } - f2 = 0.8F; - } - MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), particleScale, 15); - MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), particleScale, 15); - this.setPosition(this.posX, this.posY, this.posZ); - } - } - - @Override - protected void entityInit() { - } - - protected float getMotionFactor() { - return 0.95F; + public void chargeFX() { + MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), particleScale, 15); + MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), particleScale, 15); } + @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (!this.worldObj.isRemote) { this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); @@ -135,7 +35,7 @@ public class EntityChargeAir extends Entity { if (f3 > 0.0F) { par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 2 * 0.6000000238418579D / f3, 1.0D + powerHeight, this.motionZ * 2 * 0.6000000238418579D / f3); } - } else { + } /*else { int i = par1MovingObjectPosition.blockX; int j = par1MovingObjectPosition.blockY; int k = par1MovingObjectPosition.blockZ; @@ -158,22 +58,8 @@ public class EntityChargeAir extends Entity { case 5: ++i; } - } + }*/ this.setDead(); } } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double par1){ - return par1 > 1.0D && super.isInRangeToRenderDist(par1); - } } \ No newline at end of file diff --git a/common/MysticWorld/Entity/EntityChargeEarth.java b/common/MysticWorld/Entity/EntityChargeEarth.java index f26a020..62e54e6 100644 --- a/common/MysticWorld/Entity/EntityChargeEarth.java +++ b/common/MysticWorld/Entity/EntityChargeEarth.java @@ -1,140 +1,33 @@ package mysticworld.entity; -import java.util.List; import java.util.Random; import mysticworld.MysticWorld; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.boss.EntityDragon; -import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class EntityChargeEarth extends Entity { - public EntityPlayer shootingEntity; - public EntityPlayer entityPlayer; - public EntityDragon entityDragon; - public EntityWither entityWither; - private int ticksInAir = 0; +public class EntityChargeEarth extends EntityCharge { public EntityChargeEarth(World par1World) { super(par1World); } public EntityChargeEarth(World par1World, EntityPlayer par2EntityPlayer) { - super(par1World); - this.setSize(0.25F, 0.25F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI)); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.shootingEntity = par2EntityPlayer; + super(par1World,par2EntityPlayer); } @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public float getBrightness(float par1) { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float par1) { - return 15728880; - } - - @Override - public float getCollisionBorderSize() { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - @Override - public void onUpdate() { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { - this.setDead(); - } else { - super.onUpdate(); - Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, true, true, false); - vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) { - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - if (movingobjectposition != null) { - this.onImpact(movingobjectposition); - } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f2 = this.getMotionFactor(); - if (this.isInWater()) { - for (int k = 0; k < 4; ++k) { - float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); - } - f2 = 0.8F; - } - MysticWorld.proxy.earthFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); - this.setPosition(this.posX, this.posY, this.posZ); - } - } - - @Override - protected void entityInit() { - } - - protected float getMotionFactor() { - return 0.95F; + public void chargeFX() { + MysticWorld.proxy.earthFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); } + @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { Random rand = new Random(); if (!this.worldObj.isRemote) { @@ -142,7 +35,7 @@ public class EntityChargeEarth extends Entity { if (par1MovingObjectPosition.entityHit != null) { double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f3 > 0.0F) { - par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3); + par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 0.6000000238418579D / f3, 0.1D, this.motionZ * 0.6000000238418579D / f3); } par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.wheat_seeds, rand.nextInt(4)))); @@ -154,7 +47,7 @@ public class EntityChargeEarth extends Entity { this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Blocks.sapling, rand.nextInt(2), 2))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Blocks.sapling, rand.nextInt(2), 3))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.melon_seeds, rand.nextInt(3)))); - } else { + }/* else { int i = par1MovingObjectPosition.blockX; int j = par1MovingObjectPosition.blockY; int k = par1MovingObjectPosition.blockZ; @@ -177,22 +70,8 @@ public class EntityChargeEarth extends Entity { case 5: ++i; } - } + }*/ this.setDead(); } } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double par1){ - return par1 > 1.0D && super.isInRangeToRenderDist(par1); - } } diff --git a/common/MysticWorld/Entity/EntityChargeEnergy.java b/common/MysticWorld/Entity/EntityChargeEnergy.java index 724a874..e6ba12c 100644 --- a/common/MysticWorld/Entity/EntityChargeEnergy.java +++ b/common/MysticWorld/Entity/EntityChargeEnergy.java @@ -1,128 +1,27 @@ package mysticworld.entity; -import java.util.List; - import mysticworld.MysticWorld; -import net.minecraft.entity.Entity; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class EntityChargeEnergy extends Entity { - public EntityPlayer shootingEntity; - private int ticksInAir = 0; +public class EntityChargeEnergy extends EntityCharge { public EntityChargeEnergy(World par1World) { super(par1World); } public EntityChargeEnergy(World par1World, EntityPlayer par2EntityPlayer) { - super(par1World); - this.setSize(0.25F, 0.25F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI)); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.shootingEntity = par2EntityPlayer; + super(par1World,par2EntityPlayer); } @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public float getBrightness(float par1) { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float par1) { - return 15728880; - } - - @Override - public float getCollisionBorderSize() { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - @Override - public void onUpdate() { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { - this.setDead(); - } else { - super.onUpdate(); - Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, true, true, false); - vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) { - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - if (movingobjectposition != null) { - this.onImpact(movingobjectposition); - } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f2 = this.getMotionFactor(); - if (this.isInWater()) { - for (int k = 0; k < 4; ++k) { - float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); - } - f2 = 0.8F; - } - MysticWorld.proxy.energyFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); - this.setPosition(this.posX, this.posY, this.posZ); - } - } - - @Override - protected void entityInit() { - } - - protected float getMotionFactor() { - return 0.95F; + public void chargeFX() { + MysticWorld.proxy.energyFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); } + @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { int i = par1MovingObjectPosition.blockX; int j = par1MovingObjectPosition.blockY; @@ -136,7 +35,7 @@ public class EntityChargeEnergy extends Entity { worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, par1MovingObjectPosition.entityHit.posX, par1MovingObjectPosition.entityHit.posY, par1MovingObjectPosition.entityHit.posZ)); } else { worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, i, j, k)); - switch (par1MovingObjectPosition.sideHit) { + /*switch (par1MovingObjectPosition.sideHit) { case 0: --j; break; @@ -154,23 +53,9 @@ public class EntityChargeEnergy extends Entity { break; case 5: ++i; - } + }*/ } this.setDead(); } } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double par1){ - return par1 > 1.0D && super.isInRangeToRenderDist(par1); - } } \ No newline at end of file diff --git a/common/MysticWorld/Entity/EntityChargeFire.java b/common/MysticWorld/Entity/EntityChargeFire.java index 008677b..1cd722a 100644 --- a/common/MysticWorld/Entity/EntityChargeFire.java +++ b/common/MysticWorld/Entity/EntityChargeFire.java @@ -1,137 +1,35 @@ package mysticworld.entity; -import java.util.List; - import mysticworld.MysticWorld; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class EntityChargeFire extends Entity { - public EntityPlayer shootingEntity; - private int ticksInAir = 0; +public class EntityChargeFire extends EntityCharge { public EntityChargeFire(World par1World) { super(par1World); } public EntityChargeFire(World par1World, EntityPlayer par2EntityPlayer) { - super(par1World); - this.setSize(0.25F, 0.25F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI)); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.shootingEntity = par2EntityPlayer; + super(par1World,par2EntityPlayer); } @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public float getBrightness(float par1) { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float par1) { - return 15728880; - } - - @Override - public float getCollisionBorderSize() { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - @Override - public void onUpdate() { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { - this.setDead(); - } else { - super.onUpdate(); - Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, true, true, false); - vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) { - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - if (movingobjectposition != null) { - this.onImpact(movingobjectposition); - } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f2 = this.getMotionFactor(); - if (this.isInWater()) { - for (int k = 0; k < 4; ++k) { - float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); - } - f2 = 0.8F; - } - MysticWorld.proxy.fireFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); - this.setPosition(this.posX, this.posY, this.posZ); - } - } - - @Override - protected void entityInit() { - } - - protected float getMotionFactor() { - return 0.95F; + public void chargeFX() { + MysticWorld.proxy.fireFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); } + @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (!this.worldObj.isRemote) { this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); if (par1MovingObjectPosition.entityHit != null) { double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f3 > 0.0F) { - par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3); + par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 0.6000000238418579D / f3, 0.1D, this.motionZ * 0.6000000238418579D / f3); } if (!par1MovingObjectPosition.entityHit.isImmuneToFire()) { par1MovingObjectPosition.entityHit.setFire(5); @@ -167,18 +65,4 @@ public class EntityChargeFire extends Entity { this.setDead(); } } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double par1){ - return par1 > 1.0D && super.isInRangeToRenderDist(par1); - } } diff --git a/common/MysticWorld/Entity/EntityChargeWater.java b/common/MysticWorld/Entity/EntityChargeWater.java index 45ac24d..c77c2b0 100644 --- a/common/MysticWorld/Entity/EntityChargeWater.java +++ b/common/MysticWorld/Entity/EntityChargeWater.java @@ -1,135 +1,34 @@ package mysticworld.entity; -import java.util.List; - import mysticworld.MysticWorld; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class EntityChargeWater extends Entity { - public EntityPlayer shootingEntity; - private int ticksInAir = 0; +public class EntityChargeWater extends EntityCharge { public EntityChargeWater(World par1World) { super(par1World); } public EntityChargeWater(World par1World, EntityPlayer par2EntityPlayer) { - super(par1World); - this.setSize(0.25F, 0.25F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI)); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.shootingEntity = par2EntityPlayer; + super(par1World,par2EntityPlayer); } @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public float getBrightness(float par1) { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float par1) { - return 15728880; - } - - @Override - public float getCollisionBorderSize() { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - @Override - public void onUpdate() { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { - this.setDead(); - } else { - super.onUpdate(); - Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, true, true, false); - vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) { - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - if (movingobjectposition != null) { - this.onImpact(movingobjectposition); - } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f2 = this.getMotionFactor(); - if (this.isInWater()) { - for (int k = 0; k < 4; ++k) { - float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); - } - f2 = 0.8F; - } - MysticWorld.proxy.waterFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); - this.setPosition(this.posX, this.posY, this.posZ); - } - } - - @Override - protected void entityInit() { - } - - protected float getMotionFactor() { - return 0.95F; + public void chargeFX() { + MysticWorld.proxy.waterFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F); } + @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (!this.worldObj.isRemote) { this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); if (par1MovingObjectPosition.entityHit != null) { double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f3 > 0.0F) { - par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3); + par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 0.6000000238418579D / f3, 0.1D, this.motionZ * 0.6000000238418579D / f3); } if (par1MovingObjectPosition.entityHit.isImmuneToFire()) { par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20); @@ -137,8 +36,8 @@ public class EntityChargeWater extends Entity { if (par1MovingObjectPosition.entityHit.isBurning()) { par1MovingObjectPosition.entityHit.extinguish(); } - } else { - int i = par1MovingObjectPosition.blockX; + }/* else { + /*int i = par1MovingObjectPosition.blockX; int j = par1MovingObjectPosition.blockY; int k = par1MovingObjectPosition.blockZ; switch (par1MovingObjectPosition.sideHit) { @@ -160,22 +59,8 @@ public class EntityChargeWater extends Entity { case 5: ++i; } - } + }*/ this.setDead(); } } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double par1){ - return par1 > 1.0D && super.isInRangeToRenderDist(par1); - } }