SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current

This commit is contained in:
md_5 2020-03-29 16:24:11 +11:00
parent fc318cc10e
commit 4d975ac3b7

View file

@ -1,15 +1,16 @@
--- a/net/minecraft/server/BlockNote.java --- a/net/minecraft/server/BlockNote.java
+++ b/net/minecraft/server/BlockNote.java +++ b/net/minecraft/server/BlockNote.java
@@ -27,7 +27,7 @@ @@ -27,7 +27,8 @@
if (flag1 != (Boolean) iblockdata.get(BlockNote.POWERED)) { if (flag1 != (Boolean) iblockdata.get(BlockNote.POWERED)) {
if (flag1) { if (flag1) {
- this.play(world, blockposition); - this.play(world, blockposition);
+ this.play(world, blockposition, iblockdata); // CraftBukkit + this.play(world, blockposition, iblockdata); // CraftBukkit
+ iblockdata = world.getType(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
} }
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockNote.POWERED, flag1), 3); world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockNote.POWERED, flag1), 3);
@@ -35,9 +35,14 @@ @@ -35,9 +36,14 @@
} }
@ -26,7 +27,7 @@
} }
} }
@@ -49,7 +54,7 @@ @@ -49,7 +55,7 @@
} else { } else {
iblockdata = (IBlockData) iblockdata.a((IBlockState) BlockNote.NOTE); iblockdata = (IBlockData) iblockdata.a((IBlockState) BlockNote.NOTE);
world.setTypeAndData(blockposition, iblockdata, 3); world.setTypeAndData(blockposition, iblockdata, 3);
@ -35,7 +36,7 @@
entityhuman.a(StatisticList.TUNE_NOTEBLOCK); entityhuman.a(StatisticList.TUNE_NOTEBLOCK);
return EnumInteractionResult.SUCCESS; return EnumInteractionResult.SUCCESS;
} }
@@ -58,7 +63,7 @@ @@ -58,7 +64,7 @@
@Override @Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) { public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
if (!world.isClientSide) { if (!world.isClientSide) {