From 28f16ac76c3e8271771551a9b85d968f9fd1354c Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 10 Oct 2014 17:48:19 +0200 Subject: [PATCH] Don't use up ammo in creative mode --- .../java/tconstruct/library/weaponry/AmmoWeapon.java | 3 ++- .../tconstruct/library/weaponry/ProjectileWeapon.java | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java b/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java index a111116b096..d755c20dc5e 100644 --- a/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java +++ b/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java @@ -109,7 +109,8 @@ protected void launchProjectile(ItemStack stack, World world, EntityPlayer playe } // reduce ammo - this.consumeAmmo(1, stack); + if(!player.capabilities.isCreativeMode) + this.consumeAmmo(1, stack); } protected abstract Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy); diff --git a/src/main/java/tconstruct/library/weaponry/ProjectileWeapon.java b/src/main/java/tconstruct/library/weaponry/ProjectileWeapon.java index 39a81a67607..da3c40dc646 100644 --- a/src/main/java/tconstruct/library/weaponry/ProjectileWeapon.java +++ b/src/main/java/tconstruct/library/weaponry/ProjectileWeapon.java @@ -193,10 +193,12 @@ public void onPlayerStoppedUsing (ItemStack weapon, World world, EntityPlayer pl // use up ammo - if(ammo.getItem() instanceof IAmmo) - ((IAmmo) ammo.getItem()).consumeAmmo(1, ammo); - else - player.inventory.consumeInventoryItem(ammo.getItem()); + if(!player.capabilities.isCreativeMode) { + if (ammo.getItem() instanceof IAmmo) + ((IAmmo) ammo.getItem()).consumeAmmo(1, ammo); + else + player.inventory.consumeInventoryItem(ammo.getItem()); + } // FIREEEEEEE if (!world.isRemote)