Merge pull request #195 from mezz/master

Fix #194 Annoying sounds with Forestry Worktable
This commit is contained in:
Blood-Asp 2015-10-01 00:25:11 +02:00
commit 183cfa6f06
2 changed files with 16 additions and 4 deletions

View file

@ -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;
}
}

View file

@ -394,13 +394,25 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
@Override
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;
}