private void spawnDragon() { this.world.getChunkFromBlockCoords(new BlockPos(0, 128, 0)); EntityDragon entitydragon = new EntityDragon(this.world); entitydragon.getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN); entitydragon.setLocationAndAngles(0.0D, 128.0D, 0.0D, this.world.rand.nextFloat() * 360.0F, 0.0F); this.world.spawnEntityInWorld(entitydragon); this.dragonUniqueId = entitydragon.getUniqueID(); }
/** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if (compound.hasKey("DragonPhase")) { this.phaseManager.setPhase(PhaseList.getById(compound.getInteger("DragonPhase"))); } }
public float getHeadPartYOffset(int p_184667_1_, double[] p_184667_2_, double[] p_184667_3_) { IPhase iphase = this.phaseManager.getCurrentPhase(); PhaseList <? extends IPhase > phaselist = iphase.getPhaseList(); double d0; if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF) { if (iphase.getIsStationary()) { d0 = (double)p_184667_1_; } else if (p_184667_1_ == 6) { d0 = 0.0D; } else { d0 = p_184667_3_[1] - p_184667_2_[1]; } } else { BlockPos blockpos = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION); float f = Math.max(MathHelper.sqrt(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F); d0 = (double)((float)p_184667_1_ / f); } return (float)d0; }
public Vec3d getHeadLookVec(float p_184665_1_) { IPhase iphase = this.phaseManager.getCurrentPhase(); PhaseList <? extends IPhase > phaselist = iphase.getPhaseList(); Vec3d vec3d; if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF) { if (iphase.getIsStationary()) { float f4 = this.rotationPitch; float f5 = 1.5F; this.rotationPitch = -45.0F; vec3d = this.getLook(p_184665_1_); this.rotationPitch = f4; } else { vec3d = this.getLook(p_184665_1_); } } else { BlockPos blockpos = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION); float f = Math.max(MathHelper.sqrt(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F); float f1 = 6.0F / f; float f2 = this.rotationPitch; float f3 = 1.5F; this.rotationPitch = -f1 * 1.5F * 5.0F; vec3d = this.getLook(p_184665_1_); this.rotationPitch = f2; } return vec3d; }
public void notifyDataManagerChange(DataParameter<?> key) { if (PHASE.equals(key) && this.world.isRemote) { this.phaseManager.setPhase(PhaseList.getById(((Integer)this.getDataManager().get(PHASE)).intValue())); } super.notifyDataManagerChange(key); }
@SideOnly(Side.CLIENT) public float getHeadPartYOffset(int p_184667_1_, double[] p_184667_2_, double[] p_184667_3_) { IPhase iphase = this.phaseManager.getCurrentPhase(); PhaseList <? extends IPhase > phaselist = iphase.getPhaseList(); double d0; if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF) { if (iphase.getIsStationary()) { d0 = (double)p_184667_1_; } else if (p_184667_1_ == 6) { d0 = 0.0D; } else { d0 = p_184667_3_[1] - p_184667_2_[1]; } } else { BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION); float f = Math.max(MathHelper.sqrt_double(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F); d0 = (double)((float)p_184667_1_ / f); } return (float)d0; }
public Vec3d getHeadLookVec(float p_184665_1_) { IPhase iphase = this.phaseManager.getCurrentPhase(); PhaseList <? extends IPhase > phaselist = iphase.getPhaseList(); Vec3d vec3d; if (phaselist != PhaseList.LANDING && phaselist != PhaseList.TAKEOFF) { if (iphase.getIsStationary()) { float f4 = this.rotationPitch; float f5 = 1.5F; this.rotationPitch = -45.0F; vec3d = this.getLook(p_184665_1_); this.rotationPitch = f4; } else { vec3d = this.getLook(p_184665_1_); } } else { BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION); float f = Math.max(MathHelper.sqrt_double(this.getDistanceSqToCenter(blockpos)) / 4.0F, 1.0F); float f1 = 6.0F / f; float f2 = this.rotationPitch; float f3 = 1.5F; this.rotationPitch = -f1 * 1.5F * 5.0F; vec3d = this.getLook(p_184665_1_); this.rotationPitch = f2; } return vec3d; }
public void notifyDataManagerChange(DataParameter<?> key) { if (PHASE.equals(key) && this.worldObj.isRemote) { this.phaseManager.setPhase(PhaseList.getById(((Integer)this.getDataManager().get(PHASE)).intValue())); } super.notifyDataManagerChange(key); }
protected void entityInit() { super.entityInit(); this.getDataManager().register(PHASE, Integer.valueOf(PhaseList.HOVER.getId())); }
public boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float damage) { damage = this.phaseManager.getCurrentPhase().getAdjustedDamage(dragonPart, source, damage); if (dragonPart != this.dragonPartHead) { damage = damage / 4.0F + Math.min(damage, 1.0F); } if (damage < 0.01F) { return false; } else { if (source.getEntity() instanceof EntityPlayer || source.isExplosion()) { float f = this.getHealth(); this.attackDragonFrom(source, damage); if (this.getHealth() <= 0.0F && !this.phaseManager.getCurrentPhase().getIsStationary()) { this.setHealth(1.0F); this.phaseManager.setPhase(PhaseList.DYING); } if (this.phaseManager.getCurrentPhase().getIsStationary()) { this.sittingDamageReceived = (int)((float)this.sittingDamageReceived + (f - this.getHealth())); if ((float)this.sittingDamageReceived > 0.25F * this.getMaxHealth()) { this.sittingDamageReceived = 0; this.phaseManager.setPhase(PhaseList.TAKEOFF); } } } return true; } }