添加真实后坐力(

This commit is contained in:
Light_Quanta 2025-07-02 02:02:09 +08:00
parent 98d9c9e078
commit 7697968b29
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
4 changed files with 11 additions and 0 deletions

View file

@ -20,6 +20,8 @@ public class DefaultGunData implements IDBasedData {
public double recoilX;
@SerializedName("RecoilY")
public double recoilY;
@SerializedName("Recoil")
public double recoil;
@SerializedName("DefaultZoom")
public double defaultZoom = 1.25;

View file

@ -301,6 +301,9 @@ public class GunData {
public double recoilY() {
return defaultGunData().recoilY;
}
public double recoil() {
return defaultGunData().recoil;
}
public double weight() {
return defaultGunData().weight + customWeight();

View file

@ -728,6 +728,11 @@ public class ClientEventHandler {
PacketDistributor.sendToServer(new ShootMessage(gunSpread, zoom, entity != null ? entity.getUUID() : UUID.randomUUID()));
fireRecoilTime = 10;
// 真实后座
if (data.recoil() != 0) {
player.setDeltaMovement(player.getDeltaMovement().add(player.getViewVector(1).scale(-data.recoil())));
}
var gunRecoilY = data.recoilY() * 10;
recoilY = (float) (2 * Math.random() - 1) * gunRecoilY;

View file

@ -3,6 +3,7 @@
"Spread": 5,
"RecoilX": 0.015,
"RecoilY": 0.02,
"Recoil": 0.15,
"Damage": 40,
"Headshot": 2.0,
"Velocity": 43,