diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java index 83cc4c902..bb6ec74b4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java @@ -170,8 +170,7 @@ public class HelicopterHudOverlay { if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) { - preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/crosshair_ind.png"), x - 8, y - 8, 0, 0, 16, 16, 16, 16); - renderKillIndicator(guiGraphics, x - 7.5f + (float) (2 * (Math.random() - 0.5f)), y - 7.5f + (float) (2 * (Math.random() - 0.5f))); + renderKillIndicator(guiGraphics, w - 7.5f + (float) (2 * (Math.random() - 0.5f)), h - 7.5f + (float) (2 * (Math.random() - 0.5f))); } else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK) { poseStack.pushPose(); poseStack.rotateAround(Axis.ZP.rotationDegrees(iHelicopterEntity.getRotZ(event.getPartialTick())), x, y, 0); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 21583d514..cf9d21ba7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -274,7 +274,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 2.5f * this.entityData.get(PROPELLER_ROT)); } - this.setYRot(this.getYRot() + Mth.clamp((this.onGround() ? 0.1f : 2f) * diffY * this.entityData.get(PROPELLER_ROT) - 0.5f * this.entityData.get(DELTA_ROT), -8f, 8f)); + this.setYRot(this.getYRot() + Mth.clamp((this.onGround() ? 0.1f : 2f) * diffY * this.entityData.get(PROPELLER_ROT) - 0.5f * this.entityData.get(DELTA_ROT), -20f, 20f)); this.setXRot(Mth.clamp(this.getXRot() + (this.onGround() ? 0 : 1.4f) * diffX * this.entityData.get(PROPELLER_ROT), -80, 80)); this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.2f) * diffY * this.entityData.get(PROPELLER_ROT), -80, 80)); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java index f712721d8..744974eb1 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java @@ -248,6 +248,16 @@ public class VehicleEntity extends Entity { yRotO = delta + getYRot(); } + float deltaZ = Math.abs(getRoll() - prevRoll); + while (getRoll() > 180F) { + setZRot(getRoll() - 360F); + prevRoll = getRoll() - deltaZ; + } + while (getRoll() <= -180F) { + setZRot(getRoll() + 360F); + prevRoll = deltaZ + getRoll(); + } + handleClientSync(); if (this.level() instanceof ServerLevel && this.getHealth() <= 0) { diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java index 6ecd0501d..2f4b567e5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java @@ -16,6 +16,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; +import org.joml.Math; import org.joml.Matrix4f; import org.joml.Vector3d; import org.joml.Vector4f; @@ -63,6 +64,7 @@ public abstract class CameraMixin { } if ((player.getVehicle() instanceof Lav150Entity lav150 && lav150.getFirstPassenger() == player) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) { + setRotation(-Mth.lerp(partialTicks, lav150.turretYRotO - lav150.yRotO, lav150.getTurretYRot() - lav150.getYRot()), Mth.lerp(partialTicks, lav150.turretXRotO - lav150.xRotO, lav150.getTurretXRot() - lav150.getXRot())); setPosition(Mth.lerp(partialTicks, player.xo, player.getX()), Mth.lerp(partialTicks, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTicks, player.zo, player.getZ())); info.cancel(); @@ -70,6 +72,15 @@ public abstract class CameraMixin { return; } + + if ((player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.isDriver(player) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON)) { + setRotation(ah6Entity.getYaw(partialTicks), Mth.lerp(partialTicks, ah6Entity.xRotO, ah6Entity.getXRot())); + setPosition(Mth.lerp(partialTicks, player.xo, player.getX()), Mth.lerp(partialTicks, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTicks, player.zo, player.getZ())); + info.cancel(); + + return; + } + if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) { DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone")); if (drone != null) { diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java index bb319c505..5c842d507 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.mixins; +import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity; import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity; import com.atsuishio.superbwarfare.event.ClientEventHandler; @@ -42,9 +43,9 @@ public class MouseHandlerMixin { return ClientEventHandler.zoomVehicle ? 0.15 : 0.3; } -// if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) { -// return 0.24; -// } + if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) { + return 0.3; + } if (player.getVehicle() instanceof Lav150Entity) { return ClientEventHandler.zoomVehicle ? 0.23 : 0.28;