修复了怪物猎人perk导致无法发射子弹的问题

This commit is contained in:
17146 2024-11-20 23:05:44 +08:00
parent c5cddcc814
commit 085cd68344
3 changed files with 10 additions and 20 deletions

View file

@ -231,7 +231,7 @@ public class GunEventHandler {
var dmgPerk = PerkHelper.getPerkByType(heldItem, Perk.Type.DAMAGE); var dmgPerk = PerkHelper.getPerkByType(heldItem, Perk.Type.DAMAGE);
if (dmgPerk == ModPerks.MONSTER_HUNTER.get()) { if (dmgPerk == ModPerks.MONSTER_HUNTER.get()) {
int level = PerkHelper.getItemPerkLevel(perk, heldItem); int level = PerkHelper.getItemPerkLevel(dmgPerk, heldItem);
projectile.monsterMultiple(0.1f + 0.1f * level); projectile.monsterMultiple(0.1f + 0.1f * level);
} }

View file

@ -133,7 +133,6 @@ public class FireMessage {
tag.putBoolean("Seeking", true); tag.putBoolean("Seeking", true);
tag.putInt("SeekTime", 0); tag.putInt("SeekTime", 0);
} }
} }
if (tag.getDouble("prepare") == 0 && tag.getBoolean("reloading") && tag.getInt("ammo") > 0) { if (tag.getDouble("prepare") == 0 && tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
@ -190,15 +189,12 @@ public class FireMessage {
if (stack.getOrCreateTag().getDouble("power") >= 6) { if (stack.getOrCreateTag().getDouble("power") >= 6) {
stack.getOrCreateTag().putDouble("speed", stack.getOrCreateTag().getDouble("power")); stack.getOrCreateTag().putDouble("speed", stack.getOrCreateTag().getDouble("power"));
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) { if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
spawnBullet(player); spawnBullet(player);
spawnFakeArrow(player); spawnFakeArrow(player);
SoundTool.playLocalSound(player, ModSounds.BOCEK_ZOOM_FIRE_1P.get(), 10, 1); SoundTool.playLocalSound(player, ModSounds.BOCEK_ZOOM_FIRE_1P.get(), 10, 1);
player.playSound(ModSounds.BOCEK_ZOOM_FIRE_3P.get(), 2, 1); player.playSound(ModSounds.BOCEK_ZOOM_FIRE_3P.get(), 2, 1);
} else { } else {
for (int index0 = 0; index0 < (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug ? 1 : 10); index0++) { for (int index0 = 0; index0 < (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug ? 1 : 10); index0++) {
spawnBullet(player); spawnBullet(player);
} }
@ -249,7 +245,6 @@ public class FireMessage {
double damage; double damage;
boolean zoom = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).zoom; boolean zoom = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).zoom;
float spread; float spread;
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) { if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
@ -265,7 +260,6 @@ public class FireMessage {
.headShot(headshot) .headShot(headshot)
.zoom(zoom); .zoom(zoom);
if (perk instanceof AmmoPerk ammoPerk) { if (perk instanceof AmmoPerk ammoPerk) {
int level = PerkHelper.getItemPerkLevel(perk, heldItem); int level = PerkHelper.getItemPerkLevel(perk, heldItem);

View file

@ -64,15 +64,11 @@ public class ShootMessage {
int projectileAmount = (int) stack.getOrCreateTag().getDouble("projectile_amount"); int projectileAmount = (int) stack.getOrCreateTag().getDouble("projectile_amount");
if (stack.getOrCreateTag().getInt("ammo") > 0) { if (stack.getOrCreateTag().getInt("ammo") > 0) {
// 空仓挂机
/*
空仓挂机
*/
if (stack.getOrCreateTag().getInt("ammo") == 1) { if (stack.getOrCreateTag().getInt("ammo") == 1) {
stack.getOrCreateTag().putBoolean("HoldOpen", true); stack.getOrCreateTag().putBoolean("HoldOpen", true);
} }
if (stack.is(ModTags.Items.REVOLVER)) { if (stack.is(ModTags.Items.REVOLVER)) {
stack.getOrCreateTag().putBoolean("canImmediatelyShoot", false); stack.getOrCreateTag().putBoolean("canImmediatelyShoot", false);
} }