提取载具灵敏度方法

This commit is contained in:
17146 2025-05-14 02:18:09 +08:00 committed by Light_Quanta
parent b3a83d2465
commit 2d7d7aea6c
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
13 changed files with 79 additions and 41 deletions

View file

@ -1063,4 +1063,9 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
public int getDecoy() {
return this.entityData.get(DECOY_COUNT);
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return 0.25;
}
}

View file

@ -697,4 +697,9 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
public boolean allowFreeCam() {
return true;
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return seatIndex == 0 && !isOnGround ? 0.33 : original;
}
}

View file

@ -605,4 +605,9 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
public ResourceLocation getVehicleIcon() {
return Mod.loc("textures/vehicle_icon/annihilator_icon.png");
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.15 : 0.3;
}
}

View file

@ -774,4 +774,9 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
public boolean hasDecoy() {
return true;
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.22 : 0.27;
}
}

View file

@ -588,6 +588,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
public int getWeaponHeat(Player player) {
return entityData.get(HEAT);
}
@Override
public Vec3 getBarrelVector(float pPartialTicks) {
if (getFirstPassenger() != null) {
@ -600,4 +601,9 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
public ResourceLocation getVehicleIcon() {
return Mod.loc("textures/vehicle_icon/hpj_11.png");
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.25 : 0.3;
}
}

View file

@ -642,4 +642,9 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
public boolean hasDecoy() {
return true;
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.23 : 0.3;
}
}

View file

@ -452,4 +452,9 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
public ResourceLocation getVehicleIcon() {
return Mod.loc("textures/vehicle_icon/sherman_icon.png");
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.15 : 0.3;
}
}

View file

@ -521,4 +521,9 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
public ResourceLocation getVehicleIcon() {
return Mod.loc("textures/vehicle_icon/mle1934_icon.png");
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.15 : 0.3;
}
}

View file

@ -812,4 +812,9 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
public boolean hasDecoy() {
return true;
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return zoom ? 0.26 : 0.33;
}
}

View file

@ -232,7 +232,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
@Override
public SoundEvent getEngineSound() {
return SoundEvents.EMPTY;
return super.getEngineSound();
}
@Override
@ -367,4 +367,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
public boolean allowFreeCam() {
return true;
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return 0.3;
}
}

View file

@ -1281,4 +1281,13 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
public boolean hasDecoy() {
return true;
}
@Override
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
if (seatIndex == 0) {
return zoom ? 0.17 : 0.22;
} else if (seatIndex == 1) {
return zoom ? 0.25 : 0.35;
} else return original;
}
}

View file

@ -971,6 +971,19 @@ public abstract class VehicleEntity extends Entity {
return getEyePosition();
}
/**
* 玩家在载具上的灵敏度调整
*
* @param original 原始灵敏度
* @param zoom 是否在载具上瞄准
* @param seatIndex 玩家座位
* @param isOnGround 载具是否在地面
* @return 调整后的灵敏度
*/
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
return original;
}
/**
* 渲染载具的第一人称UI
* 务必标记 @OnlyIn(Dist.CLIENT) !

View file

@ -2,8 +2,9 @@ package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
import com.atsuishio.superbwarfare.entity.vehicle.*;
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModMobEffects;
import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -138,44 +139,8 @@ public class ClientMouseHandler {
return 0;
}
if (player.getVehicle() instanceof Hpj11Entity) {
return ClientEventHandler.zoomVehicle ? 0.25 : 0.3;
}
if (player.getVehicle() instanceof CannonEntity) {
return ClientEventHandler.zoomVehicle ? 0.15 : 0.3;
}
if (player.getVehicle() instanceof Lav150Entity) {
return ClientEventHandler.zoomVehicle ? 0.23 : 0.3;
}
if (player.getVehicle() instanceof Bmp2Entity) {
return ClientEventHandler.zoomVehicle ? 0.22 : 0.27;
}
if (player.getVehicle() instanceof Yx100Entity yx100) {
if (player == yx100.getFirstPassenger()) {
return ClientEventHandler.zoomVehicle ? 0.17 : 0.22;
} else if (player == yx100.getNthEntity(1)) {
return ClientEventHandler.zoomVehicle ? 0.25 : 0.35;
}
}
if (player.getVehicle() instanceof PrismTankEntity) {
return ClientEventHandler.zoomVehicle ? 0.26 : 0.33;
}
if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) {
return 0.33;
}
if (player.getVehicle() instanceof Tom6Entity) {
return 0.3;
}
if (player.getVehicle() instanceof A10Entity) {
return 0.25;
if (player.getVehicle() instanceof VehicleEntity vehicle) {
return vehicle.getSensitivity(original, ClientEventHandler.zoomVehicle, vehicle.getSeatIndex(player), vehicle.onGround());
}
return original;