use of micdoodle8.mods.galacticraft.core.wrappers.PlayerGearData 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.core.wrappers.PlayerGearData in project Galacticraft by micdoodle8.
the class LayerOxygenGear method doRenderLayer.
@Override
public void doRenderLayer(AbstractClientPlayer player, float f5, float f6, float partialTicks, float f8, float f2, float f7, float scale) {
if (!player.isInvisible()) {
PlayerGearData gearData = GalacticraftCore.proxy.getGearData(player);
if (gearData != null) {
boolean wearingGear = gearData.getGear() == Constants.GEAR_ID_OXYGEN_GEAR;
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelPlayerGC.playerTexture);
if (wearingGear && !playerRenderer.getMainModel().isSneak) {
for (int i = 0; i < 7; i++) {
for (int k = 0; k < 2; k++) {
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.tubes[k][i]);
GlStateManager.pushMatrix();
GlStateManager.translate(0.175F * (float) (k * 2 - 1), 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.0325F * (float) (i * 2 - 1), 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.0325F * (float) (Math.pow(i * 2 - 1, 2) * 0.05));
GlStateManager.translate(0.0F, 0.2F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, 0.2F);
this.tubes[k][i].render(scale);
GlStateManager.popMatrix();
}
}
}
}
}
GlStateManager.color(1.0F, 1.0F, 1.0F);
}
use of micdoodle8.mods.galacticraft.core.wrappers.PlayerGearData in project Galacticraft by micdoodle8.
the class LayerOxygenTanks method doRenderLayer.
@Override
public void doRenderLayer(AbstractClientPlayer player, float f5, float f6, float partialTicks, float f8, float f2, float f7, float scale) {
if (!player.isInvisible()) {
PlayerGearData gearData = GalacticraftCore.proxy.getGearData(player);
if (gearData != null) {
boolean wearingLeftTankGreen = gearData.getLeftTank() == Constants.GEAR_ID_OXYGEN_TANK_LIGHT;
boolean wearingLeftTankOrange = gearData.getLeftTank() == Constants.GEAR_ID_OXYGEN_TANK_MEDIUM;
boolean wearingLeftTankRed = gearData.getLeftTank() == Constants.GEAR_ID_OXYGEN_TANK_HEAVY || gearData.getLeftTank() == Constants.GEAR_ID_OXYGEN_TANK_INFINITE;
boolean wearingRightTankGreen = gearData.getRightTank() == Constants.GEAR_ID_OXYGEN_TANK_LIGHT;
boolean wearingRightTankOrange = gearData.getRightTank() == Constants.GEAR_ID_OXYGEN_TANK_MEDIUM;
boolean wearingRightTankRed = gearData.getRightTank() == Constants.GEAR_ID_OXYGEN_TANK_HEAVY || gearData.getRightTank() == Constants.GEAR_ID_OXYGEN_TANK_INFINITE;
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelPlayerGC.playerTexture);
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.greenOxygenTanks[0]);
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.greenOxygenTanks[1]);
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.orangeOxygenTanks[0]);
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.orangeOxygenTanks[1]);
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.redOxygenTanks[0]);
ModelPlayer.copyModelAngles(this.playerRenderer.getMainModel().bipedBody, this.redOxygenTanks[1]);
if (playerRenderer.getMainModel().isSneak) {
this.greenOxygenTanks[0].rotationPointY = 2.0F;
this.greenOxygenTanks[1].rotationPointY = 2.0F;
this.greenOxygenTanks[0].rotationPointZ = 1.6F;
this.greenOxygenTanks[1].rotationPointZ = 1.6F;
this.orangeOxygenTanks[0].rotationPointY = 2.0F;
this.orangeOxygenTanks[1].rotationPointY = 2.0F;
this.orangeOxygenTanks[0].rotationPointZ = 1.6F;
this.orangeOxygenTanks[1].rotationPointZ = 1.6F;
this.redOxygenTanks[0].rotationPointY = 2.0F;
this.redOxygenTanks[1].rotationPointY = 2.0F;
this.redOxygenTanks[0].rotationPointZ = 1.6F;
this.redOxygenTanks[1].rotationPointZ = 1.6F;
} else {
this.greenOxygenTanks[0].rotationPointY = 0.5F;
this.greenOxygenTanks[1].rotationPointY = 0.5F;
this.greenOxygenTanks[0].rotationPointZ = 0.5F;
this.greenOxygenTanks[1].rotationPointZ = 0.5F;
this.orangeOxygenTanks[0].rotationPointY = 0.5F;
this.orangeOxygenTanks[1].rotationPointY = 0.5F;
this.orangeOxygenTanks[0].rotationPointZ = 0.5F;
this.orangeOxygenTanks[1].rotationPointZ = 0.5F;
this.redOxygenTanks[0].rotationPointY = 0.5F;
this.redOxygenTanks[1].rotationPointY = 0.5F;
this.redOxygenTanks[0].rotationPointZ = 0.5F;
this.redOxygenTanks[1].rotationPointZ = 0.5F;
}
for (int i = 0; i < 2; ++i) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.175F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, 0.2F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, 0.2F);
if (wearingLeftTankRed) {
this.redOxygenTanks[0].render(scale);
}
if (wearingLeftTankOrange) {
this.orangeOxygenTanks[0].render(scale);
}
if (wearingLeftTankGreen) {
this.greenOxygenTanks[0].render(scale);
}
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(-0.175F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, 0.2F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, 0.2F);
if (wearingRightTankRed) {
this.redOxygenTanks[1].render(scale);
}
if (wearingRightTankOrange) {
this.orangeOxygenTanks[1].render(scale);
}
if (wearingRightTankGreen) {
this.greenOxygenTanks[1].render(scale);
}
GlStateManager.color(1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
}
}
}
}
Aggregations