Search in sources :

Example 1 with TileLauncherScreen

use of icbm.classic.content.machines.launcher.screen.TileLauncherScreen in project ICBM-Classic by BuiltBrokenModding.

the class TileLauncherBase method update.

/**
     * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner
     * uses this to count ticks and creates a new spawn inside its implementation.
     */
@Override
public void update() {
    super.update();
    if (ticks % 20 == 0) {
        if (this.supportFrame == null || launchScreen == null || launchScreen.isInvalid() || this.supportFrame.isInvalid()) {
            this.supportFrame = null;
            this.launchScreen = null;
            for (byte i = 2; i < 6; i++) {
                Pos position = new Pos(this.xCoord, this.yCoord, this.zCoord).add(ForgeDirection.getOrientation(i));
                TileEntity tileEntity = this.worldObj.getTileEntity(position.xi(), position.yi(), position.zi());
                if (tileEntity instanceof TileLauncherFrame) {
                    this.supportFrame = (TileLauncherFrame) tileEntity;
                    if (isServer()) {
                        this.supportFrame.setFacing(getDirection());
                    }
                } else if (tileEntity instanceof TileLauncherScreen) {
                    this.launchScreen = (TileLauncherScreen) tileEntity;
                }
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Pos(com.builtbroken.mc.imp.transform.vector.Pos) TileLauncherFrame(icbm.classic.content.machines.launcher.frame.TileLauncherFrame) TileLauncherScreen(icbm.classic.content.machines.launcher.screen.TileLauncherScreen)

Aggregations

Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 TileLauncherFrame (icbm.classic.content.machines.launcher.frame.TileLauncherFrame)1 TileLauncherScreen (icbm.classic.content.machines.launcher.screen.TileLauncherScreen)1 TileEntity (net.minecraft.tileentity.TileEntity)1