From 751bc5c94824e3e3deadd5d08ba7b05b9638dc43 Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Mon, 14 Apr 2025 22:05:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E9=80=A0=E6=A8=A1=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E6=B6=88=E8=80=97=E4=BB=BB=E4=BD=95=E5=BC=B9=E8=8D=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/atsuishio/superbwarfare/item/gun/data/GunData.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/atsuishio/superbwarfare/item/gun/data/GunData.java b/src/main/java/com/atsuishio/superbwarfare/item/gun/data/GunData.java index 46d98f9b8..3e45412e8 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/gun/data/GunData.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/gun/data/GunData.java @@ -8,6 +8,7 @@ import com.atsuishio.superbwarfare.perk.AmmoPerk; import com.atsuishio.superbwarfare.perk.Perk; import com.atsuishio.superbwarfare.tools.AmmoType; import com.atsuishio.superbwarfare.tools.GunsTool; +import com.atsuishio.superbwarfare.tools.InventoryTool; import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; @@ -304,6 +305,8 @@ public class GunData { } public int countAmmo(Player player) { + if (player.isCreative() || InventoryTool.hasCreativeAmmoBox(player)) return Integer.MAX_VALUE; + var info = ammoTypeInfo(); return switch (info.type()) { case PLAYER_AMMO -> { @@ -327,6 +330,8 @@ public class GunData { } public void consumeAmmo(Player player, int count) { + if (player.isCreative() || InventoryTool.hasCreativeAmmoBox(player)) return; + var info = ammoTypeInfo(); switch (info.type()) { case PLAYER_AMMO -> {