优化NBT#PrepareLoadTime

This commit is contained in:
17146 2024-12-24 16:59:32 +08:00
parent 27f8ab9230
commit 3b51f00bcc
4 changed files with 6 additions and 7 deletions

View file

@ -543,10 +543,11 @@ public class GunEventHandler {
MinecraftForge.EVENT_BUS.post(new ReloadEvent.Pre(player, stack));
// 此处判断空仓换弹的时候是否在准备阶段就需要装填一发如M870
if (tag.getDouble("prepare_load_time") != 0 && tag.getInt("ammo") == 0) {
if (GunsTool.getGunIntTag(stack, "PrepareLoadTime", 0) != 0 && tag.getInt("ammo") == 0) {
playGunPrepareLoadReloadSounds(player);
tag.putInt("prepare_load", (int) tag.getDouble("prepare_load_time") + 1);
player.getCooldowns().addCooldown(stack.getItem(), (int) tag.getDouble("prepare_load_time"));
int prepareLoadTime = GunsTool.getGunIntTag(stack, "PrepareLoadTime", 0);
tag.putInt("prepare_load", prepareLoadTime + 1);
player.getCooldowns().addCooldown(stack.getItem(), prepareLoadTime);
} else if (tag.getDouble("prepare_empty") != 0 && tag.getInt("ammo") == 0) {
// 此处判断空仓换弹如莫辛纳甘
playGunEmptyPrepareSounds(player);

View file

@ -57,7 +57,7 @@ public class GunsTool {
private static final Set<String> STRING_SET = Set.of("EmptyReloadTime", "FireMode", "Weight", "SoundRadius", "BurstSize", "ProjectileAmount",
"Spread", "NormalReloadTime", "Headshot", "Semi", "Burst", "Auto", "RecoilX", "RecoilY", "Velocity", "Damage", "BypassesArmor",
"RPM", "Magazine", "MinZoom", "MaxZoom", "CustomZoom", "ExplosionDamage", "ExplosionRadius", "BoltActionTime", "ClipLoad",
"PrepareTime", "IterativeTime");
"PrepareTime", "IterativeTime", "PrepareLoadTime");
public static void initGun(Level level, ItemStack stack, String location) {
if (level.getServer() == null) return;

View file

@ -6,13 +6,12 @@
"Headshot": 1.5,
"Velocity": 17,
"Magazine": 8,
"force_stop_reloading": 1,
"ProjectileAmount": 12,
"Weight": 4,
"FireMode": 0,
"Semi": 1,
"PrepareTime": 7,
"prepare_load_time": 36,
"PrepareLoadTime": 36,
"IterativeTime": 16,
"finish_time": 12,
"BypassesArmor": 0.05,

View file

@ -6,7 +6,6 @@
"Headshot": 2.5,
"Velocity": 38,
"Magazine": 8,
"force_stop_reloading": 1,
"Weight": 3,
"FireMode": 0,
"Semi": 1,