Skip to content

Commit

Permalink
Important formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxplay committed Jul 15, 2024
1 parent 97de9b1 commit 2d64f83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions patches/api/0481-Add-CrafterCraftItemEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ event calls.

diff --git a/src/main/java/io/papermc/paper/event/block/CrafterCraftEvent.java b/src/main/java/io/papermc/paper/event/block/CrafterCraftEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..40a67f1c9de3fb213dbffd6c7c777b696694f294
index 0000000000000000000000000000000000000000..5a7611f0b70012ae2aeac7a6e81e91a9caa40bb2
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/block/CrafterCraftEvent.java
@@ -0,0 +1,105 @@
Expand Down Expand Up @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..40a67f1c9de3fb213dbffd6c7c777b69
+
+ /**
+ * Sets the itemstack the crafter crafted.
+ *
+ * <p>
+ * The crafter will still consume the itemstacks found inside of it according to the original {@link #getRecipe()}
+ * however, it will dispense the passed itemstack instead of the usual recipes result.
+ *
Expand All @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..40a67f1c9de3fb213dbffd6c7c777b69
+ * <p>
+ * Cancelling this event prevents the crafter from crafting, leaving its inventory untouched.
+ *
+ * @param cancel true if you wish to cancel this event
+ * @param cancel {@code true} if you wish to cancel this event
+ */
+ @Override
+ public void setCancelled(final boolean cancel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The patch may be expanded in the future for more crafter related
event calls.

diff --git a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java
index 6c24b25a7c8ce6e34aceb5702f1a0a6732ebca44..e05f69884ace9150a39e9347903e4985435c2203 100644
index 6c24b25a7c8ce6e34aceb5702f1a0a6732ebca44..1f5621d7f256c225bc410c1cdaecbcea0c5cd9a1 100644
--- a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java
@@ -166,6 +166,15 @@ public class CrafterBlock extends BaseEntityBlock {
Expand All @@ -24,7 +24,7 @@ index 6c24b25a7c8ce6e34aceb5702f1a0a6732ebca44..e05f69884ace9150a39e9347903e4985
+ );
+ if (!event.callEvent()) return;
+
+ itemStack = org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getResult());
+ itemStack = org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getResult());
+ // Paper end - add CrafterCraftEvent - fire event
+
crafterBlockEntity.setCraftingTicksRemaining(6);
Expand Down

0 comments on commit 2d64f83

Please sign in to comment.