summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTahg <tahgtahv@gmail.com>2011-02-08 19:37:53 -0500
committerTahg <tahgtahv@gmail.com>2011-02-08 19:47:08 -0500
commit61b79e8f981eac4a32a6ba022bc7378912c03762 (patch)
tree0d776e5803efec09757511ce9e3e0fba93f4d464 /src
parentb76bc9cfb3613ebdafe20055e4e3e87368ae20ad (diff)
downloadcraftbukkit-61b79e8f981eac4a32a6ba022bc7378912c03762.tar
craftbukkit-61b79e8f981eac4a32a6ba022bc7378912c03762.tar.gz
craftbukkit-61b79e8f981eac4a32a6ba022bc7378912c03762.tar.lz
craftbukkit-61b79e8f981eac4a32a6ba022bc7378912c03762.tar.xz
craftbukkit-61b79e8f981eac4a32a6ba022bc7378912c03762.zip
inventory fixes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java5
-rw-r--r--src/main/java/net/minecraft/server/InventoryCraftResult.java2
-rw-r--r--src/main/java/net/minecraft/server/InventoryPlayer.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java4
-rw-r--r--src/main/java/net/minecraft/server/TileEntityDispenser.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java11
6 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
index c7b980d2..9de452e1 100644
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ b/src/main/java/net/minecraft/server/EntityMinecart.java
@@ -31,9 +31,6 @@ public class EntityMinecart extends Entity implements IInventory {
private double at;
// CraftBukkit start
- protected org.bukkit.entity.Entity bukkitPoweredMinecart;
- protected org.bukkit.entity.Entity bukkitStorageMinecart;
-
private boolean slowWhenEmpty = true;
private double derailedX = 0.5;
private double derailedY = 0.5;
@@ -49,7 +46,7 @@ public class EntityMinecart extends Entity implements IInventory {
public EntityMinecart(World world) {
super(world);
- this.al = new ItemStack[36];
+ this.al = new ItemStack[27]; //Craftbukkit
this.a = 0;
this.b = 0;
this.c = 1;
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java
index 12a06285..d8a5d3de 100644
--- a/src/main/java/net/minecraft/server/InventoryCraftResult.java
+++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java
@@ -13,7 +13,7 @@ public class InventoryCraftResult implements IInventory {
public InventoryCraftResult() {}
public int h_() {
- return 1;
+ return this.a.length; //Craftbukkit
}
public ItemStack a(int i) {
diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java
index c918c46e..ddc74fa6 100644
--- a/src/main/java/net/minecraft/server/InventoryPlayer.java
+++ b/src/main/java/net/minecraft/server/InventoryPlayer.java
@@ -231,7 +231,7 @@ public class InventoryPlayer implements IInventory {
}
public int h_() {
- return this.a.length + 4;
+ return this.a.length + this.b.length; //Craftbukkit
}
public ItemStack a(int i) {
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index e3683ddc..f8bf94e3 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -2,7 +2,7 @@ package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory {
- private ItemStack[] e = new ItemStack[36];
+ private ItemStack[] e = new ItemStack[27]; //Craftbukkit
// CraftBukkit start
public ItemStack[] getContents() {
@@ -13,7 +13,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
public TileEntityChest() {}
public int h_() {
- return 27;
+ return this.e.length;
}
public ItemStack a(int i) {
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index 7c968fc8..251afb5e 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -16,7 +16,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
public TileEntityDispenser() {}
public int h_() {
- return 9;
+ return this.e.length; //Craftbukkit
}
public ItemStack a(int i) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 264d6284..a723e148 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -179,7 +179,14 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
public int firstPartial(ItemStack item) {
- return firstPartial(item.getTypeId());
+ CraftItemStack[] inventory = getContents();
+ for (int i = 0; i < inventory.length; i++) {
+ CraftItemStack cItem = inventory[i];
+ if (item != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
+ return i;
+ }
+ }
+ return -1;
}
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
@@ -195,7 +202,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
ItemStack item = items[i];
while (true) {
// Do we already have a stack of it?
- int firstPartial = firstPartial( item.getTypeId() );
+ int firstPartial = firstPartial(item);
// Drat! no partial stack
if (firstPartial == -1) {