Search in sources :

Example 1 with PipeBehaviour_BC8

use of buildcraft.api.transport.pipe_bc8.PipeBehaviour_BC8 in project BuildCraft by BuildCraft.

the class BehaviourWood method onPipeAttemptConnect.

@BCPipeEventHandler
public void onPipeAttemptConnect(IPipeEventConnection_BC8.AttemptCreate event) {
    if (event instanceof IPipeEventConnection_BC8.AttemptCreate.Pipe) {
        AttemptCreate.Pipe pipeEvent = (AttemptCreate.Pipe) event;
        PipeBehaviour_BC8 other = pipeEvent.with().getBehaviour();
        if (other instanceof BehaviourWood) {
            event.disallow();
        }
    }
}
Also used : IPipeEventConnection_BC8(buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventConnection_BC8) PipeBehaviour_BC8(buildcraft.api.transport.pipe_bc8.PipeBehaviour_BC8) AttemptCreate(buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventConnection_BC8.AttemptCreate) BCPipeEventHandler(buildcraft.api.transport.pipe_bc8.BCPipeEventHandler)

Example 2 with PipeBehaviour_BC8

use of buildcraft.api.transport.pipe_bc8.PipeBehaviour_BC8 in project BuildCraft by BuildCraft.

the class Pipe_BC8 method readFromNBT.

@Override
public Pipe_BC8 readFromNBT(NBTBase base) {
    NBTTagCompound nbt = (NBTTagCompound) base;
    PipeBehaviour_BC8 behaviour = this.behaviour.readFromNBT(nbt.getTag("behaviour"));
    Pipe_BC8 pipe = new Pipe_BC8(holder, behaviour, getWorld());
    NBTTagList list = nbt.getTagList("listeners", 10);
    for (int i = 0; i < list.tagCount(); i++) {
        NBTTagCompound comp = list.getCompoundTagAt(i);
        String type = comp.getString("type");
        IPipeListener listener = PipeAPI_BC8.PIPE_LISTENER_REGISTRY.getFactory(type).createNewListener(pipe);
        pipe.bus.registerHandler(listener);
        pipe.listenerMap.put(pipe.nextListenerId++, listener);
    }
    initNBT = (NBTTagCompound) nbt.copy();
    return pipe;
}
Also used : IPipe_BC8(buildcraft.api.transport.pipe_bc8.IPipe_BC8) NBTTagList(net.minecraft.nbt.NBTTagList) PipeBehaviour_BC8(buildcraft.api.transport.pipe_bc8.PipeBehaviour_BC8) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IPipeListener(buildcraft.api.transport.pipe_bc8.IPipeListener)

Aggregations

PipeBehaviour_BC8 (buildcraft.api.transport.pipe_bc8.PipeBehaviour_BC8)2 BCPipeEventHandler (buildcraft.api.transport.pipe_bc8.BCPipeEventHandler)1 IPipeListener (buildcraft.api.transport.pipe_bc8.IPipeListener)1 IPipe_BC8 (buildcraft.api.transport.pipe_bc8.IPipe_BC8)1 IPipeEventConnection_BC8 (buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventConnection_BC8)1 AttemptCreate (buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventConnection_BC8.AttemptCreate)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1