diff --git a/patches/server/0884-Fix-inconsistencies-in-dispense-events-regarding-sta.patch b/patches/server/0884-Fix-inconsistencies-in-dispense-events-regarding-sta.patch index 0b3ae447f..964bd1a9d 100644 --- a/patches/server/0884-Fix-inconsistencies-in-dispense-events-regarding-sta.patch +++ b/patches/server/0884-Fix-inconsistencies-in-dispense-events-regarding-sta.patch @@ -86,7 +86,7 @@ index 90e1914599b43c8bf813596b3b428d8be3bac1b5..6df0db8b4cdab23494ea34236949ece4 } diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41cce9222e 100644 +index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..415d387f8cfa3ae99b1c809233c86c18b76ad1e2 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -217,7 +217,7 @@ public interface DispenseItemBehavior { @@ -237,13 +237,13 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 } if (event.isCancelled()) { -+ // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) ++ // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out to be consistent) return stack; } + boolean shrink = true; // Paper if (!event.getItem().equals(craftItem)) { -+ shrink = false; // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) ++ shrink = false; // Paper - shrink below // Chain to handler for new item ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); @@ -333,15 +333,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); if (!DispenserBlock.eventFired) { -@@ -631,6 +641,7 @@ public interface DispenseItemBehavior { - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -@@ -694,7 +705,7 @@ public interface DispenseItemBehavior { +@@ -694,7 +704,7 @@ public interface DispenseItemBehavior { // CraftBukkit start org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); @@ -350,17 +342,16 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); if (!DispenserBlock.eventFired) { -@@ -752,7 +763,9 @@ public interface DispenseItemBehavior { - return stack; - } +@@ -741,7 +751,7 @@ public interface DispenseItemBehavior { -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -+ shrink = false; // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -802,7 +815,7 @@ public interface DispenseItemBehavior { + // CraftBukkit start + org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); +- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); + if (!DispenserBlock.eventFired) { +@@ -802,7 +812,7 @@ public interface DispenseItemBehavior { BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); // CraftBukkit start org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); @@ -369,15 +360,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); if (!DispenserBlock.eventFired) { -@@ -813,6 +826,7 @@ public interface DispenseItemBehavior { - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -@@ -868,7 +882,7 @@ public interface DispenseItemBehavior { +@@ -868,7 +878,7 @@ public interface DispenseItemBehavior { // CraftBukkit start // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); @@ -386,7 +369,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -@@ -878,12 +892,13 @@ public interface DispenseItemBehavior { +@@ -878,12 +888,13 @@ public interface DispenseItemBehavior { } if (event.isCancelled()) { @@ -402,7 +385,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 // Chain to handler for new item ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -899,7 +914,7 @@ public interface DispenseItemBehavior { +@@ -899,7 +910,7 @@ public interface DispenseItemBehavior { worldserver.addFreshEntity(entitytntprimed); worldserver.playSound((Player) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition); @@ -411,7 +394,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 return stack; } }); -@@ -926,7 +941,7 @@ public interface DispenseItemBehavior { +@@ -926,7 +937,7 @@ public interface DispenseItemBehavior { // CraftBukkit start org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); @@ -420,19 +403,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); if (!DispenserBlock.eventFired) { -@@ -934,9 +949,11 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -+ // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -@@ -975,7 +992,7 @@ public interface DispenseItemBehavior { +@@ -975,7 +986,7 @@ public interface DispenseItemBehavior { // CraftBukkit start org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); @@ -441,15 +412,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); if (!DispenserBlock.eventFired) { -@@ -986,6 +1003,7 @@ public interface DispenseItemBehavior { - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -@@ -1048,7 +1066,7 @@ public interface DispenseItemBehavior { +@@ -1048,7 +1059,7 @@ public interface DispenseItemBehavior { // CraftBukkit start org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); @@ -458,14 +421,19 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41 BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); if (!DispenserBlock.eventFired) { -@@ -1059,6 +1077,7 @@ public interface DispenseItemBehavior { - return stack; - } +diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +index e17090003988ad2c890d48666c2234b14d511345..45d356c1ed888b4d749379ceaa8a95d7d7c876d5 100644 +--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +@@ -37,7 +37,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { + ServerLevel worldserver = pointer.level(); + // CraftBukkit start + org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); +- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); + if (!DispenserBlock.eventFired) { diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java index f84987c36a16df19286d6f1badfb1ffb9cc7e770..6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java diff --git a/patches/server/0948-Call-missing-BlockDispenseEvent.patch b/patches/server/0948-Call-missing-BlockDispenseEvent.patch index 67c9651ff..fbe0e558b 100644 --- a/patches/server/0948-Call-missing-BlockDispenseEvent.patch +++ b/patches/server/0948-Call-missing-BlockDispenseEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call missing BlockDispenseEvent diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2caf374cc 100644 +index 415d387f8cfa3ae99b1c809233c86c18b76ad1e2..0286740aabe04e6e78ad6efd003a1e1a1ab6a460 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -1114,6 +1114,13 @@ public interface DispenseItemBehavior { +@@ -1106,6 +1106,13 @@ public interface DispenseItemBehavior { this.setSuccess(true); if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) { if ((Integer) iblockdata.getValue(RespawnAnchorBlock.CHARGE) != 4) { @@ -22,7 +22,7 @@ index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2 RespawnAnchorBlock.charge((Entity) null, worldserver, blockposition, iblockdata); stack.shrink(1); } else { -@@ -1136,6 +1143,13 @@ public interface DispenseItemBehavior { +@@ -1128,6 +1135,13 @@ public interface DispenseItemBehavior { Optional optional = HoneycombItem.getWaxed(iblockdata); if (optional.isPresent()) { @@ -36,7 +36,7 @@ index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2 worldserver.setBlockAndUpdate(blockposition, (BlockState) optional.get()); worldserver.levelEvent(3003, blockposition, 0); stack.shrink(1); -@@ -1161,6 +1175,12 @@ public interface DispenseItemBehavior { +@@ -1153,6 +1167,12 @@ public interface DispenseItemBehavior { if (!worldserver.getBlockState(blockposition1).is(BlockTags.CONVERTABLE_TO_MUD)) { return this.defaultDispenseItemBehavior.dispense(pointer, stack); } else { @@ -50,7 +50,7 @@ index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2 for (int k = 0; k < 5; ++k) { worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 864ff2d3c8e2e2bef744e8048ba0cdbb42787268..c62396041c1546f3136ab6de3b174983f49287b3 100644 +index d55e1611028a836a34dd85f08c4463f1ec15662e..eeed64faf94e55b247ae13eba67336a48834bba6 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -2098,6 +2098,32 @@ public class CraftEventFactory { diff --git a/patches/server/0967-Only-capture-actual-tree-growth.patch b/patches/server/0967-Only-capture-actual-tree-growth.patch index 5d33c3017..bd43e01cd 100644 --- a/patches/server/0967-Only-capture-actual-tree-growth.patch +++ b/patches/server/0967-Only-capture-actual-tree-growth.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Only capture actual tree growth diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 105bb94b844c5ee85b53aca95360e7b2caf374cc..e6ac20a38f31bb0cd6b8840b2518f6992ef7f518 100644 +index 0286740aabe04e6e78ad6efd003a1e1a1ab6a460..f42a86549e389ec53962f7a5e7a625f351cd4724 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -866,6 +866,7 @@ public interface DispenseItemBehavior { +@@ -862,6 +862,7 @@ public interface DispenseItemBehavior { if (!fertilizeEvent.isCancelled()) { for (org.bukkit.block.BlockState blockstate : blocks) { blockstate.update(true);