2021-06-14 21:58:32 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2021-09-20 11:30:04 +02:00
|
|
|
From: Madeline Miller <mnmiller1@me.com>
|
2021-06-14 21:58:32 +02:00
|
|
|
Date: Sun, 17 Jan 2021 13:16:09 +1000
|
2024-01-19 22:13:42 +01:00
|
|
|
Subject: [PATCH] Add BlockPreDispenseEvent
|
2021-06-14 21:58:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
2024-01-20 23:13:41 +01:00
|
|
|
index 5593a0aa9e618071b6521b213dde0f628348c3dc..644e64850479cea20a98b8a65503ccf3a34fd32a 100644
|
2021-06-14 21:58:32 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
2023-12-06 04:00:14 +01:00
|
|
|
@@ -104,6 +104,7 @@ public class DispenserBlock extends BaseEntityBlock {
|
2023-09-22 07:41:27 +02:00
|
|
|
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
2021-06-14 21:58:32 +02:00
|
|
|
|
2023-09-22 07:41:27 +02:00
|
|
|
if (idispensebehavior != DispenseItemBehavior.NOOP) {
|
2024-01-20 23:13:41 +01:00
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent
|
2023-09-22 07:41:27 +02:00
|
|
|
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
|
|
|
|
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
|
|
|
|
}
|
2024-02-10 22:19:22 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
|
|
|
index 1d13f8a1009d6eda351c697052d499d594a6aaa8..9a8a0fb958e8ec782111507bae957f854b2aac72 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
|
|
|
@@ -70,6 +70,7 @@ public class DropperBlock extends DispenserBlock {
|
|
|
|
ItemStack itemstack1;
|
|
|
|
|
|
|
|
if (iinventory == null) {
|
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent
|
|
|
|
itemstack1 = DropperBlock.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
|
|
|
|
} else {
|
|
|
|
// CraftBukkit start - Fire event when pushing items into other inventories
|
2021-06-14 21:58:32 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
index 0a44f7f2ab9c824f1a32d9dc5feb6a96eb00d8de..4b3e246475821b71fe023fea602d68c0e2f84964 100644
|
2021-06-14 21:58:32 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -2040,5 +2040,11 @@ public class CraftEventFactory {
|
2021-06-14 21:58:32 +02:00
|
|
|
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
|
|
|
|
return event.callEvent();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean handleBlockPreDispenseEvent(ServerLevel serverLevel, BlockPos pos, ItemStack itemStack, int slot) {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ org.bukkit.block.Block block = CraftBlock.at(serverLevel, pos);
|
2021-06-14 21:58:32 +02:00
|
|
|
+ io.papermc.paper.event.block.BlockPreDispenseEvent event = new io.papermc.paper.event.block.BlockPreDispenseEvent(block, org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), slot);
|
|
|
|
+ return event.callEvent();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|