Search in sources :

Example 1 with PluggablePulsar

use of buildcraft.transport.plug.PluggablePulsar in project BuildCraft by BuildCraft.

the class ItemPluggablePulsar method onPlace.

@Override
public PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side, EntityPlayer player, EnumHand hand) {
    IPipe pipe = holder.getPipe();
    if (pipe == null) {
        return null;
    }
    PipeBehaviour behaviour = pipe.getBehaviour();
    if (behaviour instanceof IMjRedstoneReceiver) {
        SoundUtil.playBlockPlace(holder.getPipeWorld(), holder.getPipePos());
        return new PluggablePulsar(BCTransportPlugs.pulsar, holder, side);
    } else {
        return null;
    }
}
Also used : PluggablePulsar(buildcraft.transport.plug.PluggablePulsar) IMjRedstoneReceiver(buildcraft.api.mj.IMjRedstoneReceiver) IPipe(buildcraft.api.transport.pipe.IPipe) PipeBehaviour(buildcraft.api.transport.pipe.PipeBehaviour)

Example 2 with PluggablePulsar

use of buildcraft.transport.plug.PluggablePulsar in project BuildCraft by BuildCraft.

the class ActionPowerPulsar method actionActivate.

@Override
public void actionActivate(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
    if (source instanceof IGate) {
        IGate gate = (IGate) source;
        IPipeHolder pipe = gate.getPipeHolder();
        PipePluggable plug = pipe.getPluggable(side);
        if (plug instanceof PluggablePulsar) {
            PluggablePulsar pulsar = (PluggablePulsar) plug;
            if (constant) {
                pulsar.enablePulsar();
            } else {
                pulsar.addSinglePulse();
            }
        }
    }
}
Also used : IGate(buildcraft.api.gates.IGate) IPipeHolder(buildcraft.api.transport.pipe.IPipeHolder) PluggablePulsar(buildcraft.transport.plug.PluggablePulsar) PipePluggable(buildcraft.api.transport.pluggable.PipePluggable)

Aggregations

PluggablePulsar (buildcraft.transport.plug.PluggablePulsar)2 IGate (buildcraft.api.gates.IGate)1 IMjRedstoneReceiver (buildcraft.api.mj.IMjRedstoneReceiver)1 IPipe (buildcraft.api.transport.pipe.IPipe)1 IPipeHolder (buildcraft.api.transport.pipe.IPipeHolder)1 PipeBehaviour (buildcraft.api.transport.pipe.PipeBehaviour)1 PipePluggable (buildcraft.api.transport.pluggable.PipePluggable)1