优化NBT#BoltActionTick
This commit is contained in:
parent
e987542772
commit
ba4cadccb3
15 changed files with 28 additions and 26 deletions
|
@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.sniper.MosinNagantItem;
|
import com.atsuishio.superbwarfare.item.gun.sniper.MosinNagantItem;
|
||||||
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
@ -121,7 +122,7 @@ public class MosinNagantItemModel extends GeoModel<MosinNagantItem> {
|
||||||
float numP = (float) (1 - 0.81 * zt);
|
float numP = (float) (1 - 0.81 * zt);
|
||||||
|
|
||||||
// TODO 修改本nbt
|
// TODO 修改本nbt
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") || stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (stack.getOrCreateTag().getBoolean("reloading") || GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
main.setRotX(numR * main.getRotX());
|
main.setRotX(numR * main.getRotX());
|
||||||
main.setRotY(numR * main.getRotY());
|
main.setRotY(numR * main.getRotY());
|
||||||
main.setRotZ(numR * main.getRotZ());
|
main.setRotZ(numR * main.getRotZ());
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
|
||||||
float numR = (float) (1 - 0.92 * zt);
|
float numR = (float) (1 - 0.92 * zt);
|
||||||
float numP = (float) (1 - 0.88 * zt);
|
float numP = (float) (1 - 0.88 * zt);
|
||||||
|
|
||||||
if (GunsTool.getGunIntTag(stack, "ReloadTime") > 0 || stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "ReloadTime") > 0 || GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
main.setRotX(numR * main.getRotX());
|
main.setRotX(numR * main.getRotX());
|
||||||
main.setRotY(numR * main.getRotY());
|
main.setRotY(numR * main.getRotY());
|
||||||
main.setRotZ(numR * main.getRotZ());
|
main.setRotZ(numR * main.getRotZ());
|
||||||
|
|
|
@ -333,7 +333,8 @@ public class ClientEventHandler {
|
||||||
int cooldown = (int) (1000 / rps);
|
int cooldown = (int) (1000 / rps);
|
||||||
|
|
||||||
//左轮类
|
//左轮类
|
||||||
if (clientTimer.getProgress() == 0 && stack.is(ModTags.Items.REVOLVER) && ((holdFire && !stack.getOrCreateTag().getBoolean("DA")) || (stack.getOrCreateTag().getInt("bolt_action_anim") < 7 && stack.getOrCreateTag().getInt("bolt_action_anim") > 2) || stack.getOrCreateTag().getBoolean("canImmediatelyShoot"))) {
|
if (clientTimer.getProgress() == 0 && stack.is(ModTags.Items.REVOLVER) && ((holdFire && !stack.getOrCreateTag().getBoolean("DA"))
|
||||||
|
|| (GunsTool.getGunIntTag(stack, "BoltActionTick") < 7 && GunsTool.getGunIntTag(stack, "BoltActionTick") > 2) || stack.getOrCreateTag().getBoolean("canImmediatelyShoot"))) {
|
||||||
revolverPreTime = Mth.clamp(revolverPreTime + 0.3 * times, 0, 1);
|
revolverPreTime = Mth.clamp(revolverPreTime + 0.3 * times, 0, 1);
|
||||||
revolverWheelPreTime = Mth.clamp(revolverWheelPreTime + 0.32 * times, 0, revolverPreTime > 0.7 ? 1 : 0.55);
|
revolverWheelPreTime = Mth.clamp(revolverWheelPreTime + 0.32 * times, 0, revolverPreTime > 0.7 ? 1 : 0.55);
|
||||||
} else if (!stack.getOrCreateTag().getBoolean("DA") && !stack.getOrCreateTag().getBoolean("canImmediatelyShoot")) {
|
} else if (!stack.getOrCreateTag().getBoolean("DA") && !stack.getOrCreateTag().getBoolean("canImmediatelyShoot")) {
|
||||||
|
|
|
@ -64,15 +64,15 @@ public class GunEventHandler {
|
||||||
private static void handleGunBolt(Player player) {
|
private static void handleGunBolt(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
stack.getOrCreateTag().putInt("bolt_action_anim", stack.getOrCreateTag().getInt("bolt_action_anim") - 1);
|
GunsTool.setGunIntTag(stack, "BoltActionTick", GunsTool.getGunIntTag(stack, "BoltActionTick") - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.MARLIN.get() && stack.getOrCreateTag().getInt("bolt_action_anim") == 9) {
|
if (stack.getItem() == ModItems.MARLIN.get() && GunsTool.getGunIntTag(stack, "BoltActionTick") == 9) {
|
||||||
stack.getOrCreateTag().putBoolean("empty", false);
|
stack.getOrCreateTag().putBoolean("empty", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") == 1) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") == 1) {
|
||||||
GunsTool.setGunBooleanTag(stack, "NeedBoltAction", false);
|
GunsTool.setGunBooleanTag(stack, "NeedBoltAction", false);
|
||||||
if (stack.is(ModTags.Items.REVOLVER)) {
|
if (stack.is(ModTags.Items.REVOLVER)) {
|
||||||
stack.getOrCreateTag().putBoolean("canImmediatelyShoot", true);
|
stack.getOrCreateTag().putBoolean("canImmediatelyShoot", true);
|
||||||
|
|
|
@ -329,12 +329,12 @@ public class LivingEventHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var oldTags = oldStack.getTag();
|
var oldTags = oldStack.getTag();
|
||||||
|
CompoundTag data = oldTags.getCompound("GunData");
|
||||||
|
|
||||||
if (GunsTool.getGunDoubleTag(oldStack, "BoltActionTime", 0) > 0) {
|
if (GunsTool.getGunDoubleTag(oldStack, "BoltActionTime", 0) > 0) {
|
||||||
oldTags.putInt("bolt_action_anim", 0);
|
data.putInt("BoltActionTick", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag data = oldTags.getCompound("GunData");
|
|
||||||
data.putInt("ReloadTime", 0);
|
data.putInt("ReloadTime", 0);
|
||||||
oldStack.addTagElement("GunData", data);
|
oldStack.addTagElement("GunData", data);
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ public class LivingEventHandler {
|
||||||
player.getPersistentData().putDouble("noRun", 40);
|
player.getPersistentData().putDouble("noRun", 40);
|
||||||
newStack.getOrCreateTag().putBoolean("draw", true);
|
newStack.getOrCreateTag().putBoolean("draw", true);
|
||||||
if (GunsTool.getGunIntTag(newStack, "BoltActionTime", 0) > 0) {
|
if (GunsTool.getGunIntTag(newStack, "BoltActionTime", 0) > 0) {
|
||||||
newStack.getOrCreateTag().putInt("bolt_action_anim", 0);
|
GunsTool.setGunIntTag(newStack, "BoltActionTick", 0);
|
||||||
}
|
}
|
||||||
newStack.getOrCreateTag().putBoolean("is_normal_reloading", false);
|
newStack.getOrCreateTag().putBoolean("is_normal_reloading", false);
|
||||||
newStack.getOrCreateTag().putBoolean("is_empty_reloading", false);
|
newStack.getOrCreateTag().putBoolean("is_empty_reloading", false);
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class Trachelium extends GunItem implements GeoItem, AnimatedItem {
|
||||||
boolean stock = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.STOCK) == 2;
|
boolean stock = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.STOCK) == 2;
|
||||||
boolean grip = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) > 0 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE) > 0;
|
boolean grip = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) > 0 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE) > 0;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
if (stock) {
|
if (stock) {
|
||||||
if (grip) {
|
if (grip) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.action_stock_grip"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.action_stock_grip"));
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class MarlinItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class M870Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class K98Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public class K98Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
&& stack.getOrCreateTag().getInt("reload_stage") != 3
|
&& stack.getOrCreateTag().getInt("reload_stage") != 3
|
||||||
&& ClientEventHandler.drawTime < 0.01
|
&& ClientEventHandler.drawTime < 0.01
|
||||||
&& !stack.getOrCreateTag().getBoolean("reloading")) {
|
&& !stack.getOrCreateTag().getBoolean("reloading")) {
|
||||||
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && stack.getOrCreateTag().getInt("bolt_action_anim") == 0) {
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && GunsTool.getGunIntTag(stack, "BoltActionTick") == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run"));
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
if (player.isSprinting() && player.onGround()
|
if (player.isSprinting() && player.onGround()
|
||||||
&& player.getPersistentData().getDouble("noRun") == 0
|
&& player.getPersistentData().getDouble("noRun") == 0
|
||||||
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading")) && ClientEventHandler.drawTime < 0.01) {
|
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading")) && ClientEventHandler.drawTime < 0.01) {
|
||||||
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && stack.getOrCreateTag().getInt("bolt_action_anim") == 0) {
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && GunsTool.getGunIntTag(stack, "BoltActionTick") == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run"));
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class MosinNagantItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public class MosinNagantItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
&& stack.getOrCreateTag().getInt("reload_stage") != 3
|
&& stack.getOrCreateTag().getInt("reload_stage") != 3
|
||||||
&& ClientEventHandler.drawTime < 0.01
|
&& ClientEventHandler.drawTime < 0.01
|
||||||
&& !stack.getOrCreateTag().getBoolean("reloading")) {
|
&& !stack.getOrCreateTag().getBoolean("reloading")) {
|
||||||
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && stack.getOrCreateTag().getInt("bolt_action_anim") == 0) {
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && GunsTool.getGunIntTag(stack, "BoltActionTick") == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run"));
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class Ntw20Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ntw_20.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ntw_20.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class Ntw20Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
&& player.getPersistentData().getDouble("noRun") == 0
|
&& player.getPersistentData().getDouble("noRun") == 0
|
||||||
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
||||||
&& ClientEventHandler.drawTime < 0.01) {
|
&& ClientEventHandler.drawTime < 0.01) {
|
||||||
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && stack.getOrCreateTag().getInt("bolt_action_anim") == 0) {
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && GunsTool.getGunIntTag(stack, "BoltActionTick") == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run"));
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
|
if (GunsTool.getGunIntTag(stack, "BoltActionTick") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
&& player.getPersistentData().getDouble("noRun") == 0
|
&& player.getPersistentData().getDouble("noRun") == 0
|
||||||
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
||||||
&& !GunsTool.getGunBooleanTag(stack, "Charging") && ClientEventHandler.drawTime < 0.01) {
|
&& !GunsTool.getGunBooleanTag(stack, "Charging") && ClientEventHandler.drawTime < 0.01) {
|
||||||
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && stack.getOrCreateTag().getInt("bolt_action_anim") == 0) {
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && GunsTool.getGunIntTag(stack, "BoltActionTick") == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run"));
|
||||||
|
|
|
@ -144,12 +144,12 @@ public class FireMessage {
|
||||||
|
|
||||||
private static void handleGunBolt(Player player, ItemStack stack) {
|
private static void handleGunBolt(Player player, ItemStack stack) {
|
||||||
if (GunsTool.getGunIntTag(stack, "BoltActionTime", 0) > 0 && GunsTool.getGunIntTag(stack, "Ammo", 0) > (stack.is(ModTags.Items.REVOLVER) ? -1 : 0)
|
if (GunsTool.getGunIntTag(stack, "BoltActionTime", 0) > 0 && GunsTool.getGunIntTag(stack, "Ammo", 0) > (stack.is(ModTags.Items.REVOLVER) ? -1 : 0)
|
||||||
&& stack.getOrCreateTag().getInt("bolt_action_anim") == 0
|
&& GunsTool.getGunIntTag(stack, "BoltActionTick") == 0
|
||||||
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
||||||
&& !stack.getOrCreateTag().getBoolean("reloading")
|
&& !stack.getOrCreateTag().getBoolean("reloading")
|
||||||
&& !stack.getOrCreateTag().getBoolean("charging")) {
|
&& !stack.getOrCreateTag().getBoolean("charging")) {
|
||||||
if (!player.getCooldowns().isOnCooldown(stack.getItem()) && GunsTool.getGunBooleanTag(stack, "NeedBoltAction", false)) {
|
if (!player.getCooldowns().isOnCooldown(stack.getItem()) && GunsTool.getGunBooleanTag(stack, "NeedBoltAction", false)) {
|
||||||
stack.getOrCreateTag().putInt("bolt_action_anim", GunsTool.getGunIntTag(stack, "BoltActionTime", 0) + 1);
|
GunsTool.setGunIntTag(stack, "BoltActionTick", GunsTool.getGunIntTag(stack, "BoltActionTime", 0) + 1);
|
||||||
GunEventHandler.playGunBoltSounds(player);
|
GunEventHandler.playGunBoltSounds(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ReloadMessage {
|
||||||
&& stack.getItem() instanceof GunItem gunItem
|
&& stack.getItem() instanceof GunItem gunItem
|
||||||
&& !GunsTool.getGunBooleanTag(stack, "Charging")
|
&& !GunsTool.getGunBooleanTag(stack, "Charging")
|
||||||
&& GunsTool.getGunIntTag(stack, "ReloadTime") == 0
|
&& GunsTool.getGunIntTag(stack, "ReloadTime") == 0
|
||||||
&& stack.getOrCreateTag().getInt("bolt_action_anim") == 0
|
&& GunsTool.getGunIntTag(stack, "BoltActionTick") == 0
|
||||||
) {
|
) {
|
||||||
CompoundTag tag = stack.getOrCreateTag();
|
CompoundTag tag = stack.getOrCreateTag();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue