summaryrefslogtreecommitdiffstats
path: root/nms-patches/PlayerInventory.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/PlayerInventory.patch')
-rw-r--r--nms-patches/PlayerInventory.patch34
1 files changed, 20 insertions, 14 deletions
diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch
index cf269568..285ff230 100644
--- a/nms-patches/PlayerInventory.patch
+++ b/nms-patches/PlayerInventory.patch
@@ -1,11 +1,12 @@
--- a/net/minecraft/server/PlayerInventory.java
+++ b/net/minecraft/server/PlayerInventory.java
-@@ -2,6 +2,13 @@
-
+@@ -3,6 +3,14 @@
+ import java.util.Arrays;
import java.util.concurrent.Callable;
+// CraftBukkit start
+import java.util.List;
++import org.bukkit.Location;
+
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
@@ -13,10 +14,10 @@
+
public class PlayerInventory implements IInventory {
- public ItemStack[] items = new ItemStack[36];
-@@ -11,6 +18,39 @@
- private ItemStack f;
- public boolean e;
+ public final ItemStack[] items = new ItemStack[36];
+@@ -14,6 +22,44 @@
+ private ItemStack carried;
+ public boolean f;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -49,13 +50,18 @@
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
++
++ @Override
++ public Location getLocation() {
++ return player.getBukkitEntity().getLocation();
++ }
+ // CraftBukkit end
+
public PlayerInventory(EntityHuman entityhuman) {
+ this.g = new ItemStack[][] { this.items, this.armor, this.extraSlots};
this.player = entityhuman;
- }
-@@ -43,6 +83,22 @@
- return -1;
+@@ -35,6 +81,22 @@
+ return itemstack.getItem() == itemstack1.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1);
}
+ // CraftBukkit start - Watch method above! :D
@@ -77,7 +83,7 @@
public int getFirstEmptySlotIndex() {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] == null) {
-@@ -390,7 +446,7 @@
+@@ -455,7 +517,7 @@
}
public int getMaxStackSize() {
@@ -85,16 +91,16 @@
+ return maxStack; // CraftBukkit
}
- public boolean b(Block block) {
-@@ -466,6 +522,11 @@
+ public boolean b(IBlockData iblockdata) {
+@@ -511,6 +573,11 @@
}
public ItemStack getCarried() {
+ // CraftBukkit start
-+ if (this.f != null && this.f.count == 0) {
++ if (this.carried != null && this.carried.count == 0) {
+ this.setCarried(null);
+ }
+ // CraftBukkit end
- return this.f;
+ return this.carried;
}