use of icbm.classic.content.blocks.launcher.base.TileLauncherBase in project ICBM-Classic by BuiltBrokenModding.
the class TileLauncherScreen method update.
@Override
public void update() {
super.update();
if (this.launcherBase == null || this.launcherBase.isInvalid()) {
this.launcherBase = null;
for (EnumFacing rotation : EnumFacing.HORIZONTALS) {
final Pos position = new Pos((IPos3D) this).add(rotation);
final TileEntity tileEntity = position.getTileEntity(world);
if (tileEntity != null) {
if (tileEntity instanceof TileLauncherBase) {
this.launcherBase = (TileLauncherBase) tileEntity;
if (isServer()) {
setRotation(rotation.getOpposite());
updateClient = true;
}
}
}
}
}
if (isServer()) {
// Delay launch, basically acts as a reload time
if (launchDelay > 0) {
launchDelay--;
} else // Only launch if redstone
if (// TODO replace with countdown
ticks % 10 == 0 && world.getRedstonePowerFromNeighbors(getPos()) > 0) {
this.launch();
}
// Update packet TODO see if this is needed
if (ticks % 3 == 0) {
sendDescPacket();
}
}
}
Aggregations