// Returns true if the entity's head is in inside the quicksand. public static boolean headInQuicksand(World world, int x, int y, int z, Entity entity) { x = MathHelper.floor_double(entity.posX); int headY = MathHelper.floor_double(entity.posY + entity.getEyeHeight()); z = MathHelper.floor_double(entity.posZ); if (world.getBlock(x, headY, z) != BlockQuickSand.instance) { return false; } return entity.posY + entity.getEyeHeight() < y + getQuicksandBlockLevel(world, x, y, z); }
private void aimAtTarget() { if (target == null) return; int bowCharge = Minecraft.getMinecraft().thePlayer.getItemInUseDuration(); velocity = bowCharge / 20; velocity = (velocity * velocity + velocity * 2) / 3; if (WurstClient.INSTANCE.mods.fastBowMod.isActive()) velocity = 1; if (velocity < 0.1) { if (target instanceof EntityLivingBase) EntityUtils.faceEntityClient((EntityLivingBase) target); return; } if (velocity > 1) velocity = 1; double posX = target.posX + (target.posX - target.prevPosX) * 5 - Minecraft.getMinecraft().thePlayer.posX; double posY = target.posY + (target.posY - target.prevPosY) * 5 + target.getEyeHeight() - 0.15 - Minecraft.getMinecraft().thePlayer.posY - Minecraft.getMinecraft().thePlayer.getEyeHeight(); double posZ = target.posZ + (target.posZ - target.prevPosZ) * 5 - Minecraft.getMinecraft().thePlayer.posZ; float yaw = (float) (Math.atan2(posZ, posX) * 180 / Math.PI) - 90; double y2 = Math.sqrt(posX * posX + posZ * posZ); float g = 0.006F; float tmp = (float) (velocity * velocity * velocity * velocity - g * (g * (y2 * y2) + 2 * posY * (velocity * velocity))); float pitch = (float) -Math.toDegrees(Math.atan((velocity * velocity - Math.sqrt(tmp)) / (g * y2))); Minecraft.getMinecraft().thePlayer.rotationYaw = yaw; Minecraft.getMinecraft().thePlayer.rotationPitch = pitch; }
@Override public Optional<EyeLocationData> from(DataHolder dataHolder) { if (supports(dataHolder)) { final Entity entity = (Entity) dataHolder; return Optional.<EyeLocationData>of( new SpongeEyeLocationData( VecHelper.toVector(entity.getPositionVector()), entity.getEyeHeight())); } return Optional.absent(); }
/** Sets position to look at using entity */ public void setLookPositionWithEntity(Entity p_75651_1_, float p_75651_2_, float p_75651_3_) { this.posX = p_75651_1_.posX; if (p_75651_1_ instanceof EntityLivingBase) { this.posY = p_75651_1_.posY + (double) p_75651_1_.getEyeHeight(); } else { this.posY = (p_75651_1_.getEntityBoundingBox().minY + p_75651_1_.getEntityBoundingBox().maxY) / 2.0D; } this.posZ = p_75651_1_.posZ; this.deltaLookYaw = p_75651_2_; this.deltaLookPitch = p_75651_3_; this.isLooking = true; }
private boolean teleportToEntity(EntityLivingBase mob, Entity par1Entity) { Vec3 vector = Vec3.createVectorHelper( mob.posX - par1Entity.posX, mob.boundingBox.minY + (double) (mob.height / 2.0F) - par1Entity.posY + (double) par1Entity.getEyeHeight(), mob.posZ - par1Entity.posZ); vector = vector.normalize(); double telDist = 16.0D; double destX = mob.posX + (mob.worldObj.rand.nextDouble() - 0.5D) * 8.0D - vector.xCoord * telDist; double destY = mob.posY + (double) (mob.worldObj.rand.nextInt(16) - 8) - vector.yCoord * telDist; double destZ = mob.posZ + (mob.worldObj.rand.nextDouble() - 0.5D) * 8.0D - vector.zCoord * telDist; return teleportTo(mob, destX, destY, destZ); }
@Override public void onEntityUpdate() { super.onEntityUpdate(); if (ticksExisted >= 100) { this.setDead(); } if (!worldObj.isRemote) { if (isHoming && target != null) { double d0 = target.posX - this.posX; double d1 = target.posY + (double) target.getEyeHeight() - this.posY; double d2 = target.posZ - this.posZ; this.setThrowableHeading(d0, d1, d2, speed, 0.0F); speed = speed + 0.06F; } else if (isHoming && target == null) { this.setDead(); } } }
public static boolean isInsideOfFluid(Entity entity, Fluid fluid) { double d0 = entity.posY + entity.getEyeHeight(); int i = MathHelper.floor_double(entity.posX); int j = MathHelper.floor_float(MathHelper.floor_double(d0)); int k = MathHelper.floor_double(entity.posZ); Block block = entity.worldObj.getBlock(i, j, k); if (block != null && block instanceof IFluidBlock && ((IFluidBlock) block).getFluid() != null && ((IFluidBlock) block).getFluid().getName().equals(fluid.getName())) { double filled = ((IFluidBlock) block).getFilledPercentage(entity.worldObj, i, j, k); if (filled < 0) { filled *= -1; return d0 > j + (1 - filled); } else { return d0 < j + filled; } } else { return false; } }
@SuppressWarnings({"rawtypes", "unchecked"}) public void doExplosionA() { float f = this.explosionSize; int i; int j; int k; double d0; double d1; double d2; for (i = 0; i < this.field_77289_h; ++i) { for (j = 0; j < this.field_77289_h; ++j) { for (k = 0; k < this.field_77289_h; ++k) { if (i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1) { double d3 = i / (this.field_77289_h - 1.0F) * 2.0F - 1.0F; double d4 = j / (this.field_77289_h - 1.0F) * 2.0F - 1.0F; double d5 = k / (this.field_77289_h - 1.0F) * 2.0F - 1.0F; double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5); d3 /= d6; d4 /= d6; d5 /= d6; float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); d0 = this.explosionX; d1 = this.explosionY; d2 = this.explosionZ; for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) { d0 += d3 * f2; d1 += d4 * f2; d2 += d5 * f2; } } } } } this.explosionSize *= 2.0F; i = MathHelper.floor_double(this.explosionX - this.explosionSize - 1.0D); j = MathHelper.floor_double(this.explosionX + this.explosionSize + 1.0D); k = MathHelper.floor_double(this.explosionY - this.explosionSize - 1.0D); int l1 = MathHelper.floor_double(this.explosionY + this.explosionSize + 1.0D); int i2 = MathHelper.floor_double(this.explosionZ - this.explosionSize - 1.0D); int j2 = MathHelper.floor_double(this.explosionZ + this.explosionSize + 1.0D); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( this.exploder, AxisAlignedBB.getBoundingBox(i, k, i2, j, l1, j2)); Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); for (int k2 = 0; k2 < list.size(); ++k2) { Entity entity = (Entity) list.get(k2); double d7 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / this.explosionSize; if (d7 <= 1.0D) { d0 = entity.posX - this.explosionX; d1 = entity.posY + entity.getEyeHeight() - this.explosionY; d2 = entity.posZ - this.explosionZ; double d8 = MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2); if (d8 != 0.0D) { d0 /= d8; d1 /= d8; d2 /= d8; double d9 = this.worldObj.getBlockDensity(vec3, entity.boundingBox); double d10 = (1.0D - d7) * d9; double d11 = EnchantmentProtection.func_92092_a(entity, d10); entity.attackEntityFrom(DamageSource.generic, 0.0001F); entity.motionX += (d0 * d11); entity.motionY += (d1 * d11) * explosionPower; entity.motionZ += (d2 * d11); if (entity instanceof EntityPlayer) this.field_77288_k.put(entity, Vec3.createVectorHelper(d0 * d10, d1 * d10, d2 * d10)); } } } this.explosionSize = f; }
@Override public void setupTerrain( final Entity viewEntity, final double partialTicks, final ICamera camera, final int frameCount, final boolean playerSpectator) { if (ConfigurationHandler.renderDistance != this.renderDistanceChunks || this.vboEnabled != OpenGlHelper.useVbo()) { loadRenderers(); } this.profiler.startSection("camera"); final double posX = PLAYER_POSITION_OFFSET.x; final double posY = PLAYER_POSITION_OFFSET.y; final double posZ = PLAYER_POSITION_OFFSET.z; final double deltaX = posX - this.frustumUpdatePosX; final double deltaY = posY - this.frustumUpdatePosY; final double deltaZ = posZ - this.frustumUpdatePosZ; final int chunkCoordX = MathHelper.floor_double(posX) >> 4; final int chunkCoordY = MathHelper.floor_double(posY) >> 4; final int chunkCoordZ = MathHelper.floor_double(posZ) >> 4; if (this.frustumUpdatePosChunkX != chunkCoordX || this.frustumUpdatePosChunkY != chunkCoordY || this.frustumUpdatePosChunkZ != chunkCoordZ || deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 16.0) { this.frustumUpdatePosX = posX; this.frustumUpdatePosY = posY; this.frustumUpdatePosZ = posZ; this.frustumUpdatePosChunkX = chunkCoordX; this.frustumUpdatePosChunkY = chunkCoordY; this.frustumUpdatePosChunkZ = chunkCoordZ; this.viewFrustum.updateChunkPositions(posX, posZ); } this.profiler.endStartSection("renderlistcamera"); this.renderContainer.initialize(posX, posY, posZ); this.profiler.endStartSection("culling"); final BlockPos posEye = new BlockPos(posX, posY + viewEntity.getEyeHeight(), posZ); final RenderChunk renderchunk = this.viewFrustum.getRenderChunk(posEye); final RenderOverlay renderoverlay = this.viewFrustum.getRenderOverlay(posEye); this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || posX != this.lastViewEntityX || posY != this.lastViewEntityY || posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw; this.lastViewEntityX = posX; this.lastViewEntityY = posY; this.lastViewEntityZ = posZ; this.lastViewEntityPitch = viewEntity.rotationPitch; this.lastViewEntityYaw = viewEntity.rotationYaw; if (this.displayListEntitiesDirty) { this.displayListEntitiesDirty = false; this.renderInfos = Lists.newArrayListWithCapacity(CHUNKS); final LinkedList<ContainerLocalRenderInformation> renderInfoList = Lists.newLinkedList(); boolean renderChunksMany = this.mc.renderChunksMany; if (renderchunk == null) { final int chunkY = posEye.getY() > 0 ? 248 : 8; for (int chunkX = -this.renderDistanceChunks; chunkX <= this.renderDistanceChunks; chunkX++) { for (int chunkZ = -this.renderDistanceChunks; chunkZ <= this.renderDistanceChunks; chunkZ++) { final BlockPos pos = new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8); final RenderChunk renderChunk = this.viewFrustum.getRenderChunk(pos); final RenderOverlay renderOverlay = this.viewFrustum.getRenderOverlay(pos); if (renderChunk != null && camera.isBoundingBoxInFrustum(renderChunk.boundingBox)) { renderChunk.setFrameIndex(frameCount); renderOverlay.setFrameIndex(frameCount); renderInfoList.add( new ContainerLocalRenderInformation(renderChunk, renderOverlay, null, 0)); } } } } else { boolean add = false; final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, renderoverlay, null, 0); final Set<EnumFacing> visibleSides = getVisibleSides(posEye); if (!visibleSides.isEmpty() && visibleSides.size() == 1) { final Vector3f viewVector = getViewVector(viewEntity, partialTicks); final EnumFacing facing = EnumFacing.getFacingFromVector(viewVector.x, viewVector.y, viewVector.z) .getOpposite(); visibleSides.remove(facing); } if (visibleSides.isEmpty()) { add = true; } if (add && !playerSpectator) { this.renderInfos.add(renderInfo); } else { if (playerSpectator && this.world.getBlockState(posEye).getBlock().isOpaqueCube()) { renderChunksMany = false; } renderchunk.setFrameIndex(frameCount); renderoverlay.setFrameIndex(frameCount); renderInfoList.add(renderInfo); } } while (!renderInfoList.isEmpty()) { final ContainerLocalRenderInformation renderInfo = renderInfoList.poll(); final RenderChunk renderChunk = renderInfo.renderChunk; final EnumFacing facing = renderInfo.facing; final BlockPos posChunk = renderChunk.getPosition(); this.renderInfos.add(renderInfo); for (final EnumFacing side : EnumFacing.VALUES) { final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, posChunk, side); final RenderOverlay neighborRenderOverlay = getNeighborRenderOverlay(posEye, posChunk, side); if ((!renderChunksMany || !renderInfo.setFacing.contains(side.getOpposite())) && (!renderChunksMany || facing == null || renderChunk.getCompiledChunk().isVisible(facing.getOpposite(), side)) && neighborRenderChunk != null && neighborRenderChunk.setFrameIndex(frameCount) && camera.isBoundingBoxInFrustum(neighborRenderChunk.boundingBox)) { final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation( neighborRenderChunk, neighborRenderOverlay, side, renderInfo.counter + 1); renderInfoNext.setFacing.addAll(renderInfo.setFacing); renderInfoNext.setFacing.add(side); renderInfoList.add(renderInfoNext); } } } } this.renderDispatcher.clearChunkUpdates(); this.renderDispatcherOverlay.clearChunkUpdates(); final Set<RenderChunk> set = this.chunksToUpdate; final Set<RenderOverlay> set1 = this.overlaysToUpdate; this.chunksToUpdate = Sets.newLinkedHashSet(); for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { final RenderChunk renderChunk = renderInfo.renderChunk; final RenderOverlay renderOverlay = renderInfo.renderOverlay; if (renderChunk.isNeedsUpdate() || renderChunk.isCompileTaskPending() || set.contains(renderChunk)) { this.displayListEntitiesDirty = true; this.chunksToUpdate.add(renderChunk); } if (renderOverlay.isNeedsUpdate() || renderOverlay.isCompileTaskPending() || set1.contains(renderOverlay)) { this.displayListEntitiesDirty = true; this.overlaysToUpdate.add(renderOverlay); } } this.chunksToUpdate.addAll(set); this.overlaysToUpdate.addAll(set1); this.profiler.endSection(); }
/** * Teleport the enderman to another entity */ protected boolean teleportToEntity(Entity p_70816_1_) { Vec3 vec3 = new Vec3(this.posX - p_70816_1_.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - p_70816_1_.posY + (double)p_70816_1_.getEyeHeight(), this.posZ - p_70816_1_.posZ); vec3 = vec3.normalize(); double d0 = 16.0D; double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.xCoord * d0; double d2 = this.posY + (double)(this.rand.nextInt(16) - 8) - vec3.yCoord * d0; double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.zCoord * d0; return this.teleportTo(d1, d2, d3); }
/** Does the first part of the explosion (destroy blocks) */ @Override public void doExplosionA() { float var1 = explosionSize; int var3; int var4; int var5; double var15; double var17; double var19; for (var3 = 0; var3 < field_77289_h; ++var3) { for (var4 = 0; var4 < field_77289_h; ++var4) { for (var5 = 0; var5 < field_77289_h; ++var5) { if (var3 == 0 || var3 == field_77289_h - 1 || var4 == 0 || var4 == field_77289_h - 1 || var5 == 0 || var5 == field_77289_h - 1) { double var6 = var3 / (field_77289_h - 1.0F) * 2.0F - 1.0F; double var8 = var4 / (field_77289_h - 1.0F) * 2.0F - 1.0F; double var10 = var5 / (field_77289_h - 1.0F) * 2.0F - 1.0F; double var12 = Math.sqrt(var6 * var6 + var8 * var8 + var10 * var10); var6 /= var12; var8 /= var12; var10 /= var12; var15 = explosionX; var17 = explosionY; var19 = explosionZ; } } } } explosionSize *= 2.0F; var3 = MathHelper.floor_double(explosionX - explosionSize - 1.0D); var4 = MathHelper.floor_double(explosionX + explosionSize + 1.0D); var5 = MathHelper.floor_double(explosionY - explosionSize - 1.0D); int var28 = MathHelper.floor_double(explosionY + explosionSize + 1.0D); int var7 = MathHelper.floor_double(explosionZ - explosionSize - 1.0D); int var29 = MathHelper.floor_double(explosionZ + explosionSize + 1.0D); List var9 = worldObj.getEntitiesWithinAABBExcludingEntity( exploder, AxisAlignedBB.getBoundingBox(var3, var5, var7, var4, var28, var29)); Vec3 var30 = Vec3.createVectorHelper(explosionX, explosionY, explosionZ); for (int var11 = 0; var11 < var9.size(); ++var11) { Entity var31 = (Entity) var9.get(var11); if (!(var31 instanceof EntityLiving)) { continue; } if (var31 == shootingEntity && !hurtsPlayer) { continue; } double var13 = var31.getDistance(explosionX, explosionY, explosionZ) / explosionSize; if (var13 <= 1.0D) { var15 = var31.posX - explosionX; var17 = var31.posY + var31.getEyeHeight() - explosionY; var19 = var31.posZ - explosionZ; double var33 = MathHelper.sqrt_double(var15 * var15 + var17 * var17 + var19 * var19); if (var33 != 0.0D) { var15 /= var33; var17 /= var33; var19 /= var33; double var32 = worldObj.getBlockDensity(var30, var31.boundingBox); double var34 = (1.0D - var13) * var32; var31.attackEntityFrom( DamageSource.causePlayerDamage(shootingEntity), (int) ((var34 * var34 + var34) * 6.0D * (explosionSize * 2) + 3.0D)); var31.motionX += var15 * var34; var31.motionY += var17 * var34; var31.motionZ += var19 * var34; if (var31 instanceof EntityPlayer) { field_77288_k.put( var31, Vec3.createVectorHelper(var15 * var34, var17 * var34, var19 * var34)); } } } } explosionSize = var1; }
public static Vector getEyePos(Entity entity) { Vector pos = getEntityPos(entity); pos.setY(pos.y() + entity.getEyeHeight()); return pos; }
/** Does the first part of the explosion (destroy blocks) */ public void doExplosionA() { HashSet var1 = Sets.newHashSet(); boolean var2 = true; int var4; int var5; for (int var3 = 0; var3 < 16; ++var3) { for (var4 = 0; var4 < 16; ++var4) { for (var5 = 0; var5 < 16; ++var5) { if (var3 == 0 || var3 == 15 || var4 == 0 || var4 == 15 || var5 == 0 || var5 == 15) { double var6 = (double) ((float) var3 / 15.0F * 2.0F - 1.0F); double var8 = (double) ((float) var4 / 15.0F * 2.0F - 1.0F); double var10 = (double) ((float) var5 / 15.0F * 2.0F - 1.0F); double var12 = Math.sqrt(var6 * var6 + var8 * var8 + var10 * var10); var6 /= var12; var8 /= var12; var10 /= var12; float var14 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); double var15 = this.explosionX; double var17 = this.explosionY; double var19 = this.explosionZ; for (float var21 = 0.3F; var14 > 0.0F; var14 -= 0.22500001F) { BlockPos var22 = new BlockPos(var15, var17, var19); IBlockState var23 = this.worldObj.getBlockState(var22); if (var23.getBlock().getMaterial() != Material.air) { float var24 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, var22, var23) : var23.getBlock().getExplosionResistance((Entity) null); var14 -= (var24 + 0.3F) * 0.3F; } if (var14 > 0.0F && (this.exploder == null || this.exploder.func_174816_a(this, this.worldObj, var22, var23, var14))) { var1.add(var22); } var15 += var6 * 0.30000001192092896D; var17 += var8 * 0.30000001192092896D; var19 += var10 * 0.30000001192092896D; } } } } } this.affectedBlockPositions.addAll(var1); float var30 = this.explosionSize * 2.0F; var4 = MathHelper.floor_double(this.explosionX - (double) var30 - 1.0D); var5 = MathHelper.floor_double(this.explosionX + (double) var30 + 1.0D); int var31 = MathHelper.floor_double(this.explosionY - (double) var30 - 1.0D); int var7 = MathHelper.floor_double(this.explosionY + (double) var30 + 1.0D); int var32 = MathHelper.floor_double(this.explosionZ - (double) var30 - 1.0D); int var9 = MathHelper.floor_double(this.explosionZ + (double) var30 + 1.0D); List var33 = this.worldObj.getEntitiesWithinAABBExcludingEntity( this.exploder, new AxisAlignedBB( (double) var4, (double) var31, (double) var32, (double) var5, (double) var7, (double) var9)); Vec3 var11 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); for (int var34 = 0; var34 < var33.size(); ++var34) { Entity var13 = (Entity) var33.get(var34); if (!var13.func_180427_aV()) { double var35 = var13.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) var30; if (var35 <= 1.0D) { double var16 = var13.posX - this.explosionX; double var18 = var13.posY + (double) var13.getEyeHeight() - this.explosionY; double var20 = var13.posZ - this.explosionZ; double var36 = (double) MathHelper.sqrt_double(var16 * var16 + var18 * var18 + var20 * var20); if (var36 != 0.0D) { var16 /= var36; var18 /= var36; var20 /= var36; double var37 = (double) this.worldObj.getBlockDensity(var11, var13.getEntityBoundingBox()); double var26 = (1.0D - var35) * var37; var13.attackEntityFrom( DamageSource.setExplosionSource(this), (float) ((int) ((var26 * var26 + var26) / 2.0D * 8.0D * (double) var30 + 1.0D))); double var28 = EnchantmentProtection.func_92092_a(var13, var26); var13.motionX += var16 * var28; var13.motionY += var18 * var28; var13.motionZ += var20 * var28; if (var13 instanceof EntityPlayer) { this.field_77288_k.put( (EntityPlayer) var13, new Vec3(var16 * var26, var18 * var26, var20 * var26)); } } } } } }
/** * 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. */ public void onLivingUpdate() { this.motionY *= 0.6000000238418579D; double d1; double d3; double d5; if (!this.worldObj.isRemote && this.getWatchedTargetId(0) > 0) { Entity entity = this.worldObj.getEntityByID(this.getWatchedTargetId(0)); if (entity != null) { if (this.posY < entity.posY || !this.isArmored() && this.posY < entity.posY + 5.0D) { if (this.motionY < 0.0D) { this.motionY = 0.0D; } this.motionY += (0.5D - this.motionY) * 0.6000000238418579D; } double d0 = entity.posX - this.posX; d1 = entity.posZ - this.posZ; d3 = d0 * d0 + d1 * d1; if (d3 > 9.0D) { d5 = (double) MathHelper.sqrt_double(d3); this.motionX += (d0 / d5 * 0.5D - this.motionX) * 0.6000000238418579D; this.motionZ += (d1 / d5 * 0.5D - this.motionZ) * 0.6000000238418579D; } } } if (this.motionX * this.motionX + this.motionZ * this.motionZ > 0.05000000074505806D) { this.rotationYaw = (float) Math.atan2(this.motionZ, this.motionX) * (180F / (float) Math.PI) - 90.0F; } super.onLivingUpdate(); int i; for (i = 0; i < 2; ++i) { this.field_82218_g[i] = this.field_82221_e[i]; this.field_82217_f[i] = this.field_82220_d[i]; } int j; for (i = 0; i < 2; ++i) { j = this.getWatchedTargetId(i + 1); Entity entity1 = null; if (j > 0) { entity1 = this.worldObj.getEntityByID(j); } if (entity1 != null) { d1 = this.func_82214_u(i + 1); d3 = this.func_82208_v(i + 1); d5 = this.func_82213_w(i + 1); double d6 = entity1.posX - d1; double d7 = entity1.posY + (double) entity1.getEyeHeight() - d3; double d8 = entity1.posZ - d5; double d9 = (double) MathHelper.sqrt_double(d6 * d6 + d8 * d8); float f = (float) (Math.atan2(d8, d6) * 180.0D / Math.PI) - 90.0F; float f1 = (float) (-(Math.atan2(d7, d9) * 180.0D / Math.PI)); this.field_82220_d[i] = this.func_82204_b(this.field_82220_d[i], f1, 40.0F); this.field_82221_e[i] = this.func_82204_b(this.field_82221_e[i], f, 10.0F); } else { this.field_82221_e[i] = this.func_82204_b(this.field_82221_e[i], this.renderYawOffset, 10.0F); } } boolean flag = this.isArmored(); for (j = 0; j < 3; ++j) { double d10 = this.func_82214_u(j); double d2 = this.func_82208_v(j); double d4 = this.func_82213_w(j); this.worldObj.spawnParticle( "smoke", d10 + this.rand.nextGaussian() * 0.30000001192092896D, d2 + this.rand.nextGaussian() * 0.30000001192092896D, d4 + this.rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D); if (flag && this.worldObj.rand.nextInt(4) == 0) { this.worldObj.spawnParticle( "mobSpell", d10 + this.rand.nextGaussian() * 0.30000001192092896D, d2 + this.rand.nextGaussian() * 0.30000001192092896D, d4 + this.rand.nextGaussian() * 0.30000001192092896D, 0.699999988079071D, 0.699999988079071D, 0.5D); } } if (this.func_82212_n() > 0) { for (j = 0; j < 3; ++j) { this.worldObj.spawnParticle( "mobSpell", this.posX + this.rand.nextGaussian() * 1.0D, this.posY + (double) (this.rand.nextFloat() * 3.3F), this.posZ + this.rand.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D); } } }
protected void func_178474_a(final ChunkCompileTaskGenerator p_178474_1_) throws InterruptedException { p_178474_1_.func_178540_f().lock(); try { if (p_178474_1_.func_178546_a() != ChunkCompileTaskGenerator.Status.PENDING) { if (!p_178474_1_.func_178537_h()) { LOGGER.warn( "Chunk render task was " + p_178474_1_.func_178546_a() + " when I expected it to be pending; ignoring task"); } return; } p_178474_1_.func_178535_a(ChunkCompileTaskGenerator.Status.COMPILING); } finally { p_178474_1_.func_178540_f().unlock(); } Entity var2 = Minecraft.getMinecraft().func_175606_aa(); if (var2 == null) { p_178474_1_.func_178542_e(); } else { p_178474_1_.func_178541_a(this.func_178475_b()); float var3 = (float) var2.posX; float var4 = (float) var2.posY + var2.getEyeHeight(); float var5 = (float) var2.posZ; ChunkCompileTaskGenerator.Type var6 = p_178474_1_.func_178538_g(); if (var6 == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK) { p_178474_1_.func_178536_b().func_178581_b(var3, var4, var5, p_178474_1_); } else if (var6 == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY) { p_178474_1_.func_178536_b().func_178570_a(var3, var4, var5, p_178474_1_); } p_178474_1_.func_178540_f().lock(); label223: { try { if (p_178474_1_.func_178546_a() == ChunkCompileTaskGenerator.Status.COMPILING) { p_178474_1_.func_178535_a(ChunkCompileTaskGenerator.Status.UPLOADING); break label223; } if (!p_178474_1_.func_178537_h()) { LOGGER.warn( "Chunk render task was " + p_178474_1_.func_178546_a() + " when I expected it to be compiling; aborting task"); } this.func_178473_b(p_178474_1_); } finally { p_178474_1_.func_178540_f().unlock(); } return; } final CompiledChunk var7 = p_178474_1_.func_178544_c(); ArrayList var8 = Lists.newArrayList(); if (var6 == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK) { EnumWorldBlockLayer[] var9 = EnumWorldBlockLayer.values(); int var10 = var9.length; for (int var11 = 0; var11 < var10; ++var11) { EnumWorldBlockLayer var12 = var9[var11]; if (var7.func_178492_d(var12)) { var8.add( this.field_178477_b.func_178503_a( var12, p_178474_1_.func_178545_d().func_179038_a(var12), p_178474_1_.func_178536_b(), var7)); } } } else if (var6 == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY) { var8.add( this.field_178477_b.func_178503_a( EnumWorldBlockLayer.TRANSLUCENT, p_178474_1_.func_178545_d().func_179038_a(EnumWorldBlockLayer.TRANSLUCENT), p_178474_1_.func_178536_b(), var7)); } final ListenableFuture var19 = Futures.allAsList(var8); p_178474_1_.func_178539_a( new Runnable() { private static final String __OBFID = "CL_00002458"; public void run() { var19.cancel(false); } }); Futures.addCallback( var19, new FutureCallback() { private static final String __OBFID = "CL_00002457"; public void func_178481_a(List p_178481_1_) { ChunkRenderWorker.this.func_178473_b(p_178474_1_); p_178474_1_.func_178540_f().lock(); try { if (p_178474_1_.func_178546_a() != ChunkCompileTaskGenerator.Status.UPLOADING) { if (!p_178474_1_.func_178537_h()) { ChunkRenderWorker.LOGGER.warn( "Chunk render task was " + p_178474_1_.func_178546_a() + " when I expected it to be uploading; aborting task"); } return; } p_178474_1_.func_178535_a(ChunkCompileTaskGenerator.Status.DONE); } finally { p_178474_1_.func_178540_f().unlock(); } p_178474_1_.func_178536_b().func_178580_a(var7); } public void onFailure(Throwable p_onFailure_1_) { ChunkRenderWorker.this.func_178473_b(p_178474_1_); if (!(p_onFailure_1_ instanceof CancellationException) && !(p_onFailure_1_ instanceof InterruptedException)) { Minecraft.getMinecraft() .crashed(CrashReport.makeCrashReport(p_onFailure_1_, "Rendering chunk")); } } public void onSuccess(Object p_onSuccess_1_) { this.func_178481_a((List) p_onSuccess_1_); } }); } }