修改直升机1P视角
This commit is contained in:
parent
92aec2aad6
commit
0b22ad1f69
5 changed files with 27 additions and 6 deletions
|
@ -170,8 +170,7 @@ public class HelicopterHudOverlay {
|
||||||
|
|
||||||
|
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
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, w - 7.5f + (float) (2 * (Math.random() - 0.5f)), h - 7.5f + (float) (2 * (Math.random() - 0.5f)));
|
||||||
renderKillIndicator(guiGraphics, x - 7.5f + (float) (2 * (Math.random() - 0.5f)), y - 7.5f + (float) (2 * (Math.random() - 0.5f)));
|
|
||||||
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK) {
|
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(iHelicopterEntity.getRotZ(event.getPartialTick())), x, y, 0);
|
poseStack.rotateAround(Axis.ZP.rotationDegrees(iHelicopterEntity.getRotZ(event.getPartialTick())), x, y, 0);
|
||||||
|
|
|
@ -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.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.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));
|
this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.2f) * diffY * this.entityData.get(PROPELLER_ROT), -80, 80));
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,6 +248,16 @@ public class VehicleEntity extends Entity {
|
||||||
yRotO = delta + getYRot();
|
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();
|
handleClientSync();
|
||||||
|
|
||||||
if (this.level() instanceof ServerLevel && this.getHealth() <= 0) {
|
if (this.level() instanceof ServerLevel && this.getHealth() <= 0) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
import org.joml.Math;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector4f;
|
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) {
|
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()));
|
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()));
|
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();
|
info.cancel();
|
||||||
|
@ -70,6 +72,15 @@ public abstract class CameraMixin {
|
||||||
return;
|
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")) {
|
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
||||||
DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
||||||
if (drone != null) {
|
if (drone != null) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
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.ICannonEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
|
@ -42,9 +43,9 @@ public class MouseHandlerMixin {
|
||||||
return ClientEventHandler.zoomVehicle ? 0.15 : 0.3;
|
return ClientEventHandler.zoomVehicle ? 0.15 : 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) {
|
if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) {
|
||||||
// return 0.24;
|
return 0.3;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Lav150Entity) {
|
if (player.getVehicle() instanceof Lav150Entity) {
|
||||||
return ClientEventHandler.zoomVehicle ? 0.23 : 0.28;
|
return ClientEventHandler.zoomVehicle ? 0.23 : 0.28;
|
||||||
|
|
Loading…
Add table
Reference in a new issue