Search in sources :

Example 1 with ICustomPipeConnection

use of buildcraft.api.transport.ICustomPipeConnection in project BuildCraft by BuildCraft.

the class BuildCraftTransport method init.

@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
    transportChannelHandler = new ChannelHandler();
    MinecraftForge.EVENT_BUS.register(this);
    transportChannelHandler.registerPacketType(PacketFluidUpdate.class);
    transportChannelHandler.registerPacketType(PacketPipeSyncRequest.class);
    transportChannelHandler.registerPacketType(PacketPipeTransportItemStack.class);
    transportChannelHandler.registerPacketType(PacketPipeTransportItemStackRequest.class);
    transportChannelHandler.registerPacketType(PacketPipeTransportTraveler.class);
    transportChannelHandler.registerPacketType(PacketPowerUpdate.class);
    channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", transportChannelHandler, new PacketHandler());
    TransportProxy.proxy.registerTileEntities();
    BuilderAPI.schematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class);
    BuilderAPI.schematicRegistry.registerSchematicBlock(filteredBufferBlock, SchematicTile.class);
    new BptPipeRotatable(pipeItemsWood);
    new BptPipeRotatable(pipeFluidsWood);
    new BptPipeRotatable(pipeItemsIron);
    new BptPipeRotatable(pipeFluidsIron);
    new BptPipeRotatable(pipeItemsEmerald);
    new BptPipeRotatable(pipeFluidsEmerald);
    new BptPipeRotatable(pipeItemsDaizuli);
    new BptPipeRotatable(pipeItemsEmzuli);
    for (Item itemPipe : BlockGenericPipe.pipes.keySet()) {
        Class<? extends Pipe<?>> klazz = BlockGenericPipe.pipes.get(itemPipe);
        if (IDiamondPipe.class.isAssignableFrom(klazz)) {
            new BptPipeFiltered(itemPipe);
        }
    }
    PipeEventBus.registerGlobalHandler(new LensFilterHandler());
    BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1));
    if (NEPTUNE_TESTING)
        BCCreativeTab.get("neptune").setIcon(new ItemStack(Items.cake));
    if (showAllFacadesCreative) {
        BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block.getDefaultState()));
    }
    if (Loader.isModLoaded("BuildCraft|Silicon")) {
        BCCreativeTab.get("gates").setIcon(ItemGate.makeGateItem(GateMaterial.DIAMOND, GateLogic.AND));
    }
    StatementManager.registerParameterClass(TriggerParameterSignal.class);
    StatementManager.registerParameterClass(ActionParameterSignal.class);
    // Item use stripes handlers
    PipeManager.registerStripesHandler(new StripesHandlerRightClick(), -32768);
    PipeManager.registerStripesHandler(new StripesHandlerDispenser(), -49152);
    PipeManager.registerStripesHandler(new StripesHandlerPlant(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerBucket(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerArrow(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerShears(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerPipes(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerPipeWires(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerEntityInteract(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerPlaceBlock(), -65536);
    PipeManager.registerStripesHandler(new StripesHandlerUse(), -131072);
    PipeManager.registerStripesHandler(new StripesHandlerHoe(), 0);
    StripesHandlerDispenser.items.add(ItemMinecart.class);
    StripesHandlerRightClick.items.add(Items.egg);
    StripesHandlerRightClick.items.add(Items.snowball);
    StripesHandlerRightClick.items.add(Items.experience_bottle);
    StripesHandlerUse.items.add(Items.fireworks);
    // Block breaking stripes handlers
    PipeManager.registerStripesHandler(new StripesHandlerMinecartDestroy(), 0);
    PipeManager.registerPipePluggable(FacadePluggable.class, "facade");
    PipeManager.registerPipePluggable(GatePluggable.class, "gate");
    PipeManager.registerPipePluggable(LensPluggable.class, "lens");
    PipeManager.registerPipePluggable(PlugPluggable.class, "plug");
    PipeManager.registerPipePluggable(PowerAdapterPluggable.class, "powerAdapter");
    GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
    GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
    GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
    GateExpansions.registerExpansion(GateExpansionLightSensor.INSTANCE, new ItemStack(Blocks.daylight_detector));
    if (BuildCraftCore.loadDefaultRecipes) {
        loadRecipes();
    }
    TransportProxy.proxy.registerRenderers();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new TransportGuiHandler());
    /* Make pipes extend to connect to blocks like chests. This means that a connection going UP (the bottom of the
         * block in question) will be the only face that does not extend into the block slightly. */
    ICustomPipeConnection smallerBlockConnection = (world, pos, face, state) -> face == EnumFacing.UP ? 0 : 2 / 16f;
    PipeConnectionAPI.registerConnection(Blocks.chest, smallerBlockConnection);
    PipeConnectionAPI.registerConnection(Blocks.trapped_chest, smallerBlockConnection);
    PipeConnectionAPI.registerConnection(Blocks.hopper, smallerBlockConnection);
    if (NEPTUNE_TESTING)
        TransportPipes_BC8.init();
}
Also used : ModelBakeEvent(net.minecraftforge.client.event.ModelBakeEvent) Loader(net.minecraftforge.fml.common.Loader) net.minecraftforge.fml.common.event(net.minecraftforge.fml.common.event) ConfigChangedEvent(net.minecraftforge.fml.client.event.ConfigChangedEvent) PacketHandler(buildcraft.core.lib.network.base.PacketHandler) GateLogic(buildcraft.transport.gates.GateDefinition.GateLogic) Block(net.minecraft.block.Block) StatementManager(buildcraft.api.statements.StatementManager) RestartRequirement(buildcraft.lib.config.RestartRequirement) Side(net.minecraftforge.fml.relauncher.Side) SchematicPipe(buildcraft.transport.schematics.SchematicPipe) Locale(java.util.Locale) IMCEvent(net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent) PipeConnectionAPI(buildcraft.api.transport.PipeConnectionAPI) buildcraft.transport.client.model(buildcraft.transport.client.model) buildcraft.transport.network(buildcraft.transport.network) PrintWriter(java.io.PrintWriter) ItemBuildCraft(buildcraft.core.lib.items.ItemBuildCraft) ModelHelper(buildcraft.core.lib.utils.ModelHelper) ITriggerInternal(buildcraft.api.statements.ITriggerInternal) net.minecraft.item(net.minecraft.item) BptPipeRotatable(buildcraft.transport.schematics.BptPipeRotatable) buildcraft.transport.statements(buildcraft.transport.statements) GateExpansions(buildcraft.api.gates.GateExpansions) IActionInternal(buildcraft.api.statements.IActionInternal) ColorUtils(buildcraft.core.lib.utils.ColorUtils) TickEvent(net.minecraftforge.fml.common.gameevent.TickEvent) ICustomPipeConnection(buildcraft.api.transport.ICustomPipeConnection) PipeContents(buildcraft.transport.statements.TriggerPipeContents.PipeContents) Blocks(net.minecraft.init.Blocks) buildcraft.transport(buildcraft.transport) IGateExpansion(buildcraft.api.gates.IGateExpansion) BuilderAPI(buildcraft.api.blueprints.BuilderAPI) GameRegistry(net.minecraftforge.fml.common.registry.GameRegistry) BlockPipe(buildcraft.transport.block.BlockPipe) buildcraft.transport.gates(buildcraft.transport.gates) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) PipeWire(buildcraft.api.transport.PipeWire) buildcraft.transport.pipes(buildcraft.transport.pipes) TextureStitchEvent(net.minecraftforge.client.event.TextureStitchEvent) ListRegistry(buildcraft.api.lists.ListRegistry) Mod(net.minecraftforge.fml.common.Mod) LinkedList(java.util.LinkedList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) WorldServer(net.minecraft.world.WorldServer) DimensionManager(net.minecraftforge.common.DimensionManager) RecipeSorter(net.minecraftforge.oredict.RecipeSorter) FacadeAPI(buildcraft.api.facades.FacadeAPI) Time(buildcraft.transport.statements.TriggerClockTimer.Time) BCLog(buildcraft.api.core.BCLog) BptPipeFiltered(buildcraft.transport.schematics.BptPipeFiltered) buildcraft.transport.stripes(buildcraft.transport.stripes) Items(net.minecraft.init.Items) EnumFacing(net.minecraft.util.EnumFacing) buildcraft.transport.pluggable(buildcraft.transport.pluggable) buildcraft.core(buildcraft.core) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) GateMaterial(buildcraft.transport.gates.GateDefinition.GateMaterial) IBlockState(net.minecraft.block.state.IBlockState) EnumColor(buildcraft.api.core.EnumColor) MinecraftForge(net.minecraftforge.common.MinecraftForge) NetworkRegistry(net.minecraftforge.fml.common.network.NetworkRegistry) PipeTransportRendererFluids(buildcraft.transport.client.render.PipeTransportRendererFluids) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SchematicTile(buildcraft.api.blueprints.SchematicTile) PipeManager(buildcraft.api.transport.PipeManager) BptPipeFiltered(buildcraft.transport.schematics.BptPipeFiltered) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) PacketHandler(buildcraft.core.lib.network.base.PacketHandler) BptPipeRotatable(buildcraft.transport.schematics.BptPipeRotatable) ICustomPipeConnection(buildcraft.api.transport.ICustomPipeConnection)

Aggregations

BuilderAPI (buildcraft.api.blueprints.BuilderAPI)1 SchematicTile (buildcraft.api.blueprints.SchematicTile)1 BCLog (buildcraft.api.core.BCLog)1 EnumColor (buildcraft.api.core.EnumColor)1 FacadeAPI (buildcraft.api.facades.FacadeAPI)1 GateExpansions (buildcraft.api.gates.GateExpansions)1 IGateExpansion (buildcraft.api.gates.IGateExpansion)1 ListRegistry (buildcraft.api.lists.ListRegistry)1 IActionInternal (buildcraft.api.statements.IActionInternal)1 ITriggerInternal (buildcraft.api.statements.ITriggerInternal)1 StatementManager (buildcraft.api.statements.StatementManager)1 ICustomPipeConnection (buildcraft.api.transport.ICustomPipeConnection)1 PipeConnectionAPI (buildcraft.api.transport.PipeConnectionAPI)1 PipeManager (buildcraft.api.transport.PipeManager)1 PipeWire (buildcraft.api.transport.PipeWire)1 buildcraft.core (buildcraft.core)1 ItemBuildCraft (buildcraft.core.lib.items.ItemBuildCraft)1 ChannelHandler (buildcraft.core.lib.network.base.ChannelHandler)1 PacketHandler (buildcraft.core.lib.network.base.PacketHandler)1 ColorUtils (buildcraft.core.lib.utils.ColorUtils)1