diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 23aaf236342..68735fbf9c1 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -848,14 +848,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid if (mMetaTileEntity.onWrenchRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem)) { mMetaTileEntity.markDirty(); GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); } return true; } @@ -867,14 +860,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid getCoverInfoAtSide(wrenchingSide).onCoverScrewdriverClick(aPlayer, 0.5F, 0.5F, 0.5F)); mMetaTileEntity.onScrewdriverRightClick(wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem); mMetaTileEntity.markDirty(); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); } } else { if (GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { @@ -883,14 +869,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid getCoverInfoAtSide(side).onCoverScrewdriverClick(aPlayer, aX, aY, aZ)); mMetaTileEntity.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ, tCurrentItem); mMetaTileEntity.markDirty(); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); } } return true; @@ -910,14 +889,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid GTUtility.trans("090", "Machine Processing: ") + (isAllowedToWork() ? GTUtility.trans("088", "Enabled") : GTUtility.trans("087", "Disabled"))); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1); } return true; } @@ -927,14 +899,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid .onWireCutterRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem)) { mMetaTileEntity.markDirty(); // logic handled internally - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); } doEnetUpdate(); return true; @@ -945,14 +910,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid .onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem)) { mMetaTileEntity.markDirty(); // logic handled internally - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1); } else if (GTModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mMetaTileEntity.markDirty(); mStrongRedstone ^= wrenchingSide.flag; @@ -962,14 +920,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid + GTUtility.trans("092", " set to: ") + ((mStrongRedstone & wrenchingSide.flag) != 0 ? GTUtility.trans("093", "Strong") : GTUtility.trans("094", "Weak"))); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 3.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1); issueBlockUpdate(); } doEnetUpdate(); @@ -987,14 +938,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid mMetaTileEntity.markDirty(); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); sendClientData(); } return true; @@ -1002,14 +946,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid } else { if (GTUtility.isStackInList(tCurrentItem, GregTechAPI.sCrowbarList)) { if (GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_BREAK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.RANDOM_BREAK, 1.0F, -1); dropCover(effectiveSide, side, false); mMetaTileEntity.markDirty(); } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index a5e5e9fd1f1..5c4e6346a9f 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1501,26 +1501,12 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid if (aPlayer.isSneaking() && mMetaTileEntity instanceof MTEBasicMachine && ((MTEBasicMachine) mMetaTileEntity).setMainFacing(wrenchingSide)) { GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); cableUpdateDelay = 10; } else if (mMetaTileEntity .onWrenchRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem)) { GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); cableUpdateDelay = 10; } @@ -1534,14 +1520,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid side, getCoverInfoAtSide(side).onCoverScrewdriverClick(aPlayer, aX, aY, aZ)); mMetaTileEntity.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ, tCurrentItem); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); if (tCurrentItem.stackSize == 0) ForgeEventFactory.onPlayerDestroyItem(aPlayer, tCurrentItem); } @@ -1559,14 +1538,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid : GTUtility.trans("088", "Enabled") + GTUtility.trans("089", " Auto-Output: ") + (mOutputDisabled ? GTUtility.trans("087", "Disabled") : GTUtility.trans("088", "Enabled")))); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_ANVIL_USE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.RANDOM_ANVIL_USE, 1.0F, -1); if (tCurrentItem.stackSize == 0) ForgeEventFactory.onPlayerDestroyItem(aPlayer, tCurrentItem); } @@ -1585,14 +1557,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid tChat = getMetaTileEntity().getAlternativeModeText(); GTUtility.sendChatToPlayer(aPlayer, tChat); } - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1); if (tCurrentItem.stackSize == 0) ForgeEventFactory.onPlayerDestroyItem(aPlayer, tCurrentItem); } @@ -1603,14 +1568,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid if (mMetaTileEntity .onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem)) { // logic handled internally - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1); } else if (GTModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mStrongRedstone ^= wrenchingSide.flag; GTUtility.sendChatToPlayer( @@ -1619,14 +1577,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid + GTUtility.trans("092", " set to: ") + ((mStrongRedstone & wrenchingSide.flag) != 0 ? GTUtility.trans("093", "Strong") : GTUtility.trans("094", "Weak"))); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 3.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1); issueBlockUpdate(); } if (tCurrentItem.stackSize == 0) ForgeEventFactory.onPlayerDestroyItem(aPlayer, tCurrentItem); @@ -1639,14 +1590,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid if (mMetaTileEntity .onWireCutterRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, tCurrentItem)) { // logic handled internally - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); if (tCurrentItem.stackSize == 0) ForgeEventFactory.onPlayerDestroyItem(aPlayer, tCurrentItem); } @@ -1665,14 +1609,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid coverBehavior.onPlayerAttach(aPlayer, tCurrentItem, this, effectiveSide); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1); sendClientData(); } return true; @@ -1680,14 +1617,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid } else { if (GTUtility.isStackInList(tCurrentItem, GregTechAPI.sCrowbarList)) { if (GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_BREAK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.RANDOM_BREAK, 1.0F, -1); dropCover(effectiveSide, side, false); if (tCurrentItem.stackSize == 0) ForgeEventFactory.onPlayerDestroyItem(aPlayer, tCurrentItem); @@ -1699,14 +1629,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid if (effectiveSideCover != CoverInfo.EMPTY_INFO) { if (effectiveSideCover.allowsTickRateAddition()) { effectiveSideCover.onCoverJackhammer(aPlayer); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_DRILL_DRILL_SOFT, - 1.0F, - 1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.IC2_TOOLS_DRILL_DRILL_SOFT, 1.0F, 1); } else { GTUtility.sendChatToPlayer( @@ -1732,14 +1655,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid if (isUpgradable() && tCurrentItem != null) { if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) { if (addMufflerUpgrade()) { - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_CLICK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.RANDOM_CLICK, 1.0F, -1); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1749,14 +1665,7 @@ public boolean onRightclick(final EntityPlayer aPlayer, final ForgeDirection sid mLockUpgrade = true; setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - GTUtility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_CLICK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + sendSoundToPlayers(SoundResource.RANDOM_CLICK, 1.0F, -1); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; diff --git a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java index 3b0c9cc89f9..901f0ea1518 100644 --- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java @@ -19,6 +19,7 @@ import gregtech.GTMod; import gregtech.api.GregTechAPI; import gregtech.api.enums.ItemList; +import gregtech.api.enums.SoundResource; import gregtech.api.gui.modularui.GUITextureSet; import gregtech.api.interfaces.IConfigurationCircuitSupport; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -105,6 +106,11 @@ protected void loadMetaTileNBT(NBTTagCompound aNBT) { } } + protected void sendSoundToPlayers(SoundResource randomAnvilUse, float aSoundStrength, int aSoundModulation) { + GTUtility + .sendSoundToPlayers(worldObj, randomAnvilUse, aSoundStrength, aSoundModulation, xCoord, yCoord, zCoord); + } + /** * Shifts the machine Inventory index according to the change in Input/Output Slots. Default implementation does not * do anything to the slotIndex.