|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Jake Potrebic <jake.m.potrebic@gmail.com> |
| 3 | +Date: Fri, 8 Oct 2021 13:12:58 -0700 |
| 4 | +Subject: [PATCH] Fix cancelled powdered snow bucket placement |
| 5 | + |
| 6 | +Cancelling the placement of powdered snow from the powdered |
| 7 | +snow bucket didn't revert grass that became snowy because of the |
| 8 | +placement. |
| 9 | + |
| 10 | +diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java |
| 11 | +index 893d5bf448ddbccb30db0ee751c7f4a4e83634b9..8f3b9b8784f0d7b137a1ad87655ee8bad801b59d 100644 |
| 12 | +--- a/src/main/java/net/minecraft/world/item/BlockItem.java |
| 13 | ++++ b/src/main/java/net/minecraft/world/item/BlockItem.java |
| 14 | +@@ -115,6 +115,7 @@ public class BlockItem extends Item { |
| 15 | + blockstate.update(true, false); |
| 16 | + |
| 17 | + if (this instanceof SolidBucketItem) { |
| 18 | ++ ((ServerPlayer) entityhuman).connection.send(new net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket(world, blockposition.below())); // Paper - update block below |
| 19 | + ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 |
| 20 | + } |
| 21 | + return InteractionResult.FAIL; |
| 22 | +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java |
| 23 | +index 66f808cabcf6a9a6584849b285f1c60133adc7b4..8bd12326e591213f0a093b96a5af3f04e19dc980 100644 |
| 24 | +--- a/src/main/java/net/minecraft/world/item/ItemStack.java |
| 25 | ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java |
| 26 | +@@ -315,7 +315,7 @@ public final class ItemStack { |
| 27 | + int oldCount = this.getCount(); |
| 28 | + ServerLevel world = (ServerLevel) itemactioncontext.getLevel(); |
| 29 | + |
| 30 | +- if (!(this.getItem() instanceof BucketItem || this.getItem() instanceof SolidBucketItem)) { // if not bucket |
| 31 | ++ if (!(this.getItem() instanceof BucketItem/* || this.getItem() instanceof SolidBucketItem*/)) { // if not bucket // Paper - capture block states for snow buckets |
| 32 | + world.captureBlockStates = true; |
| 33 | + // special case bonemeal |
| 34 | + if (this.getItem() == Items.BONE_MEAL) { |
| 35 | +@@ -369,7 +369,7 @@ public final class ItemStack { |
| 36 | + world.capturedBlockStates.clear(); |
| 37 | + if (blocks.size() > 1) { |
| 38 | + placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ()); |
| 39 | +- } else if (blocks.size() == 1) { |
| 40 | ++ } else if (blocks.size() == 1 && item != Items.POWDER_SNOW_BUCKET) { // Paper - don't call event twice for snow buckets |
| 41 | + placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ()); |
| 42 | + } |
| 43 | + |
0 commit comments