use of micdoodle8.mods.galacticraft.api.entity.IDockable in project Galacticraft by micdoodle8.
the class TileEntityLaunchController method updateRocketOnDockSettings.
public void updateRocketOnDockSettings() {
if (this.attachedDock instanceof TileEntityLandingPad) {
TileEntityLandingPad pad = ((TileEntityLandingPad) this.attachedDock);
IDockable rocket = pad.getDockedEntity();
if (rocket instanceof EntityAutoRocket) {
((EntityAutoRocket) rocket).updateControllerSettings(pad);
}
}
}
use of micdoodle8.mods.galacticraft.api.entity.IDockable in project Galacticraft by micdoodle8.
the class TileEntityBuggyFueler 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() - 1.5D, this.getPos().getY() - 2.0, this.getPos().getZ() - 1.5D, this.getPos().getX() + 1.5D, this.getPos().getY() + 4.0, this.getPos().getZ() + 1.5D), new Predicate<Entity>() {
@Override
public boolean apply(Entity input) {
return input instanceof IFuelable;
}
});
boolean changed = false;
for (final Object o : list) {
if (o != null && o instanceof IDockable && !this.worldObj.isRemote) {
final IDockable fuelable = (IDockable) o;
if (fuelable.isDockValid(this)) {
this.dockedEntity = fuelable;
this.dockedEntity.setPad(this);
changed = true;
}
}
}
if (!changed) {
if (this.dockedEntity != null) {
this.dockedEntity.setPad(null);
}
this.dockedEntity = null;
}
}
}
use of micdoodle8.mods.galacticraft.api.entity.IDockable 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