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();
}
}
}
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;
}
Aggregations