mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
72 lines
1.9 KiB
Diff
72 lines
1.9 KiB
Diff
--- a/net/minecraft/server/InventoryCrafting.java
|
|
+++ b/net/minecraft/server/InventoryCrafting.java
|
|
@@ -1,6 +1,14 @@
|
|
package net.minecraft.server;
|
|
|
|
import javax.annotation.Nullable;
|
|
+// CraftBukkit start
|
|
+import java.util.List;
|
|
+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 InventoryCrafting implements IInventory {
|
|
|
|
@@ -9,6 +17,53 @@
|
|
private final int c;
|
|
private final Container d;
|
|
|
|
+ // CraftBukkit start - add fields
|
|
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
+ public IRecipe currentRecipe;
|
|
+ public IInventory resultInventory;
|
|
+ private EntityHuman owner;
|
|
+ private int maxStack = MAX_STACK;
|
|
+
|
|
+ public ItemStack[] getContents() {
|
|
+ return this.items;
|
|
+ }
|
|
+
|
|
+ public void onOpen(CraftHumanEntity who) {
|
|
+ transaction.add(who);
|
|
+ }
|
|
+
|
|
+ public InventoryType getInvType() {
|
|
+ return items.length == 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();
|
|
+ }
|
|
+
|
|
+ public void setMaxStackSize(int size) {
|
|
+ maxStack = size;
|
|
+ resultInventory.setMaxStackSize(size);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return owner.getBukkitEntity().getLocation();
|
|
+ }
|
|
+
|
|
+ public InventoryCrafting(Container container, int i, int j, EntityHuman player) {
|
|
+ this(container, i, j);
|
|
+ this.owner = player;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public InventoryCrafting(Container container, int i, int j) {
|
|
int k = i * j;
|
|
|