aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0761-Fix-cancelled-powdered-snow-bucket-placement.patch
blob: 21962ca5e62bff3c806d0f6558a4c6f193195b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 9eb6ad597a0e2605eae367038d7541fe538f9a86..e615c8b5c1142f547af77dafb33a8772ab5e13c3 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -358,7 +358,7 @@ public final class ItemStack {
             int oldCount = this.getCount();
             ServerLevel world = (ServerLevel) context.getLevel();
 
-            if (!(item instanceof BucketItem || item instanceof SolidBucketItem)) { // if not bucket
+            if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - capture block states for snow buckets
                 world.captureBlockStates = true;
                 // special case bonemeal
                 if (item == Items.BONE_MEAL) {
@@ -417,7 +417,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());
                 }