@@ -1,47 +1,47 @@
|
||||
--- a/net/minecraft/world/level/block/BlockNote.java
|
||||
+++ b/net/minecraft/world/level/block/BlockNote.java
|
||||
@@ -49,7 +49,8 @@
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
if (flag1 != (Boolean) iblockdata.get(BlockNote.POWERED)) {
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
|
||||
if (flag1) {
|
||||
- this.play(world, blockposition);
|
||||
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
||||
+ iblockdata = world.getType(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
||||
- this.playNote(world, blockposition);
|
||||
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
|
||||
+ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
||||
}
|
||||
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockNote.POWERED, flag1), 3);
|
||||
@@ -57,9 +58,14 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
|
||||
@@ -56,9 +57,14 @@
|
||||
|
||||
}
|
||||
|
||||
- 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);
|
||||
- private void playNote(World world, BlockPosition blockposition) {
|
||||
+ private void playNote(World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
|
||||
if (world.getBlockState(blockposition.above()).isAir()) {
|
||||
- world.blockEvent(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));
|
||||
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(BlockNote.INSTRUMENT), data.getValue(BlockNote.NOTE));
|
||||
+ if (!event.isCancelled()) {
|
||||
+ world.playBlockAction(blockposition, this, 0, 0);
|
||||
+ world.blockEvent(blockposition, this, 0, 0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,7 +77,7 @@
|
||||
@@ -70,7 +76,7 @@
|
||||
} 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);
|
||||
iblockdata = (IBlockData) iblockdata.cycle(BlockNote.NOTE);
|
||||
world.setBlock(blockposition, iblockdata, 3);
|
||||
- this.playNote(world, blockposition);
|
||||
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.awardStat(StatisticList.TUNE_NOTEBLOCK);
|
||||
return EnumInteractionResult.CONSUME;
|
||||
}
|
||||
@@ -80,7 +86,7 @@
|
||||
@@ -79,7 +85,7 @@
|
||||
@Override
|
||||
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);
|
||||
- this.playNote(world, blockposition);
|
||||
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.awardStat(StatisticList.PLAY_NOTEBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user