2023-09-18 04:16:48 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Mon, 24 Jan 2022 00:09:02 -0800
|
|
|
|
Subject: [PATCH] Add missing InventoryHolders to inventories
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/Container.java b/src/main/java/net/minecraft/world/Container.java
|
2024-04-25 00:36:49 +02:00
|
|
|
index 39f126347459a68e8bcc59e374a1b9fe507b7497..f402dbbfe3a443e6bc51f88b85abe937852b52f0 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/Container.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/Container.java
|
2024-04-25 00:36:49 +02:00
|
|
|
@@ -103,7 +103,7 @@ public interface Container extends Clearable {
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
java.util.List<org.bukkit.entity.HumanEntity> getViewers();
|
|
|
|
|
|
|
|
- org.bukkit.inventory.InventoryHolder getOwner();
|
|
|
|
+ org.bukkit.inventory.@org.jetbrains.annotations.Nullable InventoryHolder getOwner(); // Paper - annotation
|
|
|
|
|
|
|
|
void setMaxStackSize(int size);
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java
|
2024-04-25 00:36:49 +02:00
|
|
|
index 6632cf24ebe6d147950a1fdb876660937da86b73..d04bf7d06855022c973073fb84c5d3d65f2553e1 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/SimpleContainer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/SimpleContainer.java
|
|
|
|
@@ -30,7 +30,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
|
|
|
// CraftBukkit start - add fields and methods
|
|
|
|
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
|
|
private int maxStack = MAX_STACK;
|
|
|
|
- protected org.bukkit.inventory.InventoryHolder bukkitOwner;
|
|
|
|
+ protected @Nullable org.bukkit.inventory.InventoryHolder bukkitOwner; // Paper - annotation
|
|
|
|
|
|
|
|
public List<ItemStack> getContents() {
|
|
|
|
return this.items;
|
|
|
|
@@ -58,6 +58,11 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
|
|
|
}
|
|
|
|
|
|
|
|
public org.bukkit.inventory.InventoryHolder getOwner() {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ if (this.bukkitOwner == null && this.bukkitOwnerCreator != null) {
|
|
|
|
+ this.bukkitOwner = this.bukkitOwnerCreator.get();
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
return this.bukkitOwner;
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -86,6 +91,13 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
|
|
|
public SimpleContainer(int size) {
|
|
|
|
this(size, null);
|
|
|
|
}
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator;
|
|
|
|
+ public SimpleContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator, int size) {
|
|
|
|
+ this(size);
|
|
|
|
+ this.bukkitOwnerCreator = bukkitOwnerCreator;
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
public SimpleContainer(int i, org.bukkit.inventory.InventoryHolder owner) {
|
|
|
|
this.bukkitOwner = owner;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
index 428e454116804c27496cfbf796edd44780890d33..4c7e91977fa590abfe7eb3704d8008ed6d4e3ab3 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
@@ -991,4 +991,15 @@ public abstract class AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
this.stateId = this.stateId + 1 & 32767;
|
|
|
|
return this.stateId;
|
|
|
|
}
|
|
|
|
+
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ // The reason this is a supplier, is that the createHolder method uses the bukkit InventoryView#getTopInventory to get the inventory in question
|
|
|
|
+ // and that can't be obtained safely until the AbstractContainerMenu has been fully constructed. Using a supplier lazily
|
|
|
|
+ // initializes the InventoryHolder safely.
|
|
|
|
+ protected final Supplier<org.bukkit.inventory.BlockInventoryHolder> createBlockHolder(final ContainerLevelAccess context) {
|
|
|
|
+ //noinspection ConstantValue
|
|
|
|
+ Preconditions.checkArgument(context != null, "context was null");
|
|
|
|
+ return () -> context.createBlockHolder(this);
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
2024-05-11 23:48:37 +02:00
|
|
|
index 1b6fd16d8c6195c6f7b65c7621d5f9bd15c46a75..7f513e8c4f81524aee9326ddbbc6bec0b3fa1b27 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
@@ -42,7 +42,7 @@ public class BeaconMenu extends AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
public BeaconMenu(int syncId, Container inventory, ContainerData propertyDelegate, ContainerLevelAccess context) {
|
|
|
|
super(MenuType.BEACON, syncId);
|
|
|
|
this.player = (Inventory) inventory; // CraftBukkit - TODO: check this
|
2024-04-25 00:36:49 +02:00
|
|
|
- this.beacon = new SimpleContainer(1) { // CraftBukkit - decompile error
|
|
|
|
+ this.beacon = new SimpleContainer(this.createBlockHolder(context), 1) { // CraftBukkit - decompile error // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public boolean canPlaceItem(int slot, ItemStack stack) {
|
|
|
|
return stack.is(ItemTags.BEACON_PAYMENT_ITEMS);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
index c52c4c4210bc6ae082443318d9795c48c816aba6..ab98637bf967ac19f0bc06e8cb7f18a8b13ec809 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
@@ -54,7 +54,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
public CartographyTableMenu(int syncId, Inventory inventory, final ContainerLevelAccess context) {
|
|
|
|
super(MenuType.CARTOGRAPHY_TABLE, syncId);
|
|
|
|
- this.container = new SimpleContainer(2) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.container = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
CartographyTableMenu.this.slotsChanged(this);
|
2024-04-25 00:36:49 +02:00
|
|
|
@@ -68,7 +68,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
};
|
|
|
|
- this.resultContainer = new ResultContainer() {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.resultContainer = new ResultContainer(this.createBlockHolder(context)) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
CartographyTableMenu.this.slotsChanged(this);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
|
2024-01-19 12:30:04 +01:00
|
|
|
index 85e336637db8643fc5aca1dba724c9b341cbf46f..12b466ccb7c36021cf807c4f3fd2bcb037943abc 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
|
|
|
|
@@ -21,6 +21,18 @@ public interface ContainerLevelAccess {
|
|
|
|
return new org.bukkit.Location(this.getWorld().getWorld(), this.getPosition().getX(), this.getPosition().getY(), this.getPosition().getZ());
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ default boolean isBlock() {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ default org.bukkit.inventory.@org.jetbrains.annotations.Nullable BlockInventoryHolder createBlockHolder(AbstractContainerMenu menu) {
|
|
|
|
+ if (!this.isBlock()) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return new org.bukkit.craftbukkit.inventory.CraftBlockInventoryHolder(this, menu.getBukkitView().getTopInventory());
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
ContainerLevelAccess NULL = new ContainerLevelAccess() {
|
|
|
|
@Override
|
|
|
|
@@ -48,6 +60,12 @@ public interface ContainerLevelAccess {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean isBlock() {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> getter) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
2024-05-11 23:48:37 +02:00
|
|
|
index 18612988acaee570038bffd1361aa3ffdc938852..2f62957e061f513e01ec617f22791a7f27d65f02 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
2024-05-11 23:48:37 +02:00
|
|
|
@@ -60,7 +60,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
public EnchantmentMenu(int syncId, Inventory playerInventory, ContainerLevelAccess context) {
|
|
|
|
super(MenuType.ENCHANTMENT, syncId);
|
|
|
|
- this.enchantSlots = new SimpleContainer(2) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.enchantSlots = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
super.setChanged();
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
index ecf3cdc16d1ea830c4d45b57f69204118af3218a..db9444dda248260372d96ce239a590e88a4c1142 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
|
|
|
@@ -59,8 +59,8 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
|
|
|
|
|
|
|
public GrindstoneMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
|
|
|
|
super(MenuType.GRINDSTONE, syncId);
|
|
|
|
- this.resultSlots = new ResultContainer();
|
|
|
|
- this.repairSlots = new SimpleContainer(2) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.resultSlots = new ResultContainer(this.createBlockHolder(context)); // Paper - Add missing InventoryHolders
|
|
|
|
+ this.repairSlots = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
super.setChanged();
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
2024-04-25 00:36:49 +02:00
|
|
|
index be840717e180b6b5abd14db6cc9263349737f9a3..7de5e47f9a54263734eeef855a2dc07ef64d30ea 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
|
|
|
@@ -18,7 +18,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
|
|
|
protected final Player player;
|
|
|
|
protected final Container inputSlots;
|
|
|
|
private final List<Integer> inputSlotIndexes;
|
|
|
|
- protected final ResultContainer resultSlots = new ResultContainer();
|
2024-01-13 18:34:33 +01:00
|
|
|
+ protected final ResultContainer resultSlots; // Paper - Add missing InventoryHolders; delay field init
|
2023-09-18 04:16:48 +02:00
|
|
|
private final int resultSlotIndex;
|
|
|
|
|
|
|
|
protected abstract boolean mayPickup(Player player, boolean present);
|
|
|
|
@@ -30,6 +30,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
|
|
|
public ItemCombinerMenu(@Nullable MenuType<?> type, int syncId, Inventory playerInventory, ContainerLevelAccess context) {
|
|
|
|
super(type, syncId);
|
|
|
|
this.access = context;
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.resultSlots = new ResultContainer(this.createBlockHolder(this.access)); // Paper - Add missing InventoryHolders; delay field init
|
2023-09-18 04:16:48 +02:00
|
|
|
this.player = playerInventory.player;
|
|
|
|
ItemCombinerMenuSlotDefinition itemcombinermenuslotdefinition = this.createInputSlotDefinitions();
|
|
|
|
|
|
|
|
@@ -96,7 +97,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
|
|
|
protected abstract ItemCombinerMenuSlotDefinition createInputSlotDefinitions();
|
|
|
|
|
|
|
|
private SimpleContainer createContainer(int size) {
|
|
|
|
- return new SimpleContainer(size) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ return new SimpleContainer(this.createBlockHolder(this.access), size) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
super.setChanged();
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
2024-04-26 07:44:49 +02:00
|
|
|
index 72ad78659a373213ed1f37498754adaf18f1f68b..4f3f6ea43030853bd9df067358a1f4d16c40e6d4 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
|
|
|
@@ -73,7 +73,7 @@ public class LoomMenu extends AbstractContainerMenu {
|
|
|
|
this.selectablePatterns = List.of();
|
|
|
|
this.slotUpdateListener = () -> {
|
|
|
|
};
|
|
|
|
- this.inputContainer = new SimpleContainer(3) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.inputContainer = new SimpleContainer(this.createBlockHolder(context), 3) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
super.setChanged();
|
|
|
|
@@ -88,7 +88,7 @@ public class LoomMenu extends AbstractContainerMenu {
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
};
|
|
|
|
- this.outputContainer = new SimpleContainer(1) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.outputContainer = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
super.setChanged();
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/ResultContainer.java b/src/main/java/net/minecraft/world/inventory/ResultContainer.java
|
2024-01-13 18:34:33 +01:00
|
|
|
index d4592218d761eb38402e3d95c642e80a708cb333..4c4266a85c38e41e6c7e6144a68624f4daa50c54 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/ResultContainer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/ResultContainer.java
|
2023-09-22 18:59:52 +02:00
|
|
|
@@ -29,7 +29,12 @@ public class ResultContainer implements Container, RecipeCraftingHolder {
|
2023-09-18 04:16:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public org.bukkit.inventory.InventoryHolder getOwner() {
|
|
|
|
- return null; // Result slots don't get an owner
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ if (this.holder == null && this.holderCreator != null) {
|
|
|
|
+ this.holder = this.holderCreator.get();
|
|
|
|
+ }
|
|
|
|
+ return this.holder; // Result slots don't get an owner
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Don't need a transaction; the InventoryCrafting keeps track of it for us
|
2023-09-22 18:59:52 +02:00
|
|
|
@@ -53,6 +58,14 @@ public class ResultContainer implements Container, RecipeCraftingHolder {
|
2023-09-18 04:16:48 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> holderCreator;
|
|
|
|
+ private @Nullable org.bukkit.inventory.InventoryHolder holder;
|
|
|
|
+ public ResultContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> holderCreator) {
|
|
|
|
+ this();
|
|
|
|
+ this.holderCreator = holderCreator;
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
public ResultContainer() {
|
|
|
|
this.itemStacks = NonNullList.withSize(1, ItemStack.EMPTY);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
Updated Upstream (Bukkit/CraftBukkit) (#10242)
* 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:
a6a9d2a4 Remove some old ApiStatus.Experimental annotations
be72314c SPIGOT-7300, PR-829: Add new DamageSource API providing enhanced information about entity damage
b252cf05 SPIGOT-7576, PR-970: Add methods in MushroomCow to change stew effects
b1c689bd PR-902: Add Server#isLoggingIPs to get log-ips configuration
08f86d1c PR-971: Add Player methods for client-side potion effects
2e3024a9 PR-963: Add API for in-world structures
a23292a7 SPIGOT-7530, PR-948: Improve Resource Pack API with new 1.20.3 functionality
1851857b SPIGOT-3071, PR-969: Add entity spawn method with spawn reason
cde4c52a SPIGOT-5553, PR-964: Add EntityKnockbackEvent
CraftBukkit Changes:
38fd4bd50 Fix accidentally renamed internal damage method
80f0ce4be SPIGOT-7300, PR-1180: Add new DamageSource API providing enhanced information about entity damage
7e43f3b16 SPIGOT-7581: Fix typo in BlockMushroom
ea14b7d90 SPIGOT-7576, PR-1347: Add methods in MushroomCow to change stew effects
4c687f243 PR-1259: Add Server#isLoggingIPs to get log-ips configuration
22a541a29 Improve support for per-world game rules
cb7dccce2 PR-1348: Add Player methods for client-side potion effects
b8d6109f0 PR-1335: Add API for in-world structures
4398a1b5b SPIGOT-7577: Make CraftWindCharge#explode discard the entity
e74107678 Fix Crafter maximum stack size
0bb0f4f6a SPIGOT-7530, PR-1314: Improve Resource Pack API with new 1.20.3 functionality
4949f556d SPIGOT-3071, PR-1345: Add entity spawn method with spawn reason
20ac73ca2 PR-1353: Fix Structure#place not working as documented with 0 palette
3c1b77871 SPIGOT-6911, PR-1349: Change max book length in CraftMetaBook
333701839 SPIGOT-7572: Bee nests generated without bees
f48f4174c SPIGOT-5553, PR-1336: Add EntityKnockbackEvent
2024-02-11 22:28:00 +01:00
|
|
|
index 1a5d8debc053b24e5856de916f1d248b36f645ba..eade15820dd9db38b6af2a5c4314acfb14ca03e9 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
2023-09-22 18:59:52 +02:00
|
|
|
@@ -68,7 +68,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
this.input = ItemStack.EMPTY;
|
|
|
|
this.slotUpdateListener = () -> {
|
|
|
|
};
|
|
|
|
- this.container = new SimpleContainer(1) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.container = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
@Override
|
|
|
|
public void setChanged() {
|
|
|
|
super.setChanged();
|
2023-09-22 18:59:52 +02:00
|
|
|
@@ -83,7 +83,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
2023-09-18 04:16:48 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
};
|
|
|
|
- this.resultContainer = new ResultContainer();
|
2024-01-13 18:34:33 +01:00
|
|
|
+ this.resultContainer = new ResultContainer(this.createBlockHolder(context)); // Paper - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
this.access = context;
|
|
|
|
this.level = playerInventory.player.level();
|
|
|
|
this.inputSlot = this.addSlot(new Slot(this.container, 0, 20, 33));
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java
|
2024-01-13 18:34:33 +01:00
|
|
|
index 7ae484b0fa5bf5494c6ead15f7f1c0fa840ae270..7129eb5f5cea39992b4c690cb421004004a952ea 100644
|
2023-09-18 04:16:48 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java
|
|
|
|
@@ -17,6 +17,13 @@ public class CraftBlockInventoryHolder implements BlockInventoryHolder {
|
|
|
|
this.block = CraftBlock.at(world, pos);
|
|
|
|
this.inventory = new CraftInventory(inv);
|
|
|
|
}
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper start - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
+ public CraftBlockInventoryHolder(net.minecraft.world.inventory.ContainerLevelAccess levelAccess, Inventory inventory) {
|
|
|
|
+ com.google.common.base.Preconditions.checkArgument(levelAccess.isBlock());
|
|
|
|
+ this.block = CraftBlock.at(levelAccess.getWorld(), levelAccess.getPosition());
|
|
|
|
+ this.inventory = inventory;
|
|
|
|
+ }
|
2024-01-13 18:34:33 +01:00
|
|
|
+ // Paper end - Add missing InventoryHolders
|
2023-09-18 04:16:48 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Block getBlock() {
|