From 910857d700cce0d5d69fd3f8a068cac4dab9e832 Mon Sep 17 00:00:00 2001 From: Kino Date: Tue, 21 Mar 2017 14:05:42 -0400 Subject: [PATCH] Sun Spirit improvements --- .../models/entities/SunSpiritModel.java | 37 ++---- .../bosses/sun_spirit/EntitySunSpirit.java | 111 ++++++++---------- 2 files changed, 58 insertions(+), 90 deletions(-) diff --git a/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java b/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java index 886b635..26eea6d 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java @@ -90,6 +90,7 @@ public class SunSpiritModel extends ModelBiped @Override public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (entityIn instanceof EntitySunSpirit) @@ -126,36 +127,11 @@ public class SunSpiritModel extends ModelBiped this.bipedHead.rotateAngleX = headPitch / 57.29578F; this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; - this.bipedRightArm.rotateAngleX = 0.0F; - this.bipedLeftArm.rotateAngleX = 0.0F; - this.bipedRightArm.rotateAngleZ = 0.0F; - this.bipedLeftArm.rotateAngleZ = 0.0F; - this.bipedRightArm.rotateAngleY = 0.0F; - this.bipedLeftArm.rotateAngleY = 0.0F; - - if(this.swingProgress > -9990F) - { - float f6 = this.swingProgress; - this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * 3.141593F * 2.0F) * 0.2F; - this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; - this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; - this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; - f6 = 1.0F - this.swingProgress; - f6 *= f6; - f6 *= f6; - f6 = 1.0F - f6; - float f7 = MathHelper.sin(f6 * 3.141593F); - float f8 = MathHelper.sin(this.swingProgress * 3.141593F) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; - this.bipedRightArm.rotateAngleX -= (double)f7 * 1.2D + (double)f8; - this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; - this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.swingProgress * 3.141593F) * -0.4F; - } - - //this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; - //this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; - //this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; - //this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; this.bipedBody4.rotateAngleX = this.bipedBody3.rotateAngleX = this.bipedBody2.rotateAngleX = this.bipedBody.rotateAngleX; this.bipedBody4.rotateAngleY = this.bipedBody3.rotateAngleY = this.bipedBody2.rotateAngleY = this.bipedBody.rotateAngleY; @@ -167,6 +143,9 @@ public class SunSpiritModel extends ModelBiped this.bipedRightArm3.rotateAngleX = this.bipedRightArm2.rotateAngleX = this.bipedRightArm.rotateAngleX; this.bipedRightArm3.rotateAngleY = this.bipedRightArm2.rotateAngleY = this.bipedRightArm.rotateAngleY; this.bipedRightArm3.rotateAngleZ = this.bipedRightArm2.rotateAngleZ = this.bipedRightArm.rotateAngleZ; + + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleY = this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleZ = this.bipedLeftArm.rotateAngleY = 0.0F; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/server/entities/bosses/sun_spirit/EntitySunSpirit.java b/src/main/java/com/legacy/aether/server/entities/bosses/sun_spirit/EntitySunSpirit.java index 5219117..3033649 100644 --- a/src/main/java/com/legacy/aether/server/entities/bosses/sun_spirit/EntitySunSpirit.java +++ b/src/main/java/com/legacy/aether/server/entities/bosses/sun_spirit/EntitySunSpirit.java @@ -159,32 +159,50 @@ public class EntitySunSpirit extends EntityFlying implements IMob super.onUpdate(); this.velocity = 0.5D - (double)this.getHealth() / 70.0D * 0.2D; - this.width = 2F; - this.height = 2F; + this.width = this.height = 2.0F; - if(this.getAttackTarget() != null && this.getAttackTarget() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)this.getAttackTarget(); - PlayerAether playerAether = PlayerAether.get(player); - - if (playerAether != null) - { - if (!player.isDead) - { - playerAether.setCurrentBoss(this); - } - } - } - - if (this.hurtTime > 0) + if (this.getAttackTarget() instanceof EntityPlayer) { - this.setFreezing(true); - } - else - { - this.setFreezing(false); + EntityPlayer player = (EntityPlayer) this.getAttackTarget(); + PlayerAether playerAether = PlayerAether.get(player); + + if (player.isDead) + { + this.setPosition((double)this.originPointX + 0.5D, (double)this.originPointY, (double)this.originPointZ + 0.5D); + + this.chatLog = 10; + + this.motionX = this.motionY = this.motionZ = 0.0D; + + this.chatLine(player, "\u00a7cSuch is the fate of a being who opposes the might of the sun."); + this.chatCount = 100; + + this.setPosition((double)this.originPointX + 0.5D, (double)this.originPointY, (double)this.originPointZ + 0.5D); + this.setDoor(Blocks.AIR.getDefaultState()); + + this.setFreezing(false); + this.setAttackTarget(null); + this.setHealth(this.getMaxHealth()); + } + else + { + playerAether.setCurrentBoss(this); + } + + if (this.isDead()) + { + this.chatLine(player, "\u00a7bSuch bitter cold... is this the feeling... of pain?"); + this.chatCount = 100; + + player.addStat(AchievementsAether.defeat_gold); + + this.setDoor(Blocks.AIR.getDefaultState()); + this.unlockTreasure(); + } } + this.setFreezing(this.hurtTime > 0); + if (this.getHealth() > 0) { double xCoord = this.posX + (this.rand.nextFloat() - 0.5F) * this.rand.nextFloat(); @@ -197,48 +215,13 @@ public class EntitySunSpirit extends EntityFlying implements IMob this.evapWater(); } - if (this.isDead()) - { - if (this.getAttackTarget() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)this.getAttackTarget(); - - this.chatLine(player, "\u00a7bSuch bitter cold... is this the feeling... of pain?"); - this.chatCount = 100; - - player.addStat(AchievementsAether.defeat_gold); - } - - this.setDoor(Blocks.AIR.getDefaultState()); - this.unlockTreasure(); - } - - if (this.getAttackTarget() != null && this.getAttackTarget().isDead && this.getAttackTarget() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)this.getAttackTarget(); - - this.setPosition((double)this.originPointX + 0.5D, (double)this.originPointY, (double)this.originPointZ + 0.5D); - - this.chatLog = 10; - - this.motionX = this.motionY = this.motionZ = 0.0D; - - this.chatLine(player, "\u00a7cSuch is the fate of a being who opposes the might of the sun."); - this.chatCount = 100; - - this.setDoor(Blocks.AIR.getDefaultState()); - - this.setFreezing(false); - this.setAttackTarget(null); - this.setHealth(this.getMaxHealth()); - } - if (this.chatCount > 0) { --this.chatCount; } } + @Override public void updateAITasks() { super.updateAITasks(); @@ -534,7 +517,7 @@ public class EntitySunSpirit extends EntityFlying implements IMob @Override public boolean attackEntityFrom(DamageSource source, float amount) { - if (source.getEntity() != null && source.getEntity() instanceof EntityIceyBall) + if (source.getEntity() instanceof EntityIceyBall) { this.velocity = 0.5D - (double)this.getHealth() / 70.0D * 0.2D; boolean flag = super.attackEntityFrom(source, amount); @@ -593,7 +576,10 @@ public class EntitySunSpirit extends EntityFlying implements IMob { for (z = this.originPointZ - 1; z < this.originPointZ + 2; ++z) { - this.worldObj.setBlockState(new BlockPos(this.originPointX + (this.direction == 0 ? -11 : 11), y, z), block, 2); + BlockPos pos = new BlockPos(this.originPointX + (this.direction == 0 ? -11 : 11), y, z); + + if (this.worldObj.getBlockState(pos).getBlock() != block.getBlock()) + this.worldObj.setBlockState(pos, block, 2); } } } @@ -603,7 +589,10 @@ public class EntitySunSpirit extends EntityFlying implements IMob { for (x = this.originPointX - 1; x < this.originPointX + 2; ++x) { - this.worldObj.setBlockState(new BlockPos(x, y, this.originPointZ + (this.direction == 3 ? 11 : -11)), block, 2); + BlockPos pos = new BlockPos(x, y, this.originPointZ + (this.direction == 3 ? 11 : -11)); + + if (this.worldObj.getBlockState(pos).getBlock() != block.getBlock()) + this.worldObj.setBlockState(pos, block, 2); } } }