Search in sources :

Example 1 with DummyRedstoneDevice

use of com.bluepowermod.redstone.DummyRedstoneDevice in project BluePower by Qmunity.

the class GateConnectionBase method notifyUpdate.

@Override
public void notifyUpdate() {
    if (gate.getParent() == null || gate.getWorld() == null)
        return;
    ForgeDirection d = getForgeDirection();
    IConnection<? extends IRedstoneDevice> c = gate.getRedstoneConnectionCache().getConnectionOnSide(d);
    if (c == null || c.getB() instanceof DummyRedstoneDevice) {
        World world = gate.getWorld();
        int x = gate.getX(), y = gate.getY(), z = gate.getZ();
        RedstoneHelper.notifyRedstoneUpdate(world, x, y, z, d, true);
    } else {
        RedstoneApi.getInstance().getRedstonePropagator(getGate(), d).propagate();
    }
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) DummyRedstoneDevice(com.bluepowermod.redstone.DummyRedstoneDevice) World(net.minecraft.world.World)

Example 2 with DummyRedstoneDevice

use of com.bluepowermod.redstone.DummyRedstoneDevice in project BluePower by Qmunity.

the class GateNullCell method canConnect.

@Override
public boolean canConnect(ForgeDirection side, IRedstoneDevice device, ConnectionType type) {
    if (type == ConnectionType.OPEN_CORNER && device instanceof IGate<?, ?, ?, ?, ?, ?>)
        return false;
    if (type == ConnectionType.STRAIGHT)
        if ((side == getFace().getOpposite() || side == ForgeDirection.UNKNOWN) && device instanceof DummyRedstoneDevice)
            return false;
    if (type == ConnectionType.CLOSED_CORNER) {
        if (side == getFace())
            return false;
        if (side == getFace().getOpposite())
            return false;
        if (side == ForgeDirection.UNKNOWN)
            return false;
    }
    if (device instanceof IRedwire) {
        RedwireType rwt = getRedwireType(side);
        if (rwt == null)
            return false;
        RedwireType rwt_ = ((IRedwire) device).getRedwireType(type == ConnectionType.STRAIGHT ? side.getOpposite() : (type == ConnectionType.CLOSED_CORNER ? getFace() : getFace().getOpposite()));
        if (rwt_ == null)
            return false;
        return rwt.canConnectTo(rwt_);
    }
    return true;
}
Also used : RedwireType(com.bluepowermod.api.wire.redstone.RedwireType) IRedwire(com.bluepowermod.api.wire.redstone.IRedwire) DummyRedstoneDevice(com.bluepowermod.redstone.DummyRedstoneDevice)

Example 3 with DummyRedstoneDevice

use of com.bluepowermod.redstone.DummyRedstoneDevice in project BluePower by Qmunity.

the class PneumaticTube method onRedstoneUpdate.

@Override
public void onRedstoneUpdate() {
    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        IConnection<IRedstoneDevice> c = redConnections.getConnectionOnSide(dir);
        IRedstoneDevice dev = null;
        if (c != null)
            dev = c.getB();
        if (dev == null || dev instanceof DummyRedstoneDevice)
            RedstoneHelper.notifyRedstoneUpdate(getWorld(), getX(), getY(), getZ(), dir, false);
    }
    sendUpdatePacket();
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) IRedstoneDevice(com.bluepowermod.api.wire.redstone.IRedstoneDevice) DummyRedstoneDevice(com.bluepowermod.redstone.DummyRedstoneDevice)

Aggregations

DummyRedstoneDevice (com.bluepowermod.redstone.DummyRedstoneDevice)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 IRedstoneDevice (com.bluepowermod.api.wire.redstone.IRedstoneDevice)1 IRedwire (com.bluepowermod.api.wire.redstone.IRedwire)1 RedwireType (com.bluepowermod.api.wire.redstone.RedwireType)1 World (net.minecraft.world.World)1