修复换弹时物品未正确消耗的问题

This commit is contained in:
Light_Quanta 2025-04-14 17:01:42 +08:00
parent 4822382dc7
commit 9c2c02f07c
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 3 additions and 3 deletions

View file

@ -354,7 +354,7 @@ public class GunEventHandler {
case ITEM -> {
data.ammo.set(1);
player.getInventory().clearOrCountMatchingItems(
p -> p.getItem().getDescriptionId().equals(ammoTypeInfo.value()),
p -> p.getItem().toString().equals(ammoTypeInfo.value()),
1,
player.inventoryMenu.getCraftSlots()
);
@ -606,7 +606,7 @@ public class GunEventHandler {
type.add(cap, -1);
}
case ITEM -> player.getInventory().clearOrCountMatchingItems(
p -> p.getItem().getDescriptionId().equals(ammoTypeInfo.value()),
p -> p.getItem().toString().equals(ammoTypeInfo.value()),
1,
player.inventoryMenu.getCraftSlots()
);

View file

@ -126,7 +126,7 @@ public class PlayerEventHandler {
if (data.ammo.get() == 0 && data.maxAmmo.get() == 0) {
data.ammo.set(1);
player.getInventory().clearOrCountMatchingItems(
p -> p.getItem().getDescriptionId().equals(ammoTypeInfo.value()),
p -> p.getItem().toString().equals(ammoTypeInfo.value()),
1,
player.inventoryMenu.getCraftSlots()
);