From 37def8854d1b3b33bc3f497d25a1f549c8240e04 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 25 Sep 2015 16:46:07 -0700 Subject: [PATCH] Fix #194 Annoying sounds with Forestry Worktable --- .../gregtech/api/items/GT_Generic_Item.java | 2 +- .../api/items/GT_MetaGenerated_Tool.java | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/main/java/gregtech/api/items/GT_Generic_Item.java b/main/java/gregtech/api/items/GT_Generic_Item.java index 3d408788..a90c13a2 100644 --- a/main/java/gregtech/api/items/GT_Generic_Item.java +++ b/main/java/gregtech/api/items/GT_Generic_Item.java @@ -138,7 +138,7 @@ public class GT_Generic_Item extends Item implements IProjectileItem { } @Override - public final boolean hasContainerItem(ItemStack aStack) { + public boolean hasContainerItem(ItemStack aStack) { return getContainerItem(aStack) != null; } } \ No newline at end of file diff --git a/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java b/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java index 24830c8c..ff3cdfdf 100644 --- a/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -393,16 +393,28 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements } @Override - public final ItemStack getContainerItem(ItemStack aStack) { + public final ItemStack getContainerItem(ItemStack aStack) { + return getContainerItem(aStack, true); + } + + @Override + public final boolean hasContainerItem(ItemStack aStack) { + return getContainerItem(aStack, false) != null; + } + + private ItemStack getContainerItem(ItemStack aStack, boolean playSound) { if (!isItemStackUsable(aStack)) return null; aStack = GT_Utility.copyAmount(1, aStack); IToolStats tStats = getToolStats(aStack); if (tStats == null) return null; doDamage(aStack, tStats.getToolDamagePerContainerCraft()); aStack = aStack.stackSize > 0 ? aStack : null; - if (aStack == null) GT_Utility.doSoundAtClient(tStats.getBreakingSound(), 1, 1.0F); else GT_Utility.doSoundAtClient(tStats.getCraftingSound(), 1, 1.0F); + if (playSound) { + String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); + GT_Utility.doSoundAtClient(sound, 1, 1.0F); + } return aStack; - } + } public IToolStats getToolStats(ItemStack aStack) { isItemStackUsable(aStack);