mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 06:40:05 +03:00
76 lines
2.4 KiB
Diff
76 lines
2.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/InventoryMerchant.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/InventoryMerchant.java
|
|
@@ -1,6 +1,7 @@
|
|
package net.minecraft.inventory;
|
|
|
|
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.NonNullList;
|
|
@@ -9,15 +10,54 @@
|
|
import net.minecraft.util.text.TextComponentTranslation;
|
|
import net.minecraft.village.MerchantRecipe;
|
|
import net.minecraft.village.MerchantRecipeList;
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
+import org.bukkit.craftbukkit.entity.CraftVillager;
|
|
+import org.bukkit.entity.HumanEntity;
|
|
|
|
+import java.util.List;
|
|
+
|
|
public class InventoryMerchant implements IInventory
|
|
{
|
|
private final IMerchant merchant;
|
|
private final NonNullList<ItemStack> slots = NonNullList.<ItemStack>withSize(3, ItemStack.EMPTY);
|
|
private final EntityPlayer player;
|
|
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 List<ItemStack> getContents() {
|
|
+ return this.slots;
|
|
+ }
|
|
+
|
|
+ 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 (merchant instanceof EntityVillager) ? (CraftVillager) ((EntityVillager) this.merchant).getBukkitEntity() : null;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return (merchant instanceof EntityVillager) ? ((EntityVillager) this.merchant).getBukkitEntity().getLocation() : null;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public InventoryMerchant(EntityPlayer thePlayerIn, IMerchant theMerchantIn)
|
|
{
|
|
this.player = thePlayerIn;
|
|
@@ -110,7 +150,7 @@
|
|
|
|
public int getInventoryStackLimit()
|
|
{
|
|
- return 64;
|
|
+ return maxStack;
|
|
}
|
|
|
|
public boolean isUsableByPlayer(EntityPlayer player)
|