优化NBT#IterativeTime
This commit is contained in:
parent
9eb8961faf
commit
27f8ab9230
8 changed files with 11 additions and 10 deletions
|
@ -614,8 +614,9 @@ public class GunEventHandler {
|
||||||
&& tag.getInt("ammo") < GunsTool.getGunIntTag(stack, "Magazine", 0) + tag.getInt("customMag")) {
|
&& tag.getInt("ammo") < GunsTool.getGunIntTag(stack, "Magazine", 0) + tag.getInt("customMag")) {
|
||||||
|
|
||||||
playGunLoopReloadSounds(player);
|
playGunLoopReloadSounds(player);
|
||||||
tag.putDouble("iterative", (int) tag.getDouble("iterative_time"));
|
int iterativeTime = GunsTool.getGunIntTag(stack, "IterativeTime", 0);
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), (int) tag.getDouble("iterative_time"));
|
tag.putDouble("iterative", iterativeTime);
|
||||||
|
player.getCooldowns().addCooldown(stack.getItem(), iterativeTime);
|
||||||
// 动画播放nbt
|
// 动画播放nbt
|
||||||
if (tag.getDouble("load_index") == 1) {
|
if (tag.getDouble("load_index") == 1) {
|
||||||
tag.putDouble("load_index", 0);
|
tag.putDouble("load_index", 0);
|
||||||
|
|
|
@ -341,7 +341,7 @@ public class LivingEventHandler {
|
||||||
oldTags.putBoolean("is_normal_reloading", false);
|
oldTags.putBoolean("is_normal_reloading", false);
|
||||||
oldTags.putBoolean("is_empty_reloading", false);
|
oldTags.putBoolean("is_empty_reloading", false);
|
||||||
|
|
||||||
if (oldTags.getDouble("iterative_time") != 0) {
|
if (GunsTool.getGunIntTag(oldStack, "IterativeTime", 0) != 0) {
|
||||||
oldTags.putBoolean("force_stop", false);
|
oldTags.putBoolean("force_stop", false);
|
||||||
oldTags.putBoolean("stop", false);
|
oldTags.putBoolean("stop", false);
|
||||||
oldTags.putInt("reload_stage", 0);
|
oldTags.putInt("reload_stage", 0);
|
||||||
|
@ -376,7 +376,7 @@ public class LivingEventHandler {
|
||||||
data.putInt("ReloadTime", 0);
|
data.putInt("ReloadTime", 0);
|
||||||
newStack.addTagElement("GunData", data);
|
newStack.addTagElement("GunData", data);
|
||||||
|
|
||||||
if (newStack.getOrCreateTag().getDouble("iterative_time") != 0) {
|
if (GunsTool.getGunIntTag(newStack, "IterativeTime", 0) != 0) {
|
||||||
newStack.getOrCreateTag().putBoolean("force_stop", false);
|
newStack.getOrCreateTag().putBoolean("force_stop", false);
|
||||||
newStack.getOrCreateTag().putBoolean("stop", false);
|
newStack.getOrCreateTag().putBoolean("stop", false);
|
||||||
newStack.getOrCreateTag().putInt("reload_stage", 0);
|
newStack.getOrCreateTag().putInt("reload_stage", 0);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ReloadMessage {
|
||||||
) {
|
) {
|
||||||
CompoundTag tag = stack.getOrCreateTag();
|
CompoundTag tag = stack.getOrCreateTag();
|
||||||
|
|
||||||
boolean canSingleReload = tag.getDouble("iterative_time") != 0;
|
boolean canSingleReload = GunsTool.getGunIntTag(stack, "IterativeTime", 0) != 0;
|
||||||
boolean canReload = (GunsTool.getGunIntTag(stack, "NormalReloadTime") != 0 || GunsTool.getGunIntTag(stack, "EmptyReloadTime") != 0)
|
boolean canReload = (GunsTool.getGunIntTag(stack, "NormalReloadTime") != 0 || GunsTool.getGunIntTag(stack, "EmptyReloadTime") != 0)
|
||||||
&& GunsTool.getGunIntTag(stack, "ClipLoad", 0) != 1;
|
&& GunsTool.getGunIntTag(stack, "ClipLoad", 0) != 1;
|
||||||
boolean clipLoad = tag.getInt("ammo") == 0 && GunsTool.getGunIntTag(stack, "ClipLoad", 0) == 1;
|
boolean clipLoad = tag.getInt("ammo") == 0 && GunsTool.getGunIntTag(stack, "ClipLoad", 0) == 1;
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class GunsTool {
|
||||||
private static final Set<String> STRING_SET = Set.of("EmptyReloadTime", "FireMode", "Weight", "SoundRadius", "BurstSize", "ProjectileAmount",
|
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",
|
"Spread", "NormalReloadTime", "Headshot", "Semi", "Burst", "Auto", "RecoilX", "RecoilY", "Velocity", "Damage", "BypassesArmor",
|
||||||
"RPM", "Magazine", "MinZoom", "MaxZoom", "CustomZoom", "ExplosionDamage", "ExplosionRadius", "BoltActionTime", "ClipLoad",
|
"RPM", "Magazine", "MinZoom", "MaxZoom", "CustomZoom", "ExplosionDamage", "ExplosionRadius", "BoltActionTime", "ClipLoad",
|
||||||
"PrepareTime");
|
"PrepareTime", "IterativeTime");
|
||||||
|
|
||||||
public static void initGun(Level level, ItemStack stack, String location) {
|
public static void initGun(Level level, ItemStack stack, String location) {
|
||||||
if (level.getServer() == null) return;
|
if (level.getServer() == null) return;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"EmptyReloadTime": 59,
|
"EmptyReloadTime": 59,
|
||||||
"ClipLoad": 1,
|
"ClipLoad": 1,
|
||||||
"PrepareTime": 29,
|
"PrepareTime": 29,
|
||||||
"iterative_time": 11,
|
"IterativeTime": 11,
|
||||||
"finish_time": 18,
|
"finish_time": 18,
|
||||||
"BypassesArmor": 0.5,
|
"BypassesArmor": 0.5,
|
||||||
"SoundRadius": 18
|
"SoundRadius": 18
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"Semi": 1,
|
"Semi": 1,
|
||||||
"PrepareTime": 7,
|
"PrepareTime": 7,
|
||||||
"prepare_load_time": 36,
|
"prepare_load_time": 36,
|
||||||
"iterative_time": 16,
|
"IterativeTime": 16,
|
||||||
"finish_time": 12,
|
"finish_time": 12,
|
||||||
"BypassesArmor": 0.05,
|
"BypassesArmor": 0.05,
|
||||||
"SoundRadius": 16,
|
"SoundRadius": 16,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"FireMode": 0,
|
"FireMode": 0,
|
||||||
"Semi": 1,
|
"Semi": 1,
|
||||||
"PrepareTime": 7,
|
"PrepareTime": 7,
|
||||||
"iterative_time": 16,
|
"IterativeTime": 16,
|
||||||
"finish_time": 19,
|
"finish_time": 19,
|
||||||
"BypassesArmor": 0.3,
|
"BypassesArmor": 0.3,
|
||||||
"SoundRadius": 15,
|
"SoundRadius": 15,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"Semi": 1,
|
"Semi": 1,
|
||||||
"PrepareTime": 29,
|
"PrepareTime": 29,
|
||||||
"prepare_empty": 16,
|
"prepare_empty": 16,
|
||||||
"iterative_time": 11,
|
"IterativeTime": 11,
|
||||||
"finish_time": 18,
|
"finish_time": 18,
|
||||||
"BypassesArmor": 0.54,
|
"BypassesArmor": 0.54,
|
||||||
"SoundRadius": 18
|
"SoundRadius": 18
|
||||||
|
|
Loading…
Add table
Reference in a new issue