aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/MerchantContainer.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/MerchantContainer.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/MerchantContainer.java.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/MerchantContainer.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/MerchantContainer.java.patch
new file mode 100644
index 0000000000..b7fc503096
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/MerchantContainer.java.patch
@@ -0,0 +1,63 @@
+--- a/net/minecraft/world/inventory/MerchantContainer.java
++++ b/net/minecraft/world/inventory/MerchantContainer.java
+@@ -10,6 +12,13 @@
+ import net.minecraft.world.item.trading.Merchant;
+ import net.minecraft.world.item.trading.MerchantOffer;
+ import net.minecraft.world.item.trading.MerchantOffers;
++// CraftBukkit start
++import java.util.List;
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.entity.CraftHumanEntity;
++import org.bukkit.craftbukkit.entity.CraftAbstractVillager;
++import org.bukkit.entity.HumanEntity;
++// CraftBukkit end
+
+ public class MerchantContainer implements Container {
+
+@@ -20,6 +29,46 @@
+ private int selectionHint;
+ private int futureXp;
+
++ // CraftBukkit start - add fields and methods
++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
++ private int maxStack = MAX_STACK;
++
++ public List<ItemStack> getContents() {
++ return this.itemStacks;
++ }
++
++ public void onOpen(CraftHumanEntity who) {
++ transaction.add(who);
++ }
++
++ public void onClose(CraftHumanEntity who) {
++ transaction.remove(who);
++ merchant.setTradingPlayer((Player) null); // SPIGOT-4860
++ }
++
++ public List<HumanEntity> getViewers() {
++ return transaction;
++ }
++
++ @Override
++ public int getMaxStackSize() {
++ return maxStack;
++ }
++
++ public void setMaxStackSize(int i) {
++ maxStack = i;
++ }
++
++ public org.bukkit.inventory.InventoryHolder getOwner() {
++ return (merchant instanceof AbstractVillager) ? (CraftAbstractVillager) ((AbstractVillager) this.merchant).getBukkitEntity() : null;
++ }
++
++ @Override
++ public Location getLocation() {
++ return (merchant instanceof Villager) ? ((Villager) this.merchant).getBukkitEntity().getLocation() : null;
++ }
++ // CraftBukkit end
++
+ public MerchantContainer(Merchant merchant) {
+ this.itemStacks = NonNullList.withSize(3, ItemStack.EMPTY);
+ this.merchant = merchant;