Added getContents() to IInventory and implemented it.

Implemented Inventory and PlayerInventory and updated StorageMinecart and Slot.
Added getMaxStackSize to CraftItemStack.
This commit is contained in:
Erik Broes
2011-01-09 18:27:46 +01:00
parent b72dad0a61
commit e8a565e6cf
15 changed files with 1557 additions and 35 deletions

View File

@@ -2,22 +2,18 @@
package org.bukkit.craftbukkit;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.InventoryPlayer;
import org.bukkit.HumanEntity;
import org.bukkit.ItemStack;
import org.bukkit.PlayerInventory;
public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private EntityPlayer entity;
private CraftInventoryPlayer inventory;
public CraftHumanEntity(final CraftServer server, final EntityPlayer entity) {
super(server, entity);
this.entity = entity;
}
public ItemStack getSelectedItem() {
// TODO: Implement inventories
final InventoryPlayer inventory = entity.an;
return new ItemStack(inventory.e().c, inventory.e().a);
this.inventory = new CraftInventoryPlayer( entity.an );
}
public String getName() {
@@ -34,6 +30,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
this.entity = entity;
}
public PlayerInventory getInventory() {
return inventory;
}
public ItemStack getItemInHand() {
return getInventory().getItemInHand();
}
@Override
public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityID() + "name=" + getName() + '}';