修复后坐力小概率神秘消失的bug,统一手臂颜色
|
@ -161,6 +161,9 @@ public class GunEventHandler {
|
|||
for (int index0 = 0; index0 < (int) stack.getOrCreateTag().getDouble("projectile_amount"); index0++) {
|
||||
gunShoot(player);
|
||||
}
|
||||
|
||||
stack.getOrCreateTag().putBoolean("shoot",true);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -230,6 +233,8 @@ public class GunEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
stack.getOrCreateTag().putBoolean("shoot",true);
|
||||
|
||||
for (int index0 = 0; index0 < (int) stack.getOrCreateTag().getDouble("projectile_amount"); index0++) {
|
||||
gunShoot(player);
|
||||
}
|
||||
|
@ -320,12 +325,6 @@ public class GunEventHandler {
|
|||
|
||||
public static void gunShoot(Player player) {
|
||||
ItemStack heldItem = player.getMainHandItem();
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilHorizon = 2 * Math.random() - 1;
|
||||
capability.recoil = 0.1;
|
||||
capability.firing = 1;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
if (!player.level().isClientSide()) {
|
||||
float headshot = (float) heldItem.getOrCreateTag().getDouble("headshot");
|
||||
|
@ -786,5 +785,4 @@ public class GunEventHandler {
|
|||
tag.putBoolean("sentinel_is_charging", false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -294,6 +294,16 @@ public class PlayerEventHandler {
|
|||
Runnable recoilRunnable = () -> {
|
||||
while (recoilTimer[0] < recoilDuration) {
|
||||
|
||||
if (tag.getBoolean("shoot")) {
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilHorizon = 2 * Math.random() - 1;
|
||||
capability.recoil = 0.1;
|
||||
capability.firing = 1;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
tag.putBoolean("shoot",false);
|
||||
}
|
||||
|
||||
/*
|
||||
开火动画计时器
|
||||
*/
|
||||
|
@ -355,6 +365,12 @@ public class PlayerEventHandler {
|
|||
player.yRotO = player.getYRot();
|
||||
}
|
||||
|
||||
double finalRecoil = recoil;
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(c -> {
|
||||
c.recoil = finalRecoil;
|
||||
c.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
/*
|
||||
计算散布
|
||||
*/
|
||||
|
@ -407,13 +423,6 @@ public class PlayerEventHandler {
|
|||
player.getAttribute(TargetModAttributes.SPREAD.get()).setBaseValue(0);
|
||||
}
|
||||
|
||||
|
||||
double finalRecoil = recoil;
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(c -> {
|
||||
c.recoil = finalRecoil;
|
||||
c.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
recoilTimer[0]++;
|
||||
try {
|
||||
Thread.sleep(sleepTime);
|
||||
|
|
|
@ -172,6 +172,9 @@ public class FireMessage {
|
|||
player.playSound(TargetModSounds.BOCEK_ZOOM_FIRE_3P.get(), 2, 1);
|
||||
}
|
||||
} else {
|
||||
|
||||
stack.getOrCreateTag().putBoolean("shoot",true);
|
||||
|
||||
for (int index0 = 0; index0 < 10; index0++) {
|
||||
spawnBullet(player);
|
||||
}
|
||||
|
@ -201,12 +204,6 @@ public class FireMessage {
|
|||
|
||||
private static void spawnBullet(Player player) {
|
||||
ItemStack heldItem = player.getMainHandItem();
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||
capability.recoil = 0.1;
|
||||
capability.firing = 1;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
if (player.level().isClientSide()) return;
|
||||
|
||||
|
@ -240,12 +237,7 @@ public class FireMessage {
|
|||
if (!stack.getOrCreateTag().getBoolean("reloading")) {
|
||||
if (!player.getCooldowns().isOnCooldown(stack.getItem()) && stack.getOrCreateTag().getInt("ammo") > 0
|
||||
&& ItemNBTTool.getInt(stack, "Power", 1200) > 400) {
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||
capability.recoil = 0.1;
|
||||
capability.firing = 1;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 5);
|
||||
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
|
@ -266,6 +258,8 @@ public class FireMessage {
|
|||
level.addFreshEntity(taserBulletProjectile);
|
||||
}
|
||||
|
||||
stack.getOrCreateTag().putBoolean("shoot",true);
|
||||
|
||||
stack.getOrCreateTag().putInt("fire_animation", 4);
|
||||
stack.getOrCreateTag().putInt("ammo", (stack.getOrCreateTag().getInt("ammo") - 1));
|
||||
ItemNBTTool.setInt(stack, "Power", ItemNBTTool.getInt(stack, "Power", 1200) - 400);
|
||||
|
@ -279,12 +273,6 @@ public class FireMessage {
|
|||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.getOrCreateTag().getBoolean("reloading")) {
|
||||
if (!player.getCooldowns().isOnCooldown(stack.getItem()) && stack.getOrCreateTag().getInt("ammo") > 0) {
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||
capability.recoil = 0.1;
|
||||
capability.firing = 1;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
Level level = player.level();
|
||||
if (!level.isClientSide()) {
|
||||
|
@ -313,6 +301,9 @@ public class FireMessage {
|
|||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), TargetModSounds.M_79_FAR.get(), SoundSource.PLAYERS, 6, 1);
|
||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), TargetModSounds.M_79_VERYFAR.get(), SoundSource.PLAYERS, 12, 1);
|
||||
}
|
||||
|
||||
stack.getOrCreateTag().putBoolean("shoot",true);
|
||||
|
||||
stack.getOrCreateTag().putInt("fire_animation", 2);
|
||||
stack.getOrCreateTag().putInt("ammo", (stack.getOrCreateTag().getInt("ammo") - 1));
|
||||
}
|
||||
|
@ -327,12 +318,6 @@ public class FireMessage {
|
|||
CompoundTag tag = mainHandItem.getOrCreateTag();
|
||||
|
||||
if (!tag.getBoolean("reloading") && !player.getCooldowns().isOnCooldown(mainHandItem.getItem()) && tag.getInt("ammo") > 0) {
|
||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||
capability.recoil = 0.1;
|
||||
capability.firing = 1;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
if (!level.isClientSide()) {
|
||||
int monsterMultiple = EnchantmentHelper.getTagEnchantmentLevel(TargetModEnchantments.MONSTER_HUNTER.get(), mainHandItem);
|
||||
|
@ -366,6 +351,8 @@ public class FireMessage {
|
|||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), TargetModSounds.RPG_VERYFAR.get(), SoundSource.PLAYERS, 16, 1);
|
||||
}
|
||||
|
||||
tag.putBoolean("shoot",true);
|
||||
|
||||
tag.putInt("fire_animation", 2);
|
||||
tag.putInt("ammo", tag.getInt("ammo") - 1);
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 168 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 36 KiB |