2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2022-02-23 00:00:45 +01:00
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
2021-06-11 14:02:28 +02:00
|
|
|
Date: Mon, 5 Nov 2018 04:23:51 +0000
|
|
|
|
Subject: [PATCH] Restore custom InventoryHolder support
|
|
|
|
|
|
|
|
Upstream removed the ability to consistently use a custom InventoryHolder,
|
|
|
|
However, the implementation does not use an InventoryHolder in any form
|
|
|
|
outside of custom inventories.
|
|
|
|
|
2022-11-20 00:53:20 +01:00
|
|
|
== AT ==
|
|
|
|
public-f net.minecraft.world.inventory.AbstractContainerMenu dataSlots
|
|
|
|
public-f net.minecraft.world.inventory.AbstractContainerMenu remoteDataSlots
|
|
|
|
|
|
|
|
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
|
|
|
|
|
2022-02-23 00:00:45 +01:00
|
|
|
diff --git a/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java b/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java
|
|
|
|
new file mode 100644
|
2022-05-26 21:12:14 +02:00
|
|
|
index 0000000000000000000000000000000000000000..224d4b2cc45b0d02230a76caee9c88573a448b4c
|
2022-02-23 00:00:45 +01:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java
|
2022-05-26 21:12:14 +02:00
|
|
|
@@ -0,0 +1,141 @@
|
2022-02-23 00:00:45 +01:00
|
|
|
+package io.papermc.paper.inventory;
|
|
|
|
+
|
|
|
|
+import io.papermc.paper.adventure.PaperAdventure;
|
|
|
|
+import net.kyori.adventure.text.Component;
|
2022-05-26 21:12:14 +02:00
|
|
|
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
2022-02-23 00:00:45 +01:00
|
|
|
+import net.minecraft.world.Container;
|
|
|
|
+import net.minecraft.world.entity.player.Player;
|
|
|
|
+import net.minecraft.world.item.ItemStack;
|
|
|
|
+import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
|
|
|
|
+import org.bukkit.Location;
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
|
|
+import org.bukkit.entity.HumanEntity;
|
|
|
|
+import org.bukkit.event.inventory.InventoryType;
|
|
|
|
+import org.bukkit.inventory.InventoryHolder;
|
|
|
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
|
|
|
+import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
|
+import org.checkerframework.framework.qual.DefaultQualifier;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@DefaultQualifier(NonNull.class)
|
|
|
|
+public final class PaperInventoryCustomHolderContainer implements Container {
|
|
|
|
+
|
|
|
|
+ private final InventoryHolder owner;
|
|
|
|
+ private final Container delegate;
|
|
|
|
+ private final InventoryType type;
|
|
|
|
+ private final String title;
|
|
|
|
+ private final Component adventure$title;
|
|
|
|
+
|
|
|
|
+ public PaperInventoryCustomHolderContainer(InventoryHolder owner, Container delegate, InventoryType type) {
|
|
|
|
+ this.owner = owner;
|
|
|
|
+ this.delegate = delegate;
|
|
|
|
+ this.type = type;
|
|
|
|
+ @Nullable Component adventure$title = null;
|
|
|
|
+ if (delegate instanceof BaseContainerBlockEntity blockEntity) {
|
|
|
|
+ adventure$title = blockEntity.getCustomName() != null ? PaperAdventure.asAdventure(blockEntity.getCustomName()) : null;
|
|
|
|
+ }
|
|
|
|
+ if (adventure$title == null) {
|
|
|
|
+ adventure$title = type.defaultTitle();
|
|
|
|
+ }
|
|
|
|
+ this.adventure$title = adventure$title;
|
2022-05-26 21:12:14 +02:00
|
|
|
+ this.title = LegacyComponentSerializer.legacySection().serialize(this.adventure$title);
|
2022-02-23 00:00:45 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Component title() {
|
|
|
|
+ return this.adventure$title;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getTitle() {
|
|
|
|
+ return this.title;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public InventoryType getType() {
|
|
|
|
+ return this.type;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getContainerSize() {
|
|
|
|
+ return this.delegate.getContainerSize();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isEmpty() {
|
|
|
|
+ return this.delegate.isEmpty();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ItemStack getItem(int slot) {
|
|
|
|
+ return this.delegate.getItem(slot);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ItemStack removeItem(int slot, int amount) {
|
|
|
|
+ return this.delegate.removeItem(slot, amount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ItemStack removeItemNoUpdate(int slot) {
|
|
|
|
+ return this.delegate.removeItemNoUpdate(slot);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setItem(int slot, ItemStack stack) {
|
|
|
|
+ this.delegate.setItem(slot, stack);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getMaxStackSize() {
|
|
|
|
+ return this.delegate.getMaxStackSize();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setChanged() {
|
|
|
|
+ this.delegate.setChanged();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean stillValid(Player player) {
|
|
|
|
+ return this.delegate.stillValid(player);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<ItemStack> getContents() {
|
|
|
|
+ return this.delegate.getContents();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onOpen(CraftHumanEntity who) {
|
|
|
|
+ this.delegate.onOpen(who);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onClose(CraftHumanEntity who) {
|
|
|
|
+ this.delegate.onClose(who);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<HumanEntity> getViewers() {
|
|
|
|
+ return this.delegate.getViewers();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public InventoryHolder getOwner() {
|
|
|
|
+ return this.owner;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setMaxStackSize(int size) {
|
|
|
|
+ this.delegate.setMaxStackSize(size);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Location getLocation() {
|
|
|
|
+ return this.delegate.getLocation();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void clearContent() {
|
|
|
|
+ this.delegate.clearContent();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
2024-06-16 17:21:14 +02:00
|
|
|
index 867091ff253541ec45b6ae7f1fb3acc83a5c4966..10a5b1853d3984427209c87bdec1d471dddb1244 100644
|
2022-02-23 00:00:45 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
2024-06-15 18:28:18 +02:00
|
|
|
@@ -49,7 +49,7 @@ public class CraftContainer extends AbstractContainerMenu {
|
2023-05-12 13:10:08 +02:00
|
|
|
public CraftContainer(final Inventory inventory, final Player player, int id) {
|
2024-06-16 17:21:14 +02:00
|
|
|
this(new CraftAbstractInventoryView() {
|
2023-05-12 13:10:08 +02:00
|
|
|
|
|
|
|
- private final String originalTitle = (inventory instanceof CraftInventoryCustom) ? ((CraftInventoryCustom.MinecraftInventory) ((CraftInventory) inventory).getInventory()).getTitle() : inventory.getType().getDefaultTitle();
|
|
|
|
+ private final String originalTitle = inventory instanceof CraftInventoryCustom ? ((CraftInventoryCustom) inventory).getTitle() : inventory.getType().getDefaultTitle(); // Paper
|
|
|
|
private String title = this.originalTitle;
|
|
|
|
|
|
|
|
@Override
|
2024-06-15 18:28:18 +02:00
|
|
|
@@ -75,7 +75,7 @@ public class CraftContainer extends AbstractContainerMenu {
|
2022-02-23 00:00:45 +01:00
|
|
|
// Paper start
|
|
|
|
@Override
|
|
|
|
public net.kyori.adventure.text.Component title() {
|
|
|
|
- return inventory instanceof CraftInventoryCustom ? ((CraftInventoryCustom.MinecraftInventory) ((CraftInventory) inventory).getInventory()).title() : net.kyori.adventure.text.Component.text(inventory.getType().getDefaultTitle());
|
|
|
|
+ return inventory instanceof CraftInventoryCustom custom ? custom.title() : inventory.getType().defaultTitle(); // Paper
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
|
2024-06-15 18:28:18 +02:00
|
|
|
@@ -252,6 +252,10 @@ public class CraftContainer extends AbstractContainerMenu {
|
2023-10-27 01:34:58 +02:00
|
|
|
this.lastSlots = this.delegate.lastSlots;
|
|
|
|
this.slots = this.delegate.slots;
|
|
|
|
this.remoteSlots = this.delegate.remoteSlots;
|
2022-02-23 00:00:45 +01:00
|
|
|
+ // Paper start - copy data slots for InventoryView#set/getProperty
|
2023-10-27 01:34:58 +02:00
|
|
|
+ this.dataSlots = this.delegate.dataSlots;
|
|
|
|
+ this.remoteDataSlots = this.delegate.remoteDataSlots;
|
2022-02-23 00:00:45 +01:00
|
|
|
+ // Paper end
|
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2022-02-23 00:00:45 +01:00
|
|
|
// SPIGOT-4598 - we should still delegate the shift click handler
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
2023-12-05 23:21:44 +01:00
|
|
|
index 6a47c6adb721f0c6737150d8b0ee18ab70f5f281..75eb794f796b31c0c5ef80a6d27a56711a522f5e 100644
|
2022-02-23 00:00:45 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
2023-12-05 23:21:44 +01:00
|
|
|
@@ -497,6 +497,10 @@ public class CraftInventory implements Inventory {
|
2022-02-23 00:00:45 +01:00
|
|
|
return InventoryType.BREWING;
|
|
|
|
} else if (this.inventory instanceof CraftInventoryCustom.MinecraftInventory) {
|
|
|
|
return ((CraftInventoryCustom.MinecraftInventory) this.inventory).getType();
|
|
|
|
+ // Paper start
|
|
|
|
+ } else if (this.inventory instanceof io.papermc.paper.inventory.PaperInventoryCustomHolderContainer holderContainer) {
|
|
|
|
+ return holderContainer.getType();
|
|
|
|
+ // Paper end
|
|
|
|
} else if (this.inventory instanceof PlayerEnderChestContainer) {
|
|
|
|
return InventoryType.ENDER_CHEST;
|
|
|
|
} else if (this.inventory instanceof MerchantContainer) {
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
2023-07-04 10:22:56 +02:00
|
|
|
index fc0e1212022d1aa3506699b60ef338196eb54eba..da1c1fe0faf6819b15a81d6ad53370948e5f984f 100644
|
2022-02-23 00:00:45 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
|
|
|
@@ -15,6 +15,11 @@ import org.bukkit.event.inventory.InventoryType;
|
|
|
|
import org.bukkit.inventory.InventoryHolder;
|
|
|
|
|
|
|
|
public class CraftInventoryCustom extends CraftInventory {
|
|
|
|
+ // Paper start
|
|
|
|
+ public CraftInventoryCustom(InventoryHolder owner, InventoryType type, Container delegate) {
|
|
|
|
+ super(new io.papermc.paper.inventory.PaperInventoryCustomHolderContainer(owner, delegate, type));
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
public CraftInventoryCustom(InventoryHolder owner, InventoryType type) {
|
|
|
|
super(new MinecraftInventory(owner, type));
|
|
|
|
}
|
|
|
|
@@ -42,6 +47,27 @@ public class CraftInventoryCustom extends CraftInventory {
|
|
|
|
public CraftInventoryCustom(InventoryHolder owner, int size, String title) {
|
|
|
|
super(new MinecraftInventory(owner, size, title));
|
|
|
|
}
|
|
|
|
+ // Paper start
|
|
|
|
+ public String getTitle() {
|
|
|
|
+ if (this.inventory instanceof MinecraftInventory minecraftInventory) {
|
|
|
|
+ return minecraftInventory.getTitle();
|
|
|
|
+ } else if (this.inventory instanceof io.papermc.paper.inventory.PaperInventoryCustomHolderContainer customHolderContainer) {
|
|
|
|
+ return customHolderContainer.getTitle();
|
|
|
|
+ } else {
|
|
|
|
+ throw new UnsupportedOperationException(this.inventory.getClass() + " isn't a recognized Container type here");
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2022-02-23 00:00:45 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public net.kyori.adventure.text.Component title() {
|
|
|
|
+ if (this.inventory instanceof MinecraftInventory minecraftInventory) {
|
|
|
|
+ return minecraftInventory.title();
|
|
|
|
+ } else if (this.inventory instanceof io.papermc.paper.inventory.PaperInventoryCustomHolderContainer customHolderContainer) {
|
|
|
|
+ return customHolderContainer.title();
|
|
|
|
+ } else {
|
|
|
|
+ throw new UnsupportedOperationException(this.inventory.getClass() + " isn't a recognized Container type here");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
static class MinecraftInventory implements Container {
|
|
|
|
private final NonNullList<ItemStack> items;
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
|
2024-04-26 06:27:19 +02:00
|
|
|
index 7bc082d08a3d577481046818f0d58133413fc723..a6c758c5c5da2fb3f2d251bc109f72a5d8b0eb14 100644
|
2022-02-23 00:00:45 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
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:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -28,7 +28,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
2022-02-23 00:00:45 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Inventory createInventory(InventoryHolder holder, InventoryType type) {
|
|
|
|
- return this.getInventory(this.getTileEntity());
|
|
|
|
+ return this.getInventory(holder, type, this.getTileEntity()); // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2022-02-23 00:00:45 +01:00
|
|
|
// Paper start
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
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:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -39,7 +39,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
2024-04-26 06:27:19 +02:00
|
|
|
((RandomizableContainerBlockEntity) te).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
|
2022-02-23 00:00:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- return getInventory(te);
|
|
|
|
+ return this.getInventory(owner, type, te); // Paper
|
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
// Paper end
|
|
|
|
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
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:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -50,10 +50,18 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
2024-04-24 07:43:09 +02:00
|
|
|
((RandomizableContainerBlockEntity) te).name = CraftChatMessage.fromStringOrNull(title);
|
2022-02-23 00:00:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- return this.getInventory(te);
|
|
|
|
+ return this.getInventory(holder, type, te); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
+ @Deprecated // Paper - use getInventory with owner and type
|
|
|
|
public Inventory getInventory(Container tileEntity) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
2022-02-23 00:00:45 +01:00
|
|
|
+ return this.getInventory(null, null, tileEntity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Inventory getInventory(InventoryHolder owner, InventoryType type, Container tileEntity) { // Paper
|
|
|
|
+ if (owner != null) return new org.bukkit.craftbukkit.inventory.CraftInventoryCustom(owner, type, tileEntity); // Paper
|
|
|
|
+ // Paper end
|
|
|
|
return new CraftInventory(tileEntity);
|
|
|
|
}
|
|
|
|
|
2024-04-26 06:27:19 +02:00
|
|
|
@@ -69,8 +77,8 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
|
|
|
@Override
|
2022-02-23 00:00:45 +01:00
|
|
|
public Inventory createInventory(InventoryHolder owner, InventoryType type, net.kyori.adventure.text.Component title) {
|
|
|
|
Container tileEntity = getTileEntity();
|
2024-04-26 06:27:19 +02:00
|
|
|
- ((AbstractFurnaceBlockEntity) tileEntity).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
|
2022-02-23 00:00:45 +01:00
|
|
|
- return getInventory(tileEntity);
|
2024-04-26 06:27:19 +02:00
|
|
|
+ ((AbstractFurnaceBlockEntity) tileEntity).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
|
2022-02-23 00:00:45 +01:00
|
|
|
+ return this.getInventory(owner, type, tileEntity); // Paper
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
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:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -78,11 +86,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
2022-02-23 00:00:45 +01:00
|
|
|
public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) {
|
|
|
|
Container tileEntity = this.getTileEntity();
|
2024-04-24 07:43:09 +02:00
|
|
|
((AbstractFurnaceBlockEntity) tileEntity).name = CraftChatMessage.fromStringOrNull(title);
|
2022-02-23 00:00:45 +01:00
|
|
|
- return this.getInventory(tileEntity);
|
|
|
|
+ return this.getInventory(owner, type, tileEntity); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Inventory getInventory(Container tileEntity) {
|
|
|
|
+ // Paper start
|
|
|
|
+ return getInventory(null, null, tileEntity);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2022-02-23 00:00:45 +01:00
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Inventory getInventory(InventoryHolder owner, InventoryType type, net.minecraft.world.Container tileEntity) { // Paper
|
|
|
|
+ if (owner != null) return new org.bukkit.craftbukkit.inventory.CraftInventoryCustom(owner, type, tileEntity); // Paper
|
|
|
|
+ // Paper end
|
|
|
|
return new CraftInventoryFurnace((AbstractFurnaceBlockEntity) tileEntity);
|
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
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:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -102,7 +118,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
2022-02-23 00:00:45 +01:00
|
|
|
if (tileEntity instanceof BrewingStandBlockEntity) {
|
2024-04-26 06:27:19 +02:00
|
|
|
((BrewingStandBlockEntity) tileEntity).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
|
2022-02-23 00:00:45 +01:00
|
|
|
}
|
|
|
|
- return getInventory(tileEntity);
|
|
|
|
+ return this.getInventory(owner, type, tileEntity); // Paper
|
|
|
|
}
|
|
|
|
// Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
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:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -113,11 +129,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
2022-02-23 00:00:45 +01:00
|
|
|
if (tileEntity instanceof BrewingStandBlockEntity) {
|
2024-04-24 07:43:09 +02:00
|
|
|
((BrewingStandBlockEntity) tileEntity).name = CraftChatMessage.fromStringOrNull(title);
|
2022-02-23 00:00:45 +01:00
|
|
|
}
|
|
|
|
- return this.getInventory(tileEntity);
|
|
|
|
+ return this.getInventory(holder, type, tileEntity); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Inventory getInventory(Container tileEntity) {
|
|
|
|
+ // Paper start
|
|
|
|
+ return getInventory(null, null, tileEntity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Inventory getInventory(InventoryHolder owner, InventoryType type, net.minecraft.world.Container tileEntity) { // Paper
|
|
|
|
+ if (owner != null) return new org.bukkit.craftbukkit.inventory.CraftInventoryCustom(owner, type, tileEntity); // Paper
|
|
|
|
+ // Paper end
|
|
|
|
return new CraftInventoryBrewer(tileEntity);
|
|
|
|
}
|
|
|
|
}
|