Added passenger methods to Vehicle/LivingEntity.

This commit is contained in:
sk89q
2011-01-07 16:26:08 -08:00
parent e968096fc7
commit c9efe94545
4 changed files with 50 additions and 2 deletions

View File

@@ -17,8 +17,22 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
public Entity getPassenger() {
return ((CraftWorld)getWorld()).toCraftEntity(getHandle().j);
}
public boolean setPassenger(Entity passenger) {
((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
return true;
}
public boolean isEmpty() {
return getHandle().j == null;
}
public boolean eject() {
if (getHandle().j == null) {
return false;
}
getHandle().j.setPassengerOf(null);
return true;
}
}