提取载具灵敏度方法
This commit is contained in:
parent
b3a83d2465
commit
2d7d7aea6c
13 changed files with 79 additions and 41 deletions
|
@ -1063,4 +1063,9 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
public int getDecoy() {
|
public int getDecoy() {
|
||||||
return this.entityData.get(DECOY_COUNT);
|
return this.entityData.get(DECOY_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
|
||||||
|
return 0.25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -697,4 +697,9 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
public boolean allowFreeCam() {
|
public boolean allowFreeCam() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
|
||||||
|
return seatIndex == 0 && !isOnGround ? 0.33 : original;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,4 +605,9 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/annihilator_icon.png");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -774,4 +774,9 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
public boolean hasDecoy() {
|
public boolean hasDecoy() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
|
||||||
|
return zoom ? 0.22 : 0.27;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,6 +588,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
public int getWeaponHeat(Player player) {
|
public int getWeaponHeat(Player player) {
|
||||||
return entityData.get(HEAT);
|
return entityData.get(HEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getBarrelVector(float pPartialTicks) {
|
public Vec3 getBarrelVector(float pPartialTicks) {
|
||||||
if (getFirstPassenger() != null) {
|
if (getFirstPassenger() != null) {
|
||||||
|
@ -600,4 +601,9 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/hpj_11.png");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,4 +642,9 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
public boolean hasDecoy() {
|
public boolean hasDecoy() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
|
||||||
|
return zoom ? 0.23 : 0.3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,4 +452,9 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/sherman_icon.png");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,4 +521,9 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/mle1934_icon.png");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,4 +812,9 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
public boolean hasDecoy() {
|
public boolean hasDecoy() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
|
||||||
|
return zoom ? 0.26 : 0.33;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SoundEvent getEngineSound() {
|
public SoundEvent getEngineSound() {
|
||||||
return SoundEvents.EMPTY;
|
return super.getEngineSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -367,4 +367,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
public boolean allowFreeCam() {
|
public boolean allowFreeCam() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getSensitivity(double original, boolean zoom, int seatIndex, boolean isOnGround) {
|
||||||
|
return 0.3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1281,4 +1281,13 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
public boolean hasDecoy() {
|
public boolean hasDecoy() {
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -971,6 +971,19 @@ public abstract class VehicleEntity extends Entity {
|
||||||
return getEyePosition();
|
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
|
* 渲染载具的第一人称UI
|
||||||
* 务必标记 @OnlyIn(Dist.CLIENT) !
|
* 务必标记 @OnlyIn(Dist.CLIENT) !
|
||||||
|
|
|
@ -2,8 +2,9 @@ package com.atsuishio.superbwarfare.event;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
|
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
|
||||||
import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
|
import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
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.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
|
@ -138,44 +139,8 @@ public class ClientMouseHandler {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Hpj11Entity) {
|
if (player.getVehicle() instanceof VehicleEntity vehicle) {
|
||||||
return ClientEventHandler.zoomVehicle ? 0.25 : 0.3;
|
return vehicle.getSensitivity(original, ClientEventHandler.zoomVehicle, vehicle.getSeatIndex(player), vehicle.onGround());
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return original;
|
return original;
|
||||||
|
|
Loading…
Add table
Reference in a new issue