Fix Craft Entity constructors and toStrings.

Also, standardise getHandle and clean up in general.
getHandle is now using the 'entity' member variable instead of
super.getHandle, as this reduces the number of chained calls needed.
This commit is contained in:
Andrew Ardill
2011-11-29 21:22:35 +11:00
parent a51eb9c3ca
commit 2759809ecb
57 changed files with 588 additions and 305 deletions

View File

@@ -31,17 +31,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return getHandle().name;
}
@Override
public EntityHuman getHandle() {
return (EntityHuman) entity;
}
public void setHandle(final EntityHuman entity) {
super.setHandle((EntityHuman) entity);
this.entity = entity;
this.inventory = new CraftInventoryPlayer(entity.inventory);
}
public PlayerInventory getInventory() {
return inventory;
}
@@ -54,11 +43,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
getInventory().setItemInHand(item);
}
@Override
public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';
}
public boolean isSleeping() {
return getHandle().sleeping;
}
@@ -131,4 +115,19 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
this.mode = mode;
}
@Override
public EntityHuman getHandle() {
return (EntityHuman) entity;
}
public void setHandle(final EntityHuman entity) {
super.setHandle(entity);
this.inventory = new CraftInventoryPlayer(entity.inventory);
}
@Override
public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';
}
}