修复手动拉栓音效bug
This commit is contained in:
parent
58df69ba68
commit
c2a7af8a85
2 changed files with 4 additions and 4 deletions
|
@ -158,7 +158,7 @@ public class GunEventHandler {
|
|||
判断是否为栓动武器(bolt_action_time > 0),并在开火后给一个需要上膛的状态
|
||||
*/
|
||||
if (stack.getOrCreateTag().getDouble("bolt_action_time") > 0 && stack.getOrCreateTag().getInt("ammo") > 1) {
|
||||
stack.getOrCreateTag().putDouble("need_bolt_action", 1);
|
||||
stack.getOrCreateTag().putBoolean("need_bolt_action", true);
|
||||
}
|
||||
|
||||
stack.getOrCreateTag().putInt("ammo", (stack.getOrCreateTag().getInt("ammo") - 1));
|
||||
|
@ -224,7 +224,7 @@ public class GunEventHandler {
|
|||
/*
|
||||
在开火动画的最后1tick,设置需要拉栓上膛的武器拉栓动画的倒计时为data里的拉栓时间
|
||||
*/
|
||||
if (stack.getOrCreateTag().getInt("fire_animation") == 1 && stack.getOrCreateTag().getDouble("need_bolt_action") == 1) {
|
||||
if (stack.getOrCreateTag().getInt("fire_animation") == 1 && stack.getOrCreateTag().getBoolean("need_bolt_action")) {
|
||||
stack.getOrCreateTag().putDouble("bolt_action_anim", stack.getOrCreateTag().getDouble("bolt_action_time"));
|
||||
player.getCooldowns().addCooldown(stack.getItem(), (int) stack.getOrCreateTag().getDouble("bolt_action_time"));
|
||||
playGunBoltSounds(player);
|
||||
|
@ -233,7 +233,7 @@ public class GunEventHandler {
|
|||
stack.getOrCreateTag().putDouble("bolt_action_anim", stack.getOrCreateTag().getDouble("bolt_action_anim") - 1);
|
||||
}
|
||||
if (stack.getOrCreateTag().getDouble("bolt_action_anim") == 1) {
|
||||
stack.getOrCreateTag().putDouble("need_bolt_action", 0);
|
||||
stack.getOrCreateTag().putBoolean("need_bolt_action", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class PressFireProcedure {
|
|||
}
|
||||
|
||||
// 栓动武器左键手动拉栓
|
||||
if (mainHandItem.is(TargetModTags.Items.GUN) && tag.getDouble("bolt_action_time") > 0 && tag.getInt("ammo") > 0) {
|
||||
if (mainHandItem.is(TargetModTags.Items.GUN) && tag.getDouble("bolt_action_time") > 0 && tag.getInt("ammo") > 0 && tag.getDouble("bolt_action_anim") == 0) {
|
||||
if (!player.getCooldowns().isOnCooldown(mainHandItem.getItem()) && mainHandItem.getOrCreateTag().getDouble("need_bolt_action") == 1) {
|
||||
mainHandItem.getOrCreateTag().putDouble("bolt_action_anim", mainHandItem.getOrCreateTag().getDouble("bolt_action_time"));
|
||||
GunEventHandler.playGunBoltSounds(player);
|
||||
|
|
Loading…
Add table
Reference in a new issue