Files
CatServer/patches/net/minecraft/inventory/InventoryMerchant.java.patch
2018-07-20 01:14:44 +08:00

71 lines
2.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/inventory/InventoryMerchant.java
+++ ../src-work/minecraft/net/minecraft/inventory/InventoryMerchant.java
@@ -1,7 +1,16 @@
package net.minecraft.inventory;
+import java.util.List;
+
import javax.annotation.Nullable;
+
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.entity.CraftVillager;
+import org.bukkit.entity.HumanEntity;
+
import net.minecraft.entity.IMerchant;
+import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
@@ -16,7 +25,40 @@
private final ItemStack[] theInventory = new ItemStack[3];
private final EntityPlayer thePlayer;
private MerchantRecipe currentRecipe;
- private int currentRecipeIndex;
+ public int currentRecipeIndex;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public ItemStack[] getContents() {
+ return this.theInventory;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public void setMaxStackSize(int i) {
+ maxStack = i;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return (CraftVillager) ((EntityVillager) this.theMerchant).getBukkitEntity();
+ }
+
+ @Override
+ public Location getLocation() {
+ return ((EntityVillager) this.theMerchant).getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
public InventoryMerchant(EntityPlayer thePlayerIn, IMerchant theMerchantIn)
{
@@ -98,7 +140,7 @@
public int getInventoryStackLimit()
{
- return 64;
+ return maxStack;
}
public boolean isUseableByPlayer(EntityPlayer player)