mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
24 lines
1.5 KiB
Diff
24 lines
1.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockNote.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java
|
|
@@ -58,7 +58,9 @@
|
|
if (tileentity instanceof TileEntityNote)
|
|
{
|
|
TileEntityNote tileentitynote = (TileEntityNote)tileentity;
|
|
+ int old = tileentitynote.note;
|
|
tileentitynote.changePitch();
|
|
+ if (old == tileentitynote.note) return false;
|
|
tileentitynote.triggerNote(worldIn, pos);
|
|
playerIn.triggerAchievement(StatList.field_181735_S);
|
|
}
|
|
@@ -98,6 +100,10 @@
|
|
|
|
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
|
|
{
|
|
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID);
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
|
|
+ eventID = e.instrument.ordinal();
|
|
+ eventParam = e.getVanillaNoteId();
|
|
float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D);
|
|
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f);
|
|
worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]);
|