From 2444a80bef77abd252b8ccfd0663687707a58896 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 4 May 2013 17:39:10 -0700 Subject: [PATCH] Capture and fire the PlaySoundAtEntity event for The client entity. Minecraft does some odd bypasses for no good reason. Thanks iPixile for reporting this. --- .../client/entity/EntityPlayerSP.java.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch new file mode 100644 index 000000000..2006c6436 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -0,0 +1,24 @@ +--- ../src_base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java ++++ ../src_work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +@@ -46,6 +46,8 @@ + import net.minecraft.util.Session; + import net.minecraft.util.StringUtils; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; + + @SideOnly(Side.CLIENT) + public class EntityPlayerSP extends EntityPlayer +@@ -661,6 +663,12 @@ + + public void playSound(String par1Str, float par2, float par3) + { ++ PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(this, par1Str, par2, par3); ++ if (MinecraftForge.EVENT_BUS.post(event)) ++ { ++ return; ++ } ++ par1Str = event.name; + this.worldObj.playSound(this.posX, this.posY - (double)this.yOffset, this.posZ, par1Str, par2, par3, false); + } + }