mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 16:37:44 +01:00
44 lines
3.0 KiB
Diff
44 lines
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Fri, 8 Oct 2021 13:12:58 -0700
|
|
Subject: [PATCH] Fix cancelled powdered snow bucket placement
|
|
|
|
Cancelling the placement of powdered snow from the powdered
|
|
snow bucket didn't revert grass that became snowy because of the
|
|
placement.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
index 893d5bf448ddbccb30db0ee751c7f4a4e83634b9..8f3b9b8784f0d7b137a1ad87655ee8bad801b59d 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
@@ -115,6 +115,7 @@ public class BlockItem extends Item {
|
|
blockstate.update(true, false);
|
|
|
|
if (this instanceof SolidBucketItem) {
|
|
+ ((ServerPlayer) entityhuman).connection.send(new net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket(world, blockposition.below())); // Paper - update block below
|
|
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
|
}
|
|
return InteractionResult.FAIL;
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index a61a309bb921deba8b8022bc4e9fd04c2f8eba63..dc4639f905fb71435daf29c61f64621a3e2cc533 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -325,7 +325,7 @@ public final class ItemStack {
|
|
int oldCount = this.getCount();
|
|
ServerLevel world = (ServerLevel) itemactioncontext.getLevel();
|
|
|
|
- if (!(this.getItem() instanceof BucketItem || this.getItem() instanceof SolidBucketItem)) { // if not bucket
|
|
+ if (!(this.getItem() instanceof BucketItem/* || this.getItem() instanceof SolidBucketItem*/)) { // if not bucket // Paper - capture block states for snow buckets
|
|
world.captureBlockStates = true;
|
|
// special case bonemeal
|
|
if (this.getItem() == Items.BONE_MEAL) {
|
|
@@ -379,7 +379,7 @@ public final class ItemStack {
|
|
world.capturedBlockStates.clear();
|
|
if (blocks.size() > 1) {
|
|
placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
- } else if (blocks.size() == 1) {
|
|
+ } else if (blocks.size() == 1 && item != Items.POWDER_SNOW_BUCKET) { // Paper - don't call event twice for snow buckets
|
|
placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
}
|
|
|