use of micdoodle8.mods.galacticraft.api.world.IZeroGDimension in project Galacticraft by micdoodle8.
the class PlayerClient method onLivingUpdatePost.
@Override
public void onLivingUpdatePost(EntityPlayerSP player) {
GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);
boolean ridingThirdPersonEntity = player.ridingEntity instanceof ICameraZoomEntity && ((ICameraZoomEntity) player.ridingEntity).defaultThirdPerson();
if (stats.getPlatformControlled() || player.worldObj.provider instanceof IZeroGDimension) {
stats.getFreefallHandler().postVanillaMotion(player);
if (stats.isInFreefall() || ridingThirdPersonEntity) {
this.cancelLimbSwing(player);
} else {
if (stats.isInFreefallLast() && this.downMot2 < -0.008D) {
stats.setLandingTicks(5 - (int) (Math.min(this.downMot2, stats.getDownMotionLast()) * 40));
if (stats.getLandingTicks() > stats.getMaxLandingticks()) {
if (stats.getLandingTicks() > stats.getMaxLandingticks() + 4) {
stats.getFreefallHandler().pjumpticks = stats.getLandingTicks() - stats.getMaxLandingticks() - 5;
}
stats.setLandingTicks(stats.getMaxLandingticks());
}
float dYmax = 0.3F * stats.getLandingTicks() / stats.getMaxLandingticks();
float factor = 1F;
for (int i = 0; i <= stats.getLandingTicks(); i++) {
stats.getLandingYOffset()[i] = dYmax * MathHelper.sin(i * 3.1415926F / stats.getLandingTicks()) * factor;
factor *= 0.97F;
}
}
}
if (stats.getLandingTicks() > 0) {
stats.setLandingTicks(stats.getLandingTicks() - 1);
player.limbSwing *= 0.8F;
player.limbSwingAmount = 0F;
}
} else {
stats.setInFreefall(false);
if (ridingThirdPersonEntity) {
this.cancelLimbSwing(player);
}
}
if (ridingThirdPersonEntity && !stats.isLastRidingCameraZoomEntity()) {
if (!ConfigManagerCore.disableVehicleCameraChanges)
FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = 1;
}
if (player.ridingEntity instanceof ICameraZoomEntity) {
if (!ConfigManagerCore.disableVehicleCameraChanges) {
stats.setLastZoomed(true);
TickHandlerClient.zoom(((ICameraZoomEntity) player.ridingEntity).getCameraZoom());
}
} else if (stats.isLastZoomed()) {
if (!ConfigManagerCore.disableVehicleCameraChanges) {
stats.setLastZoomed(false);
TickHandlerClient.zoom(4.0F);
}
}
stats.setLastRidingCameraZoomEntity(ridingThirdPersonEntity);
if (stats.isUsingParachute()) {
player.fallDistance = 0.0F;
}
PlayerGearData gearData = GalacticraftCore.proxy.getGearData(player);
stats.setUsingParachute(false);
if (gearData != null) {
stats.setUsingParachute(gearData.getParachute() != null);
if (!GalacticraftCore.isHeightConflictingModInstalled) {
if (gearData.getMask() != GCPlayerHandler.GEAR_NOT_PRESENT) {
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.isUsingParachute() && player.onGround) {
stats.setUsingParachute(false);
stats.setLastUsingParachute(false);
FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.getThirdPersonView();
}
if (!stats.isLastUsingParachute() && stats.isUsingParachute()) {
FMLClientHandler.instance().getClient().getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(Constants.TEXTURE_PREFIX + "player.parachute"), 0.95F + player.getRNG().nextFloat() * 0.1F, 1.0F, (float) player.posX, (float) player.posY, (float) player.posZ));
}
stats.setLastUsingParachute(stats.isUsingParachute());
stats.setLastOnGround(player.onGround);
}
use of micdoodle8.mods.galacticraft.api.world.IZeroGDimension in project Galacticraft by micdoodle8.
the class GCPlayerBaseSP method afterUpdateEntityActionState.
@Override
public void afterUpdateEntityActionState() {
if (this.player.worldObj.provider instanceof IZeroGDimension) {
this.player.setJumping(false);
AxisAlignedBB aABB = this.player.getEntityBoundingBox();
if ((aABB.minY % 1D) == 0.5D)
this.player.setEntityBoundingBox(aABB.offset(0D, 0.00001D, 0D));
}
}
Aggregations