Search in sources :

Example 1 with IItemPipe

use of buildcraft.api.transport.pipe.IItemPipe in project BuildCraft by BuildCraft.

the class TilePipeHolder method onPlacedBy.

// Misc
@Override
public void onPlacedBy(EntityLivingBase placer, ItemStack stack) {
    super.onPlacedBy(placer, stack);
    Item item = stack.getItem();
    if (item instanceof IItemPipe) {
        PipeDefinition definition = ((IItemPipe) item).getDefinition();
        this.pipe = new Pipe(this, definition);
        eventBus.registerHandler(pipe.behaviour);
        eventBus.registerHandler(pipe.flow);
        if (pipe.flow instanceof IFlowItems) {
            eventBus.registerHandler(FilterEventHandler.class);
        }
        int meta = stack.getMetadata();
        if (meta > 0 && meta <= 16) {
            pipe.setColour(EnumDyeColor.byMetadata(meta - 1));
        }
    }
    scheduleRenderUpdate();
}
Also used : Item(net.minecraft.item.Item) IItemPipe(buildcraft.api.transport.pipe.IItemPipe) PipeDefinition(buildcraft.api.transport.pipe.PipeDefinition) IItemPipe(buildcraft.api.transport.pipe.IItemPipe) IPipe(buildcraft.api.transport.pipe.IPipe) Pipe(buildcraft.transport.pipe.Pipe) IFlowItems(buildcraft.api.transport.pipe.IFlowItems)

Aggregations

IFlowItems (buildcraft.api.transport.pipe.IFlowItems)1 IItemPipe (buildcraft.api.transport.pipe.IItemPipe)1 IPipe (buildcraft.api.transport.pipe.IPipe)1 PipeDefinition (buildcraft.api.transport.pipe.PipeDefinition)1 Pipe (buildcraft.transport.pipe.Pipe)1 Item (net.minecraft.item.Item)1