diff --git a/patches/server/Fix-block-place-logic.patch b/patches/server/Fix-block-place-logic.patch index 30f43fe016..3c5f8891d2 100644 --- a/patches/server/Fix-block-place-logic.patch +++ b/patches/server/Fix-block-place-logic.patch @@ -3,6 +3,10 @@ From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Mon, 3 Apr 2023 18:46:49 +0200 Subject: [PATCH] Fix block place logic +Fix several issues when a player interact with a block: +* the place sound isn't played for the dispensed shulker block +* desync of the jukebox blocks between bukkit handler and the vanilla interaction +* poi can desync when the BlockPhysicsEvent is cancelled diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -36,3 +40,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(entityhuman, world.getBlockState(blockposition))); } +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // CraftBukkit start + iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam + CraftWorld world = ((ServerLevel) this).getWorld(); ++ boolean cancelledUpdates = false; // Paper + if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper + BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); + this.getCraftServer().getPluginManager().callEvent(event); + +- if (event.isCancelled()) { +- return; +- } ++ cancelledUpdates = event.isCancelled(); // Paper + } + // CraftBukkit end ++ if (!cancelledUpdates) { // Paper + iblockdata.updateNeighbourShapes(this, blockposition, k, j - 1); + iblockdata.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); ++ } // Paper + } + + // CraftBukkit start - SPIGOT-5710 diff --git a/patches/server/Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/Fix-piston-physics-inconsistency-MC-188840.patch index 40fa67fd50..439ef42094 100644 --- a/patches/server/Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/Fix-piston-physics-inconsistency-MC-188840.patch @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, allowDesync ? list1.get(k) : iblockdata1, dir, retract, false)); + if (!allowDesync) { -+ world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), 2 | 4 | 16 | 1024); // set air to prevent later physics updates from seeing this block ++ world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_MOVE_BY_PISTON | 1024); // set air to prevent later physics updates from seeing this block + } + // Paper end - fix a variety of piston desync dupes aiblockdata[j++] = iblockdata1; @@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos); if (blockState.isAir()) { - world.setBlock(pos, blockEntity.movedState, 84); -+ world.setBlock(pos, blockEntity.movedState, io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication ? 84 : (84 | 2)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air ++ world.setBlock(pos, blockEntity.movedState, io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication ? 84 : (84 | Block.UPDATE_CLIENTS)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air Block.updateOrDestroy(blockEntity.movedState, blockState, world, pos, 3); } else { if (blockState.hasProperty(BlockStateProperties.WATERLOGGED) && blockState.getValue(BlockStateProperties.WATERLOGGED)) {