diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch
index f940dba5a..4b546c294 100644
--- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch
+++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch
@@ -66,13 +66,15 @@
{
d5 = 1.0D - d4;
b0 = 5;
-@@ -445,6 +461,9 @@
+@@ -445,6 +461,11 @@
public void func_85030_a(String p_85030_1_, float p_85030_2_, float p_85030_3_)
{
-+ PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(this, p_85030_1_, p_85030_2_, p_85030_3_);
-+ if (MinecraftForge.EVENT_BUS.post(event)) return;
++ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_85030_1_, p_85030_2_, p_85030_3_);
++ if (event.isCanceled() || event.name == null) return;
+ p_85030_1_ = event.name;
++ p_85030_2_ = event.newVolume;
++ p_85030_3_ = event.newPitch;
this.field_70170_p.func_72980_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_85030_1_, p_85030_2_, p_85030_3_, false);
}
diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch
index 3d4fc0bc5..ee8bd9537 100644
--- a/patches/minecraft/net/minecraft/world/World.java.patch
+++ b/patches/minecraft/net/minecraft/world/World.java.patch
@@ -193,25 +193,31 @@
}
public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_)
-@@ -978,6 +1036,8 @@
+@@ -978,6 +1036,11 @@
public void func_72956_a(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_)
{
-+ p_72956_2_ = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAt(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_);
-+ if (p_72956_2_ == null) return;
++ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_);
++ if (event.isCanceled() || event.name == null) return;
++ p_72956_2_ = event.name;
++ p_72956_3_ = event.newVolume;
++ p_72956_4_ = event.newPitch;
for (int i = 0; i < this.field_73021_x.size(); ++i)
{
((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_);
-@@ -986,6 +1046,8 @@
+@@ -986,6 +1049,11 @@
public void func_85173_a(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_)
{
-+ p_85173_2_ = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAt(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_);
-+ if (p_85173_2_ == null) return;
++ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_);
++ if (event.isCanceled() || event.name == null) return;
++ p_85173_2_ = event.name;
++ p_85173_3_ = event.newVolume;
++ p_85173_4_ = event.newPitch;
for (int i = 0; i < this.field_73021_x.size(); ++i)
{
((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_);
-@@ -1037,6 +1099,9 @@
+@@ -1037,6 +1105,9 @@
public boolean func_72838_d(Entity p_72838_1_)
{
@@ -221,7 +227,7 @@
int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D);
int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D);
boolean flag = p_72838_1_.field_98038_p;
-@@ -1059,6 +1124,8 @@
+@@ -1059,6 +1130,8 @@
this.func_72854_c();
}
@@ -230,7 +236,7 @@
this.func_72964_e(i, j).func_76612_a(p_72838_1_);
this.field_72996_f.add(p_72838_1_);
this.func_72923_a(p_72838_1_);
-@@ -1271,17 +1338,29 @@
+@@ -1271,17 +1344,29 @@
public int func_72967_a(float p_72967_1_)
{
@@ -263,7 +269,7 @@
public void func_72848_b(IWorldAccess p_72848_1_)
{
this.field_73021_x.remove(p_72848_1_);
-@@ -1290,6 +1369,12 @@
+@@ -1290,6 +1375,12 @@
@SideOnly(Side.CLIENT)
public float func_72971_b(float p_72971_1_)
{
@@ -276,7 +282,7 @@
float f1 = this.func_72826_c(p_72971_1_);
float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F);
f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F);
-@@ -1302,6 +1387,12 @@
+@@ -1302,6 +1393,12 @@
@SideOnly(Side.CLIENT)
public Vec3 func_72833_a(Entity p_72833_1_, float p_72833_2_)
{
@@ -289,7 +295,7 @@
float f1 = this.func_72826_c(p_72833_2_);
float f2 = MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F);
-@@ -1309,9 +1400,7 @@
+@@ -1309,9 +1406,7 @@
int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u);
int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
@@ -300,7 +306,7 @@
float f4 = (float)(l >> 16 & 255) / 255.0F;
float f5 = (float)(l >> 8 & 255) / 255.0F;
float f6 = (float)(l & 255) / 255.0F;
-@@ -1373,6 +1462,11 @@
+@@ -1373,6 +1468,11 @@
public float func_130001_d()
{
@@ -312,7 +318,7 @@
return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())];
}
-@@ -1385,6 +1479,12 @@
+@@ -1385,6 +1485,12 @@
@SideOnly(Side.CLIENT)
public Vec3 func_72824_f(float p_72824_1_)
{
@@ -325,7 +331,7 @@
float f1 = this.func_72826_c(p_72824_1_);
float f2 = MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F);
-@@ -1442,9 +1542,9 @@
+@@ -1442,9 +1548,9 @@
for (blockpos1 = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos1.func_177956_o() >= 0; blockpos1 = blockpos2)
{
blockpos2 = blockpos1.func_177977_b();
@@ -337,7 +343,7 @@
{
break;
}
-@@ -1456,6 +1556,12 @@
+@@ -1456,6 +1562,12 @@
@SideOnly(Side.CLIENT)
public float func_72880_h(float p_72880_1_)
{
@@ -350,7 +356,7 @@
float f1 = this.func_72826_c(p_72880_1_);
float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F);
f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F);
-@@ -1500,7 +1606,15 @@
+@@ -1500,7 +1612,15 @@
entity.func_85029_a(crashreportcategory);
}
@@ -367,7 +373,7 @@
}
if (entity.field_70128_L)
-@@ -1562,7 +1676,16 @@
+@@ -1562,7 +1682,16 @@
crashreport = CrashReport.func_85055_a(throwable1, "Ticking entity");
crashreportcategory = crashreport.func_85058_a("Entity being ticked");
entity.func_85029_a(crashreportcategory);
@@ -385,7 +391,7 @@
}
}
-@@ -1609,7 +1732,16 @@
+@@ -1609,7 +1738,16 @@
CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Ticking block entity");
CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Block entity being ticked");
tileentity.func_145828_a(crashreportcategory1);
@@ -403,7 +409,7 @@
}
}
}
-@@ -1628,6 +1760,10 @@
+@@ -1628,6 +1766,10 @@
if (!this.field_147483_b.isEmpty())
{
@@ -414,7 +420,7 @@
this.field_175730_i.removeAll(this.field_147483_b);
this.field_147482_g.removeAll(this.field_147483_b);
this.field_147483_b.clear();
-@@ -1668,7 +1804,8 @@
+@@ -1668,7 +1810,8 @@
public boolean func_175700_a(TileEntity p_175700_1_)
{
@@ -424,7 +430,7 @@
if (flag && p_175700_1_ instanceof IUpdatePlayerListBox)
{
-@@ -1710,9 +1847,12 @@
+@@ -1710,9 +1853,12 @@
{
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
@@ -439,7 +445,7 @@
{
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
-@@ -1839,7 +1979,7 @@
+@@ -1839,7 +1985,7 @@
{
Block block = this.func_180495_p(new BlockPos(k1, l1, i2)).func_177230_c();
@@ -448,7 +454,7 @@
{
return true;
}
-@@ -1901,6 +2041,10 @@
+@@ -1901,6 +2047,10 @@
{
return true;
}
@@ -459,7 +465,7 @@
}
}
}
-@@ -2039,6 +2183,7 @@
+@@ -2039,6 +2189,7 @@
public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
{
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
@@ -467,7 +473,7 @@
explosion.func_77278_a();
explosion.func_77279_a(true);
return explosion;
-@@ -2185,19 +2330,28 @@
+@@ -2185,19 +2336,28 @@
else
{
this.func_175700_a(p_175690_2_);
@@ -497,7 +503,7 @@
}
else
{
-@@ -2210,6 +2364,7 @@
+@@ -2210,6 +2370,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
@@ -505,7 +511,7 @@
}
public void func_147457_a(TileEntity p_147457_1_)
-@@ -2228,7 +2383,7 @@
+@@ -2228,7 +2389,7 @@
{
IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_);
Block block = iblockstate.func_177230_c();
@@ -514,7 +520,7 @@
}
public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_)
-@@ -2248,7 +2403,7 @@
+@@ -2248,7 +2409,7 @@
else
{
Block block = this.func_180495_p(p_175677_1_).func_177230_c();
@@ -523,7 +529,7 @@
}
}
}
-@@ -2265,8 +2420,7 @@
+@@ -2265,8 +2426,7 @@
public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_)
{
@@ -533,7 +539,7 @@
}
public void func_72835_b()
-@@ -2276,6 +2430,11 @@
+@@ -2276,6 +2436,11 @@
protected void func_72947_a()
{
@@ -545,7 +551,7 @@
if (this.field_72986_A.func_76059_o())
{
this.field_73004_o = 1.0F;
-@@ -2289,6 +2448,11 @@
+@@ -2289,6 +2454,11 @@
protected void func_72979_l()
{
@@ -557,7 +563,7 @@
if (!this.field_73011_w.func_177495_o())
{
if (!this.field_72995_K)
-@@ -2383,6 +2547,7 @@
+@@ -2383,6 +2553,7 @@
{
this.field_72993_I.clear();
this.field_72984_F.func_76320_a("buildList");
@@ -565,7 +571,7 @@
int i;
EntityPlayer entityplayer;
int j;
-@@ -2445,7 +2610,7 @@
+@@ -2445,7 +2616,7 @@
l += p_147467_1_;
i1 += p_147467_2_;
@@ -574,7 +580,7 @@
{
EntityPlayer entityplayer = this.func_72977_a((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D);
-@@ -2485,6 +2650,11 @@
+@@ -2485,6 +2656,11 @@
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{
@@ -586,7 +592,7 @@
BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_);
float f = biomegenbase.func_180626_a(p_175670_1_);
-@@ -2526,6 +2696,11 @@
+@@ -2526,6 +2702,11 @@
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{
@@ -598,7 +604,7 @@
BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_);
float f = biomegenbase.func_180626_a(p_175708_1_);
-@@ -2543,7 +2718,7 @@
+@@ -2543,7 +2724,7 @@
{
Block block = this.func_180495_p(p_175708_1_).func_177230_c();
@@ -607,7 +613,7 @@
{
return true;
}
-@@ -2575,10 +2750,11 @@
+@@ -2575,10 +2756,11 @@
else
{
Block block = this.func_180495_p(p_175638_1_).func_177230_c();
@@ -622,7 +628,7 @@
{
j = 1;
}
-@@ -2792,10 +2968,10 @@
+@@ -2792,10 +2974,10 @@
public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_)
{
ArrayList arraylist = Lists.newArrayList();
@@ -637,7 +643,7 @@
for (int i1 = i; i1 <= j; ++i1)
{
-@@ -2854,10 +3030,10 @@
+@@ -2854,10 +3036,10 @@
public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_)
{
@@ -652,7 +658,7 @@
ArrayList arraylist = Lists.newArrayList();
for (int i1 = i; i1 <= j; ++i1)
-@@ -2938,13 +3114,16 @@
+@@ -2938,13 +3120,16 @@
public void func_175650_b(Collection p_175650_1_)
{
@@ -671,7 +677,7 @@
}
}
-@@ -2957,7 +3136,9 @@
+@@ -2957,7 +3142,9 @@
{
Block block1 = this.func_180495_p(p_175716_2_).func_177230_c();
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_180640_a(this, p_175716_2_, p_175716_1_.func_176223_P());
@@ -682,7 +688,7 @@
}
public int func_175627_a(BlockPos p_175627_1_, EnumFacing p_175627_2_)
-@@ -3032,7 +3213,7 @@
+@@ -3032,7 +3219,7 @@
{
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
Block block = iblockstate.func_177230_c();
@@ -691,7 +697,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_)
-@@ -3160,7 +3341,7 @@
+@@ -3160,7 +3347,7 @@
public long func_72905_C()
{
@@ -700,7 +706,7 @@
}
public long func_82737_E()
-@@ -3170,17 +3351,17 @@
+@@ -3170,17 +3357,17 @@
public long func_72820_D()
{
@@ -721,7 +727,7 @@
if (!this.func_175723_af().func_177746_a(blockpos))
{
-@@ -3192,7 +3373,7 @@
+@@ -3192,7 +3379,7 @@
public void func_175652_B(BlockPos p_175652_1_)
{
@@ -730,7 +736,7 @@
}
@SideOnly(Side.CLIENT)
-@@ -3212,12 +3393,18 @@
+@@ -3212,12 +3399,18 @@
if (!this.field_72996_f.contains(p_72897_1_))
{
@@ -749,7 +755,7 @@
return true;
}
-@@ -3307,8 +3494,7 @@
+@@ -3307,8 +3500,7 @@
public boolean func_180502_D(BlockPos p_180502_1_)
{
@@ -759,7 +765,7 @@
}
public MapStorage func_175693_T()
-@@ -3367,12 +3553,12 @@
+@@ -3367,12 +3559,12 @@
public int func_72800_K()
{
@@ -774,7 +780,7 @@
}
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
-@@ -3429,7 +3615,7 @@
+@@ -3429,7 +3621,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
@@ -783,7 +789,7 @@
}
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
-@@ -3461,29 +3647,21 @@
+@@ -3461,29 +3653,21 @@
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{
@@ -820,7 +826,7 @@
}
}
}
-@@ -3553,4 +3731,82 @@
+@@ -3553,4 +3737,82 @@
short short1 = 128;
return k >= -short1 && k <= short1 && l >= -short1 && l <= short1;
}
diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java
index c261d525c..744a18543 100644
--- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java
+++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java
@@ -304,12 +304,23 @@ public class ForgeEventFactory
return event.canUpdate;
}
+ /**
+ * Use {@link #onPlaySoundAtEntity(Entity,String,float,float)}
+ */
+ @Deprecated
public static String onPlaySoundAt(Entity entity, String name, float volume, float pitch)
{
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
MinecraftForge.EVENT_BUS.post(event);
return event.name;
}
+
+ public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, String name, float volume, float pitch)
+ {
+ PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
+ MinecraftForge.EVENT_BUS.post(event);
+ return event;
+ }
public static int onItemExpire(EntityItem entity, ItemStack item)
{
diff --git a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java
index fbd9f571f..5b933ebd8 100644
--- a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java
+++ b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java
@@ -10,8 +10,10 @@ import net.minecraft.entity.Entity;
* and World#playerSoundToNearExcept(EntityPlayer, String, float, float).
*
* {@link #name} contains the name of the sound to be played at the Entity.
- * {@link #volume} contains the volume at which the sound is to be played.
- * {@link #pitch} contains the pitch at which the sound is to be played.
+ * {@link #volume} contains the volume at which the sound is to be played originally.
+ * {@link #pitch} contains the pitch at which the sound is to be played originally.
+ * {@link #newVolume} contains the volume at which the sound is actually played.
+ * {@link #newPitch} contains the pitch at which the sound is actually played.
* Changing the {@link #name} field will cause the sound of this name to be played instead of the originally intended sound.
*
* This event is {@link Cancelable}.
@@ -27,6 +29,8 @@ public class PlaySoundAtEntityEvent extends EntityEvent
public String name;
public final float volume;
public final float pitch;
+ public float newVolume;
+ public float newPitch;
public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch)
{
@@ -34,5 +38,7 @@ public class PlaySoundAtEntityEvent extends EntityEvent
this.name = name;
this.volume = volume;
this.pitch = pitch;
+ this.newVolume = volume;
+ this.newPitch = pitch;
}
}