Skip to content

Commit

Permalink
Extrace method CommonMetaTileEntity::sendSoundToPlayers
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickMG committed Feb 2, 2025
1 parent 7e1af89 commit 38831ab
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 176 deletions.
81 changes: 9 additions & 72 deletions src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)) {
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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();
Expand All @@ -987,29 +938,15 @@ 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;
}
} 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();
}
Expand Down
Loading

0 comments on commit 38831ab

Please sign in to comment.