@@ -0,0 +1,88 @@
|
||||
--- a/net/minecraft/world/inventory/TransientCraftingContainer.java
|
||||
+++ b/net/minecraft/world/inventory/TransientCraftingContainer.java
|
||||
@@ -8,6 +8,16 @@
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import net.minecraft.world.IInventory;
|
||||
+import net.minecraft.world.item.crafting.IRecipe;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+import org.bukkit.event.inventory.InventoryType;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class TransientCraftingContainer implements InventoryCrafting {
|
||||
|
||||
private final NonNullList<ItemStack> items;
|
||||
@@ -15,6 +25,68 @@
|
||||
private final int height;
|
||||
private final Container menu;
|
||||
|
||||
+ // CraftBukkit start - add fields
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ private IRecipe currentRecipe;
|
||||
+ public IInventory resultInventory;
|
||||
+ private EntityHuman owner;
|
||||
+ private int maxStack = MAX_STACK;
|
||||
+
|
||||
+ public List<ItemStack> getContents() {
|
||||
+ return this.items;
|
||||
+ }
|
||||
+
|
||||
+ public void onOpen(CraftHumanEntity who) {
|
||||
+ transaction.add(who);
|
||||
+ }
|
||||
+
|
||||
+ public InventoryType getInvType() {
|
||||
+ return items.size() == 4 ? InventoryType.CRAFTING : InventoryType.WORKBENCH;
|
||||
+ }
|
||||
+
|
||||
+ public void onClose(CraftHumanEntity who) {
|
||||
+ transaction.remove(who);
|
||||
+ }
|
||||
+
|
||||
+ public List<HumanEntity> getViewers() {
|
||||
+ return transaction;
|
||||
+ }
|
||||
+
|
||||
+ public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ return (owner == null) ? null : owner.getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getMaxStackSize() {
|
||||
+ return maxStack;
|
||||
+ }
|
||||
+
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ maxStack = size;
|
||||
+ resultInventory.setMaxStackSize(size);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ return menu instanceof ContainerWorkbench ? ((ContainerWorkbench) menu).access.getLocation() : owner.getBukkitEntity().getLocation();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IRecipe getCurrentRecipe() {
|
||||
+ return currentRecipe;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCurrentRecipe(IRecipe currentRecipe) {
|
||||
+ this.currentRecipe = currentRecipe;
|
||||
+ }
|
||||
+
|
||||
+ public TransientCraftingContainer(Container container, int i, int j, EntityHuman player) {
|
||||
+ this(container, i, j);
|
||||
+ this.owner = player;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public TransientCraftingContainer(Container container, int i, int j) {
|
||||
this(container, i, j, NonNullList.withSize(i * j, ItemStack.EMPTY));
|
||||
}
|
||||
Reference in New Issue
Block a user