优化NBT#Velocity

This commit is contained in:
17146 2024-12-24 15:31:04 +08:00
parent 207368b9bb
commit 676d825f2e
33 changed files with 35 additions and 35 deletions

View file

@ -187,7 +187,7 @@ public class GunEventHandler {
if (!player.level().isClientSide()) {
float headshot = (float) GunsTool.getGunDoubleTag(heldItem, "Headshot", 0);
float damage = (float) (heldItem.getOrCreateTag().getDouble("damage") + heldItem.getOrCreateTag().getDouble("sentinelChargeDamage")) * (float) perkDamage(heldItem);
float velocity = (float) ((heldItem.getOrCreateTag().getDouble("velocity") + heldItem.getOrCreateTag().getDouble("CustomVelocity")) * perkSpeed(heldItem));
float velocity = (float) ((GunsTool.getGunDoubleTag(heldItem, "Velocity", 0) + heldItem.getOrCreateTag().getDouble("CustomVelocity")) * perkSpeed(heldItem));
int projectileAmount = GunsTool.getGunIntTag(heldItem, "ProjectileAmount", 1);
float bypassArmorRate = (float) heldItem.getOrCreateTag().getDouble("BypassesArmor");
boolean zoom = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).zoom;

View file

@ -340,7 +340,7 @@ public class FireMessage {
TaserBulletProjectileEntity taserBulletProjectile = new TaserBulletProjectileEntity(player, level, (float) stack.getOrCreateTag().getDouble("damage"), volt, wireLength);
taserBulletProjectile.setPos(player.getX(), player.getEyeY() - 0.1, player.getZ());
taserBulletProjectile.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) stack.getOrCreateTag().getDouble("velocity"),
taserBulletProjectile.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) GunsTool.getGunDoubleTag(stack, "Velocity", 0),
(float) (zoom ? 0.1 : spread));
level.addFreshEntity(taserBulletProjectile);
}
@ -380,7 +380,7 @@ public class FireMessage {
}
gunGrenadeEntity.setPos(player.getX(), player.getEyeY() - 0.1, player.getZ());
gunGrenadeEntity.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) stack.getOrCreateTag().getDouble("velocity"),
gunGrenadeEntity.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) GunsTool.getGunDoubleTag(stack, "Velocity", 0),
(float) (zoom ? 0.1 : spread));
level.addFreshEntity(gunGrenadeEntity);
}
@ -431,7 +431,7 @@ public class FireMessage {
}
rocketEntity.setPos(player.getX(), player.getEyeY() - 0.1, player.getZ());
rocketEntity.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) tag.getDouble("velocity"),
rocketEntity.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) GunsTool.getGunDoubleTag(stack, "Velocity", 0),
(float) (zoom ? 0.1 : spread));
level.addFreshEntity(rocketEntity);
}

View file

