Search in sources :

Example 1 with IPartFace

use of uk.co.qmunity.lib.part.IPartFace in project BluePower by Qmunity.

the class GateIntegratedCircuit method setPart.

public void setPart(int x, int z, IIntegratedCircuitPart part) {
    loadWorld();
    FakeMultipartTileIC tmp = new FakeMultipartTileIC(this);
    tmp.setWorldObj(FakeWorldIC.getInstance());
    tmp.xCoord = x;
    tmp.yCoord = 64;
    tmp.zCoord = z;
    tiles[x][z] = tmp;
    parts[x][z] = part;
    if (part instanceof IPartFace)
        ((IPartFace) part).setFace(ForgeDirection.DOWN);
    tmp.addPart(part);
    for (int x_ = x - 1; x_ <= x + 1; x_++) {
        if (x_ == x)
            continue;
        IPart p = getPart(x_, z);
        if (p != null && p instanceof IPartUpdateListener)
            ((IPartUpdateListener) p).onNeighborBlockChange();
    }
    for (int z_ = z - 1; z_ <= z + 1; z_++) {
        if (z_ == z)
            continue;
        IPart p = getPart(x, z_);
        if (p != null && p instanceof IPartUpdateListener)
            ((IPartUpdateListener) p).onNeighborBlockChange();
    }
    unloadWorld();
}
Also used : IPartUpdateListener(uk.co.qmunity.lib.part.IPartUpdateListener) IPartFace(uk.co.qmunity.lib.part.IPartFace) IPart(uk.co.qmunity.lib.part.IPart)

Aggregations

IPart (uk.co.qmunity.lib.part.IPart)1 IPartFace (uk.co.qmunity.lib.part.IPartFace)1 IPartUpdateListener (uk.co.qmunity.lib.part.IPartUpdateListener)1