Files
2019-02-24 22:29:41 +08:00

35 lines
1.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java
@@ -32,7 +32,9 @@
public void changePitch()
{
+ byte old = note;
this.note = (byte)((this.note + 1) % 25);
+ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return;
this.markDirty();
}
@@ -42,7 +44,7 @@
{
IBlockState iblockstate = worldIn.getBlockState(posIn.down());
Material material = iblockstate.getMaterial();
- int i = 0;
+ byte i = 0;
if (material == Material.ROCK)
{
@@ -91,7 +93,11 @@
i = 9;
}
- worldIn.addBlockEvent(posIn, Blocks.NOTEBLOCK, i, this.note);
+ // worldIn.addBlockEvent(posIn, Blocks.NOTEBLOCK, i, this.note);
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(this.world, posIn.getX(), posIn.getY(), posIn.getZ(), i, this.note);
+ if (!event.isCancelled()) {
+ worldIn.addBlockEvent(posIn, Blocks.NOTEBLOCK, event.getInstrument().getType(), event.getNote().getId());
+ }
}
}
}