Skip to content

Commit

Permalink
Don't use up ammo in creative mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Oct 10, 2014
1 parent 69fad3c commit 28f16ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/library/weaponry/AmmoWeapon.java
Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/tconstruct/library/weaponry/ProjectileWeapon.java
Expand Up @@ -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)
Expand Down

0 comments on commit 28f16ac

Please sign in to comment.