use of micdoodle8.mods.galacticraft.api.entity.ILandable in project Galacticraft by micdoodle8.
the class TileEntityLandingPad method update.
@Override
public void update() {
if (!this.initialised) {
if (!this.worldObj.isRemote)
this.onCreate(this.worldObj, this.getPos());
this.initialiseMultiTiles(this.getPos(), this.worldObj);
this.initialised = true;
}
if (!this.worldObj.isRemote) {
final List<Entity> list = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.fromBounds(this.getPos().getX() - 0.5D, this.getPos().getY(), this.getPos().getZ() - 0.5D, this.getPos().getX() + 0.5D, this.getPos().getY() + 1.0D, this.getPos().getZ() + 0.5D));
boolean docked = false;
for (final Object o : list) {
if (o instanceof IDockable && !((Entity) o).isDead) {
final IDockable fuelable = (IDockable) o;
if (!fuelable.inFlight()) {
docked = true;
if (fuelable != this.dockedEntity && fuelable.isDockValid(this)) {
if (fuelable instanceof ILandable) {
((ILandable) fuelable).landEntity(this.getPos());
} else {
fuelable.setPad(this);
}
}
break;
}
}
}
if (!docked) {
this.dockedEntity = null;
}
}
}
Aggregations