@Override public void onLivingUpdatePre(EntityPlayerSP player) { GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); if (player.worldObj.provider instanceof IGalacticraftWorldProvider) { stats.inFreefallLast = stats.inFreefall; stats.inFreefall = FreefallHandler.testFreefall(player); if (player.worldObj.provider instanceof WorldProviderOrbit) { this.downMot2 = stats.downMotionLast; stats.downMotionLast = player.motionY; ((WorldProviderOrbit) player.worldObj.provider).preVanillaMotion(player); } } // if (player.boundingBox != null && stats.boundingBoxBefore == null) // { // GCLog.debug("Changed player BB from " + player.boundingBox.minY); // stats.boundingBoxBefore = player.boundingBox; // player.boundingBox.setBounds(stats.boundingBoxBefore.minX + 0.4, // stats.boundingBoxBefore.minY + 0.9, stats.boundingBoxBefore.minZ + 0.4, // stats.boundingBoxBefore.maxX - 0.4, stats.boundingBoxBefore.maxY - 0.9, // stats.boundingBoxBefore.maxZ - 0.4); // GCLog.debug("Changed player BB to " + player.boundingBox.minY); // } // else if (player.boundingBox != null && stats.boundingBoxBefore != null) // { // player.boundingBox.setBB(stats.boundingBoxBefore); // GCLog.debug("Changed player BB to " + player.boundingBox.minY); // } }
@Override public void onLivingUpdatePost(EntityPlayerSP player) { GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); if (player.worldObj.provider instanceof WorldProviderOrbit) { ((WorldProviderOrbit) player.worldObj.provider).postVanillaMotion(player); if (stats.inFreefall) { // No limb swing player.limbSwing -= player.limbSwingAmount; player.limbSwingAmount = player.prevLimbSwingAmount; float adjust = Math.min(Math.abs(player.limbSwing), Math.abs(player.limbSwingAmount) / 3); if (player.limbSwing < 0) player.limbSwing += adjust; else if (player.limbSwing > 0) player.limbSwing -= adjust; player.limbSwingAmount *= 0.9; } else { if (stats.inFreefallLast && this.downMot2 < -0.01D) { stats.landingTicks = 2 - (int) (Math.min(this.downMot2, stats.downMotionLast) * 75); if (stats.landingTicks > 6) stats.landingTicks = 6; } } if (stats.landingTicks > 0) stats.landingTicks--; } else stats.inFreefall = false; boolean ridingThirdPersonEntity = player.ridingEntity instanceof ICameraZoomEntity && ((ICameraZoomEntity) player.ridingEntity).defaultThirdPerson(); if (ridingThirdPersonEntity && !stats.lastRidingCameraZoomEntity) { FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = 1; } if (player.ridingEntity != null && player.ridingEntity instanceof ICameraZoomEntity) { stats.lastZoomed = true; TickHandlerClient.zoom(((ICameraZoomEntity) player.ridingEntity).getCameraZoom()); } else if (stats.lastZoomed) { stats.lastZoomed = false; TickHandlerClient.zoom(4.0F); } stats.lastRidingCameraZoomEntity = ridingThirdPersonEntity; if (stats.usingParachute) { player.fallDistance = 0.0F; } PlayerGearData gearData = ModelPlayerGC.getGearData(player); stats.usingParachute = false; if (gearData != null) { stats.usingParachute = gearData.getParachute() != null; if (gearData.getMask() >= 0) { player.height = 1.9375F; } else { player.height = 1.8F; } AxisAlignedBB bounds = player.getEntityBoundingBox(); player.setEntityBoundingBox( new AxisAlignedBB( bounds.minX, bounds.minY, bounds.minZ, bounds.maxX, bounds.minY + (double) player.height, bounds.maxZ)); } if (stats.usingParachute && player.onGround) { stats.setParachute(false); FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.thirdPersonView; } if (!stats.lastUsingParachute && stats.usingParachute) { FMLClientHandler.instance() .getClient() .getSoundHandler() .playSound( new PositionedSoundRecord( new ResourceLocation(GalacticraftCore.TEXTURE_PREFIX + "player.parachute"), 0.95F + player.getRNG().nextFloat() * 0.1F, 1.0F, (float) player.posX, (float) player.posY, (float) player.posZ)); } stats.lastUsingParachute = stats.usingParachute; stats.lastOnGround = player.onGround; }