@ -55,7 +55,7 @@ public class GunsTool {
// TODO 临时使用移植完毕后删除
private static final Set<String> STRING_SET = Set.of("EmptyReloadTime", "FireMode", "Weight", "SoundRadius", "BurstSize", "ProjectileAmount",
"Spread", "NormalReloadTime", "Headshot", "Semi", "Burst", "Auto", "RecoilX", "RecoilY");
"Spread", "NormalReloadTime", "Headshot", "Semi", "Burst", "Auto", "RecoilX", "RecoilY", "Velocity");
public static void initGun(Level level, ItemStack stack, String location) {
if (level.getServer() == null) return;

View file

@ -4,7 +4,7 @@
"RecoilY": 0.018,
"damage": 2.5,
"Headshot": 1.5,
"velocity": 17,
"Velocity": 17,
"mag": 25,
"ProjectileAmount": 12,
"Weight": 7,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.026,
"damage": 5,
"Headshot": 1.5,
"velocity": 15,
"Velocity": 15,
"mag": 2,
"ProjectileAmount": 12,
"Weight": 1,

View file

@ -6,7 +6,7 @@
"RecoilY": 0.01,
"damage": 7.7,
"Headshot": 2,
"velocity": 44.5,
"Velocity": 44.5,
"mag": 30,
"Weight": 4,
"FireMode": 2,

View file

@ -6,7 +6,7 @@
"RecoilY": 0.012,
"damage": 8.5,
"Headshot": 2,
"velocity": 36,
"Velocity": 36,
"mag": 30,
"Weight": 5,
"FireMode": 2,

View file

@ -5,7 +5,7 @@
"RecoilY": 0.01,
"damage": 9.5,
"Headshot": 2,
"velocity": 40,
"Velocity": 40,
"mag": 55,
"Weight": 6,
"FireMode": 2,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.013,
"damage": 5.5,
"Headshot": 1.5,
"velocity": 17,
"Velocity": 17,
"mag": 17,
"Weight": 1,
"FireMode": 0,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.013,
"damage": 5.5,
"Headshot": 1.5,
"velocity": 17,
"Velocity": 17,
"mag": 17,
"Weight": 1,
"FireMode": 2,

View file

@ -6,7 +6,7 @@
"RecoilY": 0.009,
"damage": 7.5,
"Headshot": 2,
"velocity": 44,
"Velocity": 44,
"mag": 30,
"Weight": 4,
"FireMode": 2,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.04,
"damage": 65,
"Headshot": 3,
"velocity": 38,
"Velocity": 38,
"mag": 1,
"Weight": 5,
"FireMode": 0,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.063,
"damage": 35,
"Headshot": 3,
"velocity": 37.75,
"Velocity": 37.75,
"mag": 5,
"bolt_action_time": 22,
"Weight": 5,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.018,
"damage": 9.5,
"Headshot": 1.5,
"velocity": 15,
"Velocity": 15,
"mag": 7,
"Weight": 2,
"FireMode": 0,

View file

@ -6,7 +6,7 @@
"RecoilY": 0.011,
"damage": 7,
"Headshot": 2,
"velocity": 44,
"Velocity": 44,
"mag": 30,
"Weight": 4,
"FireMode": 2,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.014,
"damage": 9,
"Headshot": 2,
"velocity": 43,
"Velocity": 43,
"mag": 100,
"Weight": 8,
"FireMode": 2,

View file

@ -5,7 +5,7 @@
"damage": 40,
"ExplosionDamage": 80,
"ExplosionRadius": 5,
"velocity": 3.75,
"Velocity": 3.75,
"mag": 1,
"Weight": 4,
"EmptyReloadTime": 64

View file

@ -4,7 +4,7 @@
"RecoilY": 0.04,
"damage": 3,
"Headshot": 1.5,
"velocity": 17,
"Velocity": 17,
"mag": 8,
"force_stop_reloading": 1,
"ProjectileAmount": 12,

View file

@ -7,7 +7,7 @@
"RecoilY": 0.013,
"damage": 38,
"Headshot": 3,
"velocity": 47.2,
"Velocity": 47.2,
"mag": 5,
"bolt_action_time": 18,
"Weight": 7,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.031,
"damage": 16,
"Headshot": 2.5,
"velocity": 38,
"Velocity": 38,
"mag": 8,
"force_stop_reloading": 1,
"Weight": 3,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.02,
"damage": 8,
"Headshot": 2,
"velocity": 46,
"Velocity": 46,
"Weight": 10,
"FireMode": 2,
"BypassesArmor": 0.3,

View file

@ -6,7 +6,7 @@
"RecoilY": 0.014,
"damage": 12,
"Headshot": 2.5,
"velocity": 42.5,
"Velocity": 42.5,
"mag": 20,
"Weight": 5,
"FireMode": 0,

View file

@ -5,7 +5,7 @@
"RecoilY": 0.063,
"damage": 33,
"Headshot": 3,
"velocity": 42,
"Velocity": 42,
"mag": 5,
"bolt_action_time": 22,
"Weight": 5,

View file

@ -5,7 +5,7 @@
"RecoilY": 0.038,
"damage": 140,
"Headshot": 3,
"velocity": 36,
"Velocity": 36,
"mag": 3,
"bolt_action_time": 37,
"Weight": 10,

View file

@ -6,7 +6,7 @@
"RecoilY": 0.009,
"damage": 8.25,
"Headshot": 2,
"velocity": 46,
"Velocity": 46,
"mag": 30,
"Weight": 4,
"FireMode": 2,

View file

@ -5,7 +5,7 @@
"damage": 200,
"ExplosionDamage": 150,
"ExplosionRadius": 10,
"velocity": 4,
"Velocity": 4,
"mag": 1,
"Weight": 7,
"EmptyReloadTime": 103

View file

@ -4,7 +4,7 @@
"RecoilY": 0.012,
"damage": 8.75,
"Headshot": 2,
"velocity": 38,
"Velocity": 38,
"mag": 75,
"Weight": 6,
"FireMode": 2,

View file

@ -6,7 +6,7 @@
"damage": 35,
"mag": 5,
"Headshot": 3,
"velocity": 70,
"Velocity": 70,
"bolt_action_time": 22,
"Weight": 7,
"FireMode": 0,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.015,
"damage": 9.5,
"Headshot": 2,
"velocity": 36,
"Velocity": 36,
"mag": 20,
"Weight": 4,
"FireMode": 0,

View file

@ -5,7 +5,7 @@
"RecoilY": 0.009,
"damage": 18,
"Headshot": 2,
"velocity": 42,
"Velocity": 42,
"mag": 10,
"Weight": 5,
"FireMode": 0,

View file

@ -3,7 +3,7 @@
"RecoilX": 0.0001,
"RecoilY": 0.002,
"damage": 5,
"velocity": 3,
"Velocity": 3,
"mag": 1,
"Weight": 1,
"EmptyReloadTime": 58

View file

@ -4,7 +4,7 @@
"RecoilY": 0.032,
"damage": 19,
"Headshot": 2,
"velocity": 24,
"Velocity": 24,
"mag": 6,
"Weight": 2,
"FireMode": 0,

View file

@ -4,7 +4,7 @@
"RecoilY": 0.007,
"damage": 6,
"Headshot": 1.5,
"velocity": 16,
"Velocity": 16,
"mag": 13,
"Weight": 3,
"FireMode": 2,