Paper/patches/api/0456-Item-Mutation-Fixes.patch
Bjarne Koll e1c0033552
Updated Upstream (Bukkit/CraftBukkit)
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:
2b4b6d14 PR-1023: Convert InventoryView to interface

CraftBukkit Changes:
68603b1c1 Use expanded interaction ranges for traced interact events
eae9f760c PR-1414: Convert InventoryView to interface
ee9eafe67 Fix Implementation for DamageSource#isIndirect for internal custom causing entity
2024-06-16 17:23:42 +02:00

51 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 20 Mar 2024 20:42:31 -0400
Subject: [PATCH] Item Mutation Fixes
diff --git a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java
index 1ebd45295a29fbc990a1311a7f0fe7f42ac79275..b70450919e78e869c9f158c4e3e25944bcaa73f2 100644
--- a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java
+++ b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
public class InventoryBlockStartEvent extends BlockEvent {
private static final HandlerList handlers = new HandlerList();
- private final ItemStack source;
+ protected ItemStack source; // Paper
public InventoryBlockStartEvent(@NotNull final Block block, @NotNull ItemStack source) {
super(block);
diff --git a/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java b/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java
index 1829529c9915937dcdd0e6d1ceba9e64819fb93f..e7c243038b70ca13b7eabdf88ce518b6198c6db9 100644
--- a/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java
+++ b/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
public class EnchantItemEvent extends InventoryEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Block table;
- private final ItemStack item;
+ private ItemStack item; // Paper
private int level;
private boolean cancelled;
private final Map<Enchantment, Integer> enchants;
@@ -72,6 +72,17 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
return item;
}
+ // Paper start
+ /**
+ * Sets the item to be enchanted
+ *
+ * @param item item
+ */
+ public void setItem(@NotNull final ItemStack item) {
+ this.item = item;
+ }
+ // Paper end
+
/**
* Gets the cost (minimum level) which is displayed as a number on the right
* hand side of the enchantment offer.