2018-07-15 02:00:00 +02:00
|
|
|
--- a/net/minecraft/server/BlockNote.java
|
|
|
|
+++ b/net/minecraft/server/BlockNote.java
|
2020-03-29 07:24:11 +02:00
|
|
|
@@ -27,7 +27,8 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
if (flag1 != (Boolean) iblockdata.get(BlockNote.POWERED)) {
|
|
|
|
if (flag1) {
|
2018-07-15 02:00:00 +02:00
|
|
|
- this.play(world, blockposition);
|
|
|
|
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
2020-03-29 07:24:11 +02:00
|
|
|
+ iblockdata = world.getType(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockNote.POWERED, flag1), 3);
|
2020-03-29 07:24:11 +02:00
|
|
|
@@ -35,9 +36,14 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
- private void play(World world, BlockPosition blockposition) {
|
|
|
|
+ private void play(World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
|
|
|
|
if (world.getType(blockposition.up()).isAir()) {
|
|
|
|
- world.playBlockAction(blockposition, this, 0, 0);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.get(BlockNote.INSTRUMENT), data.get(BlockNote.NOTE));
|
|
|
|
+ if (!event.isCancelled()) {
|
|
|
|
+ world.playBlockAction(blockposition, this, 0, 0);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-03-29 07:24:11 +02:00
|
|
|
@@ -49,7 +55,7 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
} else {
|
|
|
|
iblockdata = (IBlockData) iblockdata.a((IBlockState) BlockNote.NOTE);
|
|
|
|
world.setTypeAndData(blockposition, iblockdata, 3);
|
|
|
|
- this.play(world, blockposition);
|
|
|
|
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
|
|
|
entityhuman.a(StatisticList.TUNE_NOTEBLOCK);
|
2019-12-10 23:00:00 +01:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
2020-03-29 07:24:11 +02:00
|
|
|
@@ -58,7 +64,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2018-07-15 02:00:00 +02:00
|
|
|
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
- this.play(world, blockposition);
|
|
|
|
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
|
|
|
entityhuman.a(StatisticList.PLAY_NOTEBLOCK);
|
|
|
|
}
|
|
|
|
}
|