@EventHandler public void initialize(FMLInitializationEvent evt) { // MinecraftForge.registerConnectionHandler(new ConnectionHandler()); ActionManager.registerTriggerProvider(new DefaultTriggerProvider()); ActionManager.registerActionProvider(new DefaultActionProvider()); if (BuildCraftCore.modifyWorld) { MinecraftForge.EVENT_BUS.register(new SpringPopulate()); } if (BuildCraftCore.loadDefaultRecipes) { loadRecipes(); } EntityRegistry.registerModEntity( EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true); EntityRegistry.registerModEntity( EntityPowerLaser.class, "bcLaser", EntityIds.LASER, instance, 50, 1, true); EntityRegistry.registerModEntity( EntityEnergyLaser.class, "bcEnergyLaser", EntityIds.ENERGY_LASER, instance, 50, 1, true); EntityList.classToStringMapping.remove(EntityRobot.class); EntityList.classToStringMapping.remove(EntityPowerLaser.class); EntityList.classToStringMapping.remove(EntityEnergyLaser.class); EntityList.stringToClassMapping.remove("BuildCraft|Core.bcRobot"); EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser"); EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser"); CoreProxy.proxy.initializeRendering(); CoreProxy.proxy.initializeEntityRendering(); Localization.addLocalization("/lang/buildcraft/", DefaultProps.DEFAULT_LANGUAGE); }
public ContainerGateInterface(IInventory playerInventory, Pipe pipe) { super(0); this.playerIInventory = playerInventory; for (int l = 0; l < 3; l++) for (int k1 = 0; k1 < 9; k1++) addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 123 + l * 18)); for (int i1 = 0; i1 < 9; i1++) addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 181)); this.pipe = pipe; // Do not attempt to create a list of potential actions and triggers on // the client. if (!CoreProxy.proxy.isRemote(pipe.worldObj)) { _potentialActions.addAll(pipe.getActions()); _potentialTriggers.addAll(ActionManager.getPipeTriggers(pipe)); for (Orientations o : Orientations.dirs()) { Position pos = new Position(pipe.xCoord, pipe.yCoord, pipe.zCoord, o); pos.moveForwards(1.0); TileEntity tile = pipe.worldObj.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z); int blockID = pipe.worldObj.getBlockId((int) pos.x, (int) pos.y, (int) pos.z); Block block = Block.blocksList[blockID]; LinkedList<ITrigger> nearbyTriggers = ActionManager.getNeighborTriggers(block, tile); for (ITrigger t : nearbyTriggers) if (!_potentialTriggers.contains(t)) _potentialTriggers.add(t); LinkedList<IAction> nearbyActions = ActionManager.getNeighborActions(block, tile); for (IAction a : nearbyActions) if (!_potentialActions.contains(a)) _potentialActions.add(a); } } }
@Init public void load(FMLInitializationEvent evt) { // Register connection handler // MinecraftForge.registerConnectionHandler(new ConnectionHandler()); // Register gui handler // MinecraftForge.setGuiHandler(mod_BuildCraftTransport.instance, new GuiHandler()); TransportProxy.proxy.registerTileEntities(); // dockingStationBlock = new // BlockDockingStation(Integer.parseInt(dockingStationId.value)); // ModLoader.registerBlock(dockingStationBlock); // CoreProxy.addName(dockingStationBlock.setBlockName("dockingStation"), // "Docking Station"); // ModLoader.RegisterTileEntity(TileDockingStation.class, // "net.minecraft.src.buildcraft.TileDockingStation"); for (int j = 0; j < 6; ++j) { diamondTextures[j] = 1 * 16 + 6 + j; } new BptBlockPipe(genericPipeBlock.blockID); BuildCraftCore.itemBptProps[pipeItemsWood.itemID] = new BptItemPipeWooden(); BuildCraftCore.itemBptProps[pipeLiquidsWood.itemID] = new BptItemPipeWooden(); BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron(); BuildCraftCore.itemBptProps[pipeLiquidsIron.itemID] = new BptItemPipeIron(); BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond(); BuildCraftCore.itemBptProps[pipeItemsEmerald.itemID] = new BptItemPipeEmerald(); ActionManager.registerTriggerProvider(new PipeTriggerProvider()); if (BuildCraftCore.loadDefaultRecipes) { loadRecipes(); } TransportProxy.proxy.registerRenderers(); NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler()); }
@EventHandler public void preInitialize(FMLPreInitializationEvent evt) { aboLog.setParent(FMLLog.getLogger()); aboLog.info( "Starting Additional-Buildcraft-Objects #@BUILD_NUMBER@ " + VERSION + " (Built for Minecraft @MINECRAFT_VERSION@ with Buildcraft @BUILDCRAFT_VERSION@ and Forge @FORGE_VERSION@"); aboLog.info("Copyright (c) Flow86, 2011-2013"); aboConfiguration = new ABOConfiguration(new File(evt.getModConfigurationDirectory(), "abo/main.conf")); try { aboConfiguration.load(); itemGateSettingsDuplicator = createItem( itemGateSettingsDuplicatorID, ItemGateSettingsDuplicator.class, "Gate Settings Duplicator", BuildCraftCore.wrenchItem, BuildCraftTransport.pipeGateAutarchic, null); pipeFluidsValve = createPipe( pipeFluidsValveID, PipeFluidsValve.class, "Valve Pipe", 1, BuildCraftTransport.pipeFluidsWood, BuildCraftTransport.pipeGateAutarchic, null); pipeFluidsGoldenIron = createPipe( pipeFluidsGoldenIronID, PipeFluidsGoldenIron.class, "Golden Iron Waterproof Pipe", 1, BuildCraftTransport.pipeFluidsGold, BuildCraftTransport.pipeFluidsIron, null); pipeFluidsBalance = createPipe( pipeFluidsBalanceID, PipeFluidsBalance.class, "Balancing Waterproof Pipe", 1, BuildCraftTransport.pipeFluidsWood, new ItemStack(BuildCraftEnergy.engineBlock, 1, 0), BuildCraftTransport.pipeFluidsWood); pipeFluidsDiamond = createPipe( pipeFluidsDiamondID, PipeFluidsDistribution.class, "Diamond Waterproof Pipe", 1, BuildCraftTransport.pipeItemsDiamond, BuildCraftTransport.pipeWaterproof, null); if (GameRegistry.findItem("APUnofficial", "item.PipeFluidsWaterPump") == null) { pipeFluidsWaterPump = createPipe( pipeFluidsWaterPumpID, PipeFluidsPump.class, "Water Pump Pipe", 1, false, new Object[] { " L ", "rPr", " W ", 'r', Item.redstone, 'P', BuildCraftCore.ironGearItem, 'L', BuildCraftTransport.pipeFluidsGold, 'W', BuildCraftTransport.pipeFluidsWood }); } pipeItemsRoundRobin = createPipe( pipeItemsRoundRobinID, PipeItemsRoundRobin.class, "RoundRobin Transport Pipe", 1, BuildCraftTransport.pipeItemsStone, Block.gravel, null); pipeItemsCompactor = createPipe( pipeItemsCompactorID, PipeItemsCompactor.class, "Compactor Pipe", 1, BuildCraftTransport.pipeItemsStone, Block.pistonBase, null); pipeItemsInsertion = createPipe( pipeItemsInsertionID, PipeItemsInsertion.class, "Insertion Pipe", 1, BuildCraftTransport.pipeItemsIron, new ItemStack(Item.dyePowder, 1, 2), null); pipeItemsExtraction = createPipe( pipeItemsExtractionID, PipeItemsExtraction.class, "Extraction Transport Pipe", 1, BuildCraftTransport.pipeItemsWood, Block.planks, null); pipeItemsBounce = createPipe( pipeItemsBounceID, PipeItemsBounce.class, "Bounce Transport Pipe", 1, BuildCraftTransport.pipeItemsStone, Block.cobblestone, null); pipeItemsCrossover = createPipe( pipeItemsCrossoverID, PipeItemsCrossover.class, "Crossover Transport Pipe", 1, BuildCraftTransport.pipeItemsStone, BuildCraftTransport.pipeItemsIron, null); pipeItemsStripes = createPipe( pipeItemsStripesID, PipeItemsStripes.class, "Stripes Transport Pipe", 8, new ItemStack(Item.dyePowder, 1, 0), Block.glass, new ItemStack(Item.dyePowder, 1, 11)); pipePowerSwitch = createPipe( pipePowerSwitchID, PipePowerSwitch.class, "Power Switch Pipe", 1, BuildCraftTransport.pipePowerGold, Block.lever, null); pipePowerIron = createPipe( pipePowerIronID, PipePowerIron.class, "Iron Power Pipe", 1, Item.redstone, BuildCraftTransport.pipeItemsIron, null); pipeDistributionConductive = createPipe( pipeDistributionConductiveID, PipePowerDistribution.class, "Distribution Conductive Pipe", 2, pipePowerIron, BuildCraftTransport.pipeItemsDiamond, pipePowerIron); triggerEngineSafe = new TriggerEngineSafe(triggerEngineSafeID); actionSwitchOnPipe = new ActionSwitchOnPipe(actionSwitchOnPipeID); actionToggleOnPipe = new ActionToggleOnPipe(actionToggleOnPipeID); actionToggleOffPipe = new ActionToggleOffPipe(actionToggleOffPipeID); ActionManager.registerActionProvider(new ABOActionProvider()); ActionManager.registerTriggerProvider(new ABOTriggerProvider()); BuildCraftCore.itemBptProps[pipeItemsExtraction.itemID] = new BptItemPipeWooden(); BuildCraftCore.itemBptProps[pipeFluidsValve.itemID] = new BptItemPipeIron(); BuildCraftCore.itemBptProps[pipeFluidsGoldenIron.itemID] = new BptItemPipeIron(); BuildCraftCore.itemBptProps[pipeFluidsDiamond.itemID] = new BptItemPipeDiamond(); BuildCraftCore.itemBptProps[pipePowerIron.itemID] = new BptItemPipeIron(); MinecraftForge.EVENT_BUS.register(this); } finally { if (aboConfiguration.hasChanged()) aboConfiguration.save(); } }
@EventHandler public void init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); logger.info("Registering chunk load handler"); ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkLoadingHandler()); chunkLoadViewer = new ChunkLoadViewDataProxy(chunkSightRange); FMLCommonHandler.instance().bus().register(chunkLoadViewer); proxy.registerKeyHandler(); proxy.registerRendering(); loadConfigs(true); logger.info("Registering pipes"); loadPipes(); triggerPipeClosed = new TriggerPipeClosed("APClosed"); ActionManager.registerTriggerProvider(new GateProvider()); if (allowWRRemove) { // Additional Pipes GameRegistry.addRecipe( new ItemStack(pipeItemsTeleport), new Object[] {"A", 'A', pipePowerTeleport}); GameRegistry.addRecipe( new ItemStack(pipeItemsTeleport), new Object[] {"A", 'A', pipeLiquidsTeleport}); GameRegistry.addRecipe( new ItemStack(pipeItemsRedStone), new Object[] {"A", 'A', pipeLiquidsRedstone}); // BC Liquid GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsCobblestone), new Object[] {"A", 'A', BuildCraftTransport.pipeFluidsCobblestone}); GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsGold), new Object[] {"A", 'A', BuildCraftTransport.pipeFluidsGold}); GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsIron), new Object[] {"A", 'A', BuildCraftTransport.pipeFluidsIron}); GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsStone), new Object[] {"A", 'A', BuildCraftTransport.pipeFluidsStone}); GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsWood), new Object[] {"A", 'A', BuildCraftTransport.pipeFluidsWood}); // BC Power GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsGold), new Object[] {"A", 'A', BuildCraftTransport.pipePowerGold}); GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsStone), new Object[] {"A", 'A', BuildCraftTransport.pipePowerStone}); GameRegistry.addRecipe( new ItemStack(BuildCraftTransport.pipeItemsWood), new Object[] {"A", 'A', BuildCraftTransport.pipePowerWood}); } // ChunkLoader blockChunkLoader = new BlockChunkLoader(); blockChunkLoader.setBlockName("TeleportTether"); GameRegistry.registerBlock(blockChunkLoader, ItemBlock.class, "chunkLoader"); GameRegistry.registerTileEntity(TileChunkLoader.class, "TeleportTether"); GameRegistry.addRecipe( new ItemStack(blockChunkLoader), new Object[] { "iii", "iLi", "iii", 'i', Items.iron_ingot, 'L', new ItemStack(Items.dye, 1, 4) }); }
@EventHandler public void preInit(FMLPreInitializationEvent evt) { Property fillerDestroyProp = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "filler.destroy", DefaultProps.FILLER_DESTROY); fillerDestroyProp.comment = "If true, Filler will destroy blocks instead of breaking them."; fillerDestroy = fillerDestroyProp.getBoolean(DefaultProps.FILLER_DESTROY); Property fillerLifespanToughProp = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "filler.lifespan.tough", DefaultProps.FILLER_LIFESPAN_TOUGH); fillerLifespanToughProp.comment = "Lifespan in ticks of items dropped by the filler from 'tough' blocks (those that can't be broken by hand)"; fillerLifespanTough = fillerLifespanToughProp.getInt(DefaultProps.FILLER_LIFESPAN_TOUGH); Property fillerLifespanNormalProp = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "filler.lifespan.other", DefaultProps.FILLER_LIFESPAN_NORMAL); fillerLifespanNormalProp.comment = "Lifespan in ticks of items dropped by the filler from non-tough blocks (those that can be broken by hand)"; fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL); templateItem = new ItemBptTemplate(); templateItem.setUnlocalizedName("templateItem"); LanguageRegistry.addName(templateItem, "Template"); CoreProxy.proxy.registerItem(templateItem); blueprintItem = new ItemBptBluePrint(); blueprintItem.setUnlocalizedName("blueprintItem"); LanguageRegistry.addName(blueprintItem, "Blueprint"); CoreProxy.proxy.registerItem(blueprintItem); markerBlock = new BlockMarker(); CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock")); pathMarkerBlock = new BlockPathMarker(); CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock")); fillerBlock = new BlockFiller(); CoreProxy.proxy.registerBlock(fillerBlock.setBlockName("fillerBlock")); builderBlock = new BlockBuilder(); CoreProxy.proxy.registerBlock(builderBlock.setBlockName("builderBlock")); architectBlock = new BlockArchitect(); CoreProxy.proxy.registerBlock(architectBlock.setBlockName("architectBlock")); libraryBlock = new BlockBlueprintLibrary(); CoreProxy.proxy.registerBlock(libraryBlock.setBlockName("libraryBlock")); GameRegistry.registerTileEntity(TileMarker.class, "Marker"); GameRegistry.registerTileEntity(TileFiller.class, "Filler"); GameRegistry.registerTileEntity(TileBuilder.class, "net.minecraft.src.builders.TileBuilder"); GameRegistry.registerTileEntity(TileArchitect.class, "net.minecraft.src.builders.TileTemplate"); GameRegistry.registerTileEntity( TilePathMarker.class, "net.minecraft.src.builders.TilePathMarker"); GameRegistry.registerTileEntity( TileBlueprintLibrary.class, "net.minecraft.src.builders.TileBlueprintLibrary"); if (BuildCraftCore.mainConfiguration.hasChanged()) { BuildCraftCore.mainConfiguration.save(); } MinecraftForge.EVENT_BUS.register(this); // Create filler registry try { FillerManager.registry = new FillerRegistry(); // INIT FILLER PATTERNS FillerManager.registry.addPattern(PatternFill.INSTANCE); FillerManager.registry.addPattern(new PatternFlatten()); FillerManager.registry.addPattern(new PatternHorizon()); FillerManager.registry.addPattern(new PatternClear()); FillerManager.registry.addPattern(new PatternBox()); FillerManager.registry.addPattern(new PatternPyramid()); FillerManager.registry.addPattern(new PatternStairs()); FillerManager.registry.addPattern(new PatternCylinder()); } catch (Error error) { BCLog.logErrorAPI("Buildcraft", error, IFillerPattern.class); throw error; } ActionManager.registerActionProvider(new BuildersActionProvider()); }