Item Mutation Fixes

This commit is contained in:
Owen1212055 2024-03-20 20:42:31 -04:00
parent 4092b60fa0
commit 53c5e5da09
2 changed files with 13 additions and 2 deletions

View file

@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
public class InventoryBlockStartEvent extends BlockEvent { public class InventoryBlockStartEvent extends BlockEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final ItemStack source; protected ItemStack source; // Paper
public InventoryBlockStartEvent(@NotNull final Block block, @NotNull ItemStack source) { public InventoryBlockStartEvent(@NotNull final Block block, @NotNull ItemStack source) {
super(block); super(block);

View file

@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
public class EnchantItemEvent extends InventoryEvent implements Cancellable { public class EnchantItemEvent extends InventoryEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final Block table; private final Block table;
private final ItemStack item; private ItemStack item; // Paper
private int level; private int level;
private boolean cancelled; private boolean cancelled;
private final Map<Enchantment, Integer> enchants; private final Map<Enchantment, Integer> enchants;
@ -72,6 +72,17 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
return item; 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 * Gets the cost (minimum level) which is displayed as a number on the right
* hand side of the enchantment offer. * hand side of the enchantment offer.