use of micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity 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.entity.ICameraZoomEntity in project Galacticraft by micdoodle8.
the class LayerHeldItemGC method doRenderLayer.
@Override
public void doRenderLayer(AbstractClientPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if (player.ridingEntity instanceof ICameraZoomEntity) {
return;
}
ItemStack itemstack = player.getHeldItem();
if (itemstack != null) {
GlStateManager.pushMatrix();
if (this.livingEntityRenderer.getMainModel().isChild) {
float f = 0.5F;
GlStateManager.translate(0.0F, 0.625F, 0.0F);
GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F);
GlStateManager.scale(f, f, f);
}
((ModelBiped) this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F);
GlStateManager.translate(-0.0625F, 0.4375F, 0.0625F);
if (player instanceof EntityPlayer && ((EntityPlayer) player).fishEntity != null) {
itemstack = new ItemStack(Items.fishing_rod, 0);
}
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) {
GlStateManager.translate(0.0F, 0.1875F, -0.3125F);
GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
float f1 = 0.375F;
GlStateManager.scale(-f1, -f1, f1);
}
if (player.isSneaking()) {
GlStateManager.translate(0.0F, 0.203125F, 0.0F);
}
minecraft.getItemRenderer().renderItem(player, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON);
GlStateManager.popMatrix();
}
}
Aggregations