2012-05-09 22:43:05 +02:00
/ * *
2017-11-10 19:30:16 +01:00
* Copyright ( c ) 2011 - 2017 , SpaceToad and the BuildCraft Team
2014-02-01 17:19:07 +01:00
* http : //www.mod-buildcraft.com
2015-09-20 11:20:30 +02:00
* < p / >
2014-02-01 17:19:07 +01:00
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1 . 0 , or MMPL . Please check the contents of the license located in
* http : //www.mod-buildcraft.com/MMPL-1.0.txt
2012-05-09 22:43:05 +02:00
* /
2012-07-25 12:45:15 +02:00
package buildcraft ;
2012-05-09 22:43:05 +02:00
2014-10-30 12:47:55 +01:00
import java.io.PrintWriter ;
2014-02-16 12:14:30 +01:00
import java.util.LinkedList ;
2015-05-07 19:37:48 +02:00
2014-02-16 12:14:30 +01:00
import net.minecraft.block.Block ;
import net.minecraft.init.Blocks ;
import net.minecraft.init.Items ;
import net.minecraft.item.Item ;
import net.minecraft.item.ItemBlock ;
2015-03-21 11:20:07 +01:00
import net.minecraft.item.ItemMinecart ;
2014-02-16 12:14:30 +01:00
import net.minecraft.item.ItemStack ;
2015-03-20 15:07:12 +01:00
import net.minecraft.world.WorldServer ;
2015-09-20 11:20:30 +02:00
2015-04-02 14:46:57 +02:00
import cpw.mods.fml.client.event.ConfigChangedEvent ;
2015-03-20 15:07:12 +01:00
import cpw.mods.fml.common.FMLCommonHandler ;
2014-10-16 10:41:55 +02:00
import cpw.mods.fml.common.Loader ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.Mod ;
import cpw.mods.fml.common.event.FMLInitializationEvent ;
2014-05-08 21:57:05 +02:00
import cpw.mods.fml.common.event.FMLInterModComms ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent ;
2015-03-05 16:36:04 +01:00
import cpw.mods.fml.common.event.FMLMissingMappingsEvent ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.event.FMLPostInitializationEvent ;
import cpw.mods.fml.common.event.FMLPreInitializationEvent ;
2015-03-20 15:07:12 +01:00
import cpw.mods.fml.common.event.FMLServerStartingEvent ;
import cpw.mods.fml.common.event.FMLServerStoppingEvent ;
2015-04-01 08:13:06 +02:00
import cpw.mods.fml.common.eventhandler.SubscribeEvent ;
2015-03-20 15:07:12 +01:00
import cpw.mods.fml.common.gameevent.TickEvent ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.network.NetworkRegistry ;
import cpw.mods.fml.common.registry.GameRegistry ;
2015-03-20 15:07:12 +01:00
import cpw.mods.fml.relauncher.Side ;
2015-04-01 08:13:06 +02:00
import cpw.mods.fml.relauncher.SideOnly ;
import net.minecraftforge.client.event.TextureStitchEvent ;
2015-03-20 15:07:12 +01:00
import net.minecraftforge.common.DimensionManager ;
2015-04-01 08:13:06 +02:00
import net.minecraftforge.common.MinecraftForge ;
2014-02-16 12:14:30 +01:00
import net.minecraftforge.common.util.ForgeDirection ;
2014-02-23 23:28:15 +01:00
import net.minecraftforge.oredict.RecipeSorter ;
2015-03-05 16:36:04 +01:00
import net.minecraftforge.oredict.ShapedOreRecipe ;
2015-05-07 19:49:53 +02:00
2014-10-26 12:27:51 +01:00
import buildcraft.api.blueprints.BuilderAPI ;
2015-10-02 13:05:09 +02:00
import buildcraft.api.blueprints.SchematicTile ;
2015-03-05 16:36:04 +01:00
import buildcraft.api.core.BCLog ;
2014-07-08 23:38:24 +02:00
import buildcraft.api.core.EnumColor ;
2013-03-16 09:21:48 +01:00
import buildcraft.api.core.IIconProvider ;
2015-03-15 15:58:51 +01:00
import buildcraft.api.facades.FacadeAPI ;
2014-02-16 12:14:30 +01:00
import buildcraft.api.gates.GateExpansions ;
2015-03-15 15:58:51 +01:00
import buildcraft.api.gates.IGateExpansion ;
2015-08-07 13:23:47 +02:00
import buildcraft.api.lists.ListRegistry ;
2014-10-28 16:36:06 +01:00
import buildcraft.api.statements.IActionInternal ;
import buildcraft.api.statements.ITriggerInternal ;
import buildcraft.api.statements.StatementManager ;
2014-12-18 11:56:04 +01:00
import buildcraft.api.transport.PipeManager ;
import buildcraft.api.transport.PipeWire ;
2015-03-04 22:44:44 +01:00
import buildcraft.core.BCCreativeTab ;
2015-09-29 09:54:12 +02:00
import buildcraft.core.BCRegistry ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.CompatHooks ;
2012-07-25 12:45:15 +02:00
import buildcraft.core.DefaultProps ;
2013-09-12 15:27:11 +02:00
import buildcraft.core.InterModComms ;
2014-10-19 14:42:58 +02:00
import buildcraft.core.PowerMode ;
2012-09-08 21:46:17 +02:00
import buildcraft.core.Version ;
2015-04-02 14:46:57 +02:00
import buildcraft.core.config.ConfigManager ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.lib.items.ItemBuildCraft ;
2015-03-06 16:45:05 +01:00
import buildcraft.core.lib.network.ChannelHandler ;
import buildcraft.core.lib.utils.ColorUtils ;
2013-06-29 19:03:36 +02:00
import buildcraft.transport.BlockFilteredBuffer ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.BlockGenericPipe ;
2014-12-15 19:10:12 +01:00
import buildcraft.transport.FacadePluggable ;
2015-07-14 00:37:07 +02:00
import buildcraft.transport.IDiamondPipe ;
2015-03-04 15:49:21 +01:00
import buildcraft.transport.IMCHandlerTransport ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.ItemFacade ;
2014-10-25 22:22:25 +02:00
import buildcraft.transport.ItemGateCopier ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.ItemPipe ;
2014-02-16 12:14:30 +01:00
import buildcraft.transport.ItemPipeWire ;
2015-08-08 16:14:55 +02:00
import buildcraft.transport.LensFilterHandler ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.Pipe ;
2014-10-19 21:04:02 +02:00
import buildcraft.transport.PipeActionProvider ;
2014-10-26 16:32:13 +01:00
import buildcraft.transport.PipeColoringRecipe ;
2015-08-08 16:14:55 +02:00
import buildcraft.transport.PipeEventBus ;
2013-03-16 00:47:08 +01:00
import buildcraft.transport.PipeIconProvider ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.PipeTriggerProvider ;
2014-05-08 21:57:05 +02:00
import buildcraft.transport.TileFilteredBuffer ;
import buildcraft.transport.TileGenericPipe ;
2015-03-31 23:21:00 +02:00
import buildcraft.transport.TransportGuiHandler ;
2012-08-24 15:20:43 +02:00
import buildcraft.transport.TransportProxy ;
2015-04-25 12:51:33 +02:00
import buildcraft.transport.TransportSiliconRecipes ;
2013-03-16 00:47:08 +01:00
import buildcraft.transport.WireIconProvider ;
2015-04-01 08:13:06 +02:00
import buildcraft.transport.gates.GateDefinition ;
2014-10-19 21:46:19 +02:00
import buildcraft.transport.gates.GateDefinition.GateLogic ;
import buildcraft.transport.gates.GateDefinition.GateMaterial ;
2015-03-15 15:58:51 +01:00
import buildcraft.transport.gates.GateExpansionLightSensor ;
2013-12-05 22:38:00 +01:00
import buildcraft.transport.gates.GateExpansionPulsar ;
2013-12-27 17:40:44 +01:00
import buildcraft.transport.gates.GateExpansionRedstoneFader ;
2013-12-24 09:22:17 +01:00
import buildcraft.transport.gates.GateExpansionTimer ;
2014-12-15 19:10:12 +01:00
import buildcraft.transport.gates.GatePluggable ;
2014-02-16 12:14:30 +01:00
import buildcraft.transport.gates.ItemGate ;
2015-03-04 15:49:21 +01:00
import buildcraft.transport.network.PacketFluidUpdate ;
2012-08-24 19:25:54 +02:00
import buildcraft.transport.network.PacketHandlerTransport ;
2015-03-04 15:49:21 +01:00
import buildcraft.transport.network.PacketPipeTransportItemStack ;
import buildcraft.transport.network.PacketPipeTransportItemStackRequest ;
import buildcraft.transport.network.PacketPipeTransportTraveler ;
import buildcraft.transport.network.PacketPowerUpdate ;
2015-07-13 17:22:18 +02:00
import buildcraft.transport.pipes.PipeFluidsClay ;
2013-07-08 04:57:05 +02:00
import buildcraft.transport.pipes.PipeFluidsCobblestone ;
2014-11-23 10:56:36 +01:00
import buildcraft.transport.pipes.PipeFluidsDiamond ;
2013-07-08 04:57:05 +02:00
import buildcraft.transport.pipes.PipeFluidsEmerald ;
import buildcraft.transport.pipes.PipeFluidsGold ;
import buildcraft.transport.pipes.PipeFluidsIron ;
2014-09-01 08:18:31 +02:00
import buildcraft.transport.pipes.PipeFluidsQuartz ;
2013-07-08 04:57:05 +02:00
import buildcraft.transport.pipes.PipeFluidsSandstone ;
import buildcraft.transport.pipes.PipeFluidsStone ;
import buildcraft.transport.pipes.PipeFluidsVoid ;
import buildcraft.transport.pipes.PipeFluidsWood ;
2014-11-12 17:07:35 +01:00
import buildcraft.transport.pipes.PipeItemsClay ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipeItemsCobblestone ;
2013-07-24 23:39:07 +02:00
import buildcraft.transport.pipes.PipeItemsDaizuli ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipeItemsDiamond ;
2013-01-15 02:05:49 +01:00
import buildcraft.transport.pipes.PipeItemsEmerald ;
2014-02-16 12:14:30 +01:00
import buildcraft.transport.pipes.PipeItemsEmzuli ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipeItemsGold ;
import buildcraft.transport.pipes.PipeItemsIron ;
2013-07-24 06:48:51 +02:00
import buildcraft.transport.pipes.PipeItemsLapis ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipeItemsObsidian ;
2013-06-13 04:26:46 +02:00
import buildcraft.transport.pipes.PipeItemsQuartz ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipeItemsSandstone ;
import buildcraft.transport.pipes.PipeItemsStone ;
2014-03-15 21:20:42 +01:00
import buildcraft.transport.pipes.PipeItemsStripes ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipeItemsVoid ;
import buildcraft.transport.pipes.PipeItemsWood ;
2013-06-12 11:35:15 +02:00
import buildcraft.transport.pipes.PipePowerCobblestone ;
import buildcraft.transport.pipes.PipePowerDiamond ;
2014-09-04 13:07:37 +02:00
import buildcraft.transport.pipes.PipePowerEmerald ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipePowerGold ;
2013-09-26 03:16:59 +02:00
import buildcraft.transport.pipes.PipePowerIron ;
2013-06-13 04:26:46 +02:00
import buildcraft.transport.pipes.PipePowerQuartz ;
2014-11-12 15:37:56 +01:00
import buildcraft.transport.pipes.PipePowerSandstone ;
2012-07-25 12:45:15 +02:00
import buildcraft.transport.pipes.PipePowerStone ;
import buildcraft.transport.pipes.PipePowerWood ;
import buildcraft.transport.pipes.PipeStructureCobblestone ;
2014-12-22 12:08:17 +01:00
import buildcraft.transport.pluggable.ItemLens ;
import buildcraft.transport.pluggable.ItemPlug ;
2015-07-17 16:39:11 +02:00
import buildcraft.transport.pluggable.ItemPowerAdapter ;
2014-12-22 12:08:17 +01:00
import buildcraft.transport.pluggable.LensPluggable ;
import buildcraft.transport.pluggable.PlugPluggable ;
2015-07-17 16:39:11 +02:00
import buildcraft.transport.pluggable.PowerAdapterPluggable ;
2015-06-04 16:17:58 +02:00
import buildcraft.transport.render.PipeRendererTESR ;
2015-07-14 00:37:07 +02:00
import buildcraft.transport.schematics.BptPipeFiltered ;
import buildcraft.transport.schematics.BptPipeRotatable ;
2014-05-10 13:37:50 +02:00
import buildcraft.transport.schematics.SchematicPipe ;
2014-10-26 13:20:08 +01:00
import buildcraft.transport.statements.ActionEnergyPulsar ;
import buildcraft.transport.statements.ActionExtractionPreset ;
import buildcraft.transport.statements.ActionParameterSignal ;
import buildcraft.transport.statements.ActionPipeColor ;
import buildcraft.transport.statements.ActionPipeDirection ;
import buildcraft.transport.statements.ActionPowerLimiter ;
import buildcraft.transport.statements.ActionRedstoneFaderOutput ;
import buildcraft.transport.statements.ActionSignalOutput ;
import buildcraft.transport.statements.ActionSingleEnergyPulse ;
import buildcraft.transport.statements.ActionValve ;
2014-10-26 17:56:18 +01:00
import buildcraft.transport.statements.ActionValve.ValveState ;
2014-10-26 13:20:08 +01:00
import buildcraft.transport.statements.TriggerClockTimer ;
2014-10-26 19:09:54 +01:00
import buildcraft.transport.statements.TriggerClockTimer.Time ;
2015-03-15 15:58:51 +01:00
import buildcraft.transport.statements.TriggerLightSensor ;
2014-10-26 13:20:08 +01:00
import buildcraft.transport.statements.TriggerParameterSignal ;
import buildcraft.transport.statements.TriggerPipeContents ;
2014-10-26 19:09:54 +01:00
import buildcraft.transport.statements.TriggerPipeContents.PipeContents ;
2014-10-26 13:20:08 +01:00
import buildcraft.transport.statements.TriggerPipeSignal ;
import buildcraft.transport.statements.TriggerRedstoneFaderInput ;
2015-05-07 19:49:53 +02:00
import buildcraft.transport.stripes.PipeExtensionListener ;
import buildcraft.transport.stripes.StripesHandlerArrow ;
import buildcraft.transport.stripes.StripesHandlerBucket ;
import buildcraft.transport.stripes.StripesHandlerDispenser ;
import buildcraft.transport.stripes.StripesHandlerEntityInteract ;
import buildcraft.transport.stripes.StripesHandlerHoe ;
import buildcraft.transport.stripes.StripesHandlerMinecartDestroy ;
import buildcraft.transport.stripes.StripesHandlerPipeWires ;
import buildcraft.transport.stripes.StripesHandlerPipes ;
import buildcraft.transport.stripes.StripesHandlerPlaceBlock ;
import buildcraft.transport.stripes.StripesHandlerPlant ;
import buildcraft.transport.stripes.StripesHandlerRightClick ;
import buildcraft.transport.stripes.StripesHandlerShears ;
import buildcraft.transport.stripes.StripesHandlerUse ;
2014-02-01 17:19:07 +01:00
2015-03-05 16:36:04 +01:00
@Mod ( version = Version . VERSION , modid = " BuildCraft|Transport " , name = " Buildcraft Transport " , dependencies = DefaultProps . DEPENDENCY_CORE )
2014-01-13 20:26:16 +01:00
public class BuildCraftTransport extends BuildCraftMod {
2014-07-28 23:51:50 +02:00
@Mod.Instance ( " BuildCraft|Transport " )
public static BuildCraftTransport instance ;
2012-12-06 00:07:37 +01:00
public static float pipeDurability ;
2015-09-20 11:20:30 +02:00
public static int pipeFluidsBaseFlowRate ;
public static boolean facadeTreatBlacklistAsWhitelist ;
public static boolean additionalWaterproofingRecipe ;
2015-04-09 22:19:40 +02:00
public static boolean facadeForceNonLaserRecipe ;
2015-09-26 16:40:37 +02:00
public static boolean showAllFacadesCreative ;
2014-08-03 11:38:35 +02:00
public static BlockGenericPipe genericPipeBlock ;
public static BlockFilteredBuffer filteredBufferBlock ;
2012-05-09 22:43:05 +02:00
public static Item pipeWaterproof ;
public static Item pipeGate ;
2014-01-02 13:58:08 +01:00
public static Item pipeWire ;
2014-08-03 11:38:35 +02:00
public static Item plugItem ;
2014-12-17 16:19:03 +01:00
public static Item lensItem ;
2014-12-21 12:19:34 +01:00
public static Item powerAdapterItem ;
2014-08-03 11:38:35 +02:00
public static Item pipeStructureCobblestone ;
2014-10-25 22:22:25 +02:00
public static Item gateCopier ;
2014-08-03 11:38:35 +02:00
public static ItemFacade facadeItem ;
2012-05-09 22:43:05 +02:00
public static Item pipeItemsWood ;
2013-01-15 02:05:49 +01:00
public static Item pipeItemsEmerald ;
2012-05-09 22:43:05 +02:00
public static Item pipeItemsStone ;
public static Item pipeItemsCobblestone ;
public static Item pipeItemsIron ;
2013-06-13 04:26:46 +02:00
public static Item pipeItemsQuartz ;
2012-05-09 22:43:05 +02:00
public static Item pipeItemsGold ;
public static Item pipeItemsDiamond ;
public static Item pipeItemsObsidian ;
2013-07-24 06:48:51 +02:00
public static Item pipeItemsLapis ;
2013-07-24 23:39:07 +02:00
public static Item pipeItemsDaizuli ;
2012-06-28 16:26:50 +02:00
public static Item pipeItemsVoid ;
2012-06-28 17:25:09 +02:00
public static Item pipeItemsSandstone ;
2013-11-24 15:23:02 +01:00
public static Item pipeItemsEmzuli ;
2014-03-15 21:20:42 +01:00
public static Item pipeItemsStripes ;
2015-09-20 11:20:30 +02:00
public static Item pipeItemsClay ;
2013-07-08 04:57:05 +02:00
public static Item pipeFluidsWood ;
public static Item pipeFluidsCobblestone ;
public static Item pipeFluidsStone ;
2014-09-01 08:18:31 +02:00
public static Item pipeFluidsQuartz ;
2013-07-08 04:57:05 +02:00
public static Item pipeFluidsIron ;
public static Item pipeFluidsGold ;
public static Item pipeFluidsVoid ;
public static Item pipeFluidsSandstone ;
public static Item pipeFluidsEmerald ;
2014-11-13 18:07:03 +01:00
public static Item pipeFluidsDiamond ;
2015-07-13 17:22:18 +02:00
public static Item pipeFluidsClay ;
2012-05-09 22:43:05 +02:00
public static Item pipePowerWood ;
2013-06-12 11:35:15 +02:00
public static Item pipePowerCobblestone ;
2012-05-09 22:43:05 +02:00
public static Item pipePowerStone ;
2013-06-13 04:26:46 +02:00
public static Item pipePowerQuartz ;
2013-09-26 03:16:59 +02:00
public static Item pipePowerIron ;
2012-05-09 22:43:05 +02:00
public static Item pipePowerGold ;
2013-06-12 11:35:15 +02:00
public static Item pipePowerDiamond ;
2014-09-04 13:07:37 +02:00
public static Item pipePowerEmerald ;
2015-09-20 11:20:30 +02:00
public static Item pipePowerSandstone ;
2015-02-01 16:53:48 +01:00
2014-02-23 00:41:46 +01:00
public static String [ ] facadeBlacklist ;
2015-03-15 15:58:51 +01:00
public static ITriggerInternal triggerLightSensorBright , triggerLightSensorDark ;
2014-10-28 16:36:06 +01:00
public static ITriggerInternal [ ] triggerPipe = new ITriggerInternal [ PipeContents . values ( ) . length ] ;
public static ITriggerInternal [ ] triggerPipeWireActive = new ITriggerInternal [ PipeWire . values ( ) . length ] ;
public static ITriggerInternal [ ] triggerPipeWireInactive = new ITriggerInternal [ PipeWire . values ( ) . length ] ;
public static ITriggerInternal [ ] triggerTimer = new ITriggerInternal [ TriggerClockTimer . Time . VALUES . length ] ;
public static ITriggerInternal [ ] triggerRedstoneLevel = new ITriggerInternal [ 15 ] ;
public static IActionInternal [ ] actionPipeWire = new ActionSignalOutput [ PipeWire . values ( ) . length ] ;
public static IActionInternal actionEnergyPulser = new ActionEnergyPulsar ( ) ;
public static IActionInternal actionSingleEnergyPulse = new ActionSingleEnergyPulse ( ) ;
public static IActionInternal [ ] actionPipeColor = new IActionInternal [ 16 ] ;
public static IActionInternal [ ] actionPipeDirection = new IActionInternal [ 16 ] ;
public static IActionInternal [ ] actionPowerLimiter = new IActionInternal [ 7 ] ;
public static IActionInternal [ ] actionRedstoneLevel = new IActionInternal [ 15 ] ;
public static IActionInternal actionExtractionPresetRed = new ActionExtractionPreset ( EnumColor . RED ) ;
public static IActionInternal actionExtractionPresetBlue = new ActionExtractionPreset ( EnumColor . BLUE ) ;
public static IActionInternal actionExtractionPresetGreen = new ActionExtractionPreset ( EnumColor . GREEN ) ;
public static IActionInternal actionExtractionPresetYellow = new ActionExtractionPreset ( EnumColor . YELLOW ) ;
2015-09-20 11:20:30 +02:00
public static IActionInternal [ ] actionValve = new IActionInternal [ 4 ] ;
2012-05-09 22:43:05 +02:00
2015-09-20 11:20:30 +02:00
public static boolean debugPrintFacadeList = false ;
2015-05-26 15:32:51 +02:00
public static boolean usePipeLoss = false ;
2014-12-24 15:07:51 +01:00
public static float gateCostMultiplier = 1 . 0F ;
2015-02-01 16:53:48 +01:00
2015-03-20 15:07:12 +01:00
public static PipeExtensionListener pipeExtensionListener ;
2014-05-03 18:59:52 +02:00
private static LinkedList < PipeRecipe > pipeRecipes = new LinkedList < PipeRecipe > ( ) ;
2015-03-04 15:49:21 +01:00
private static ChannelHandler transportChannelHandler ;
2014-05-03 18:59:52 +02:00
public IIconProvider pipeIconProvider = new PipeIconProvider ( ) ;
public IIconProvider wireIconProvider = new WireIconProvider ( ) ;
2012-05-09 22:43:05 +02:00
private static class PipeRecipe {
boolean isShapeless = false ; // pipe recipes come shaped and unshaped.
ItemStack result ;
2012-06-04 22:48:18 +02:00
Object [ ] input ;
2012-05-09 22:43:05 +02:00
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-07-24 10:23:23 +02:00
public void preInit ( FMLPreInitializationEvent evt ) {
2012-12-17 23:30:54 +01:00
try {
2015-05-26 15:32:51 +02:00
BuildCraftCore . mainConfigManager . register ( " experimental.kinesisPowerLossOnTravel " , false , " Should kinesis pipes lose power over distance (think IC2 or BC pre-3.7)? " , ConfigManager . RestartRequirement . WORLD ) ;
2015-04-02 14:46:57 +02:00
BuildCraftCore . mainConfigManager . register ( " general.pipes.hardness " , DefaultProps . PIPES_DURABILITY , " How hard to break should a pipe be? " , ConfigManager . RestartRequirement . NONE ) ;
BuildCraftCore . mainConfigManager . register ( " general.pipes.baseFluidRate " , DefaultProps . PIPES_FLUIDS_BASE_FLOW_RATE , " What should the base flow rate of a fluid pipe be? " , ConfigManager . RestartRequirement . GAME )
. setMinValue ( 1 ) . setMaxValue ( 40 ) ;
BuildCraftCore . mainConfigManager . register ( " debug.printFacadeList " , false , " Print a list of all registered facades. " , ConfigManager . RestartRequirement . GAME ) ;
2015-09-26 16:40:37 +02:00
BuildCraftCore . mainConfigManager . register ( " general.pipes.facadeShowAllInCreative " , true , " Should all BC facades be shown in Creative/NEI, or just a few carefully chosen ones? " , ConfigManager . RestartRequirement . GAME ) ;
2015-04-02 14:46:57 +02:00
BuildCraftCore . mainConfigManager . register ( " general.pipes.slimeballWaterproofRecipe " , false , " Should I enable an alternate Waterproof recipe, based on slimeballs? " , ConfigManager . RestartRequirement . GAME ) ;
BuildCraftCore . mainConfigManager . register ( " power.gateCostMultiplier " , 1 . 0D , " What should be the multiplier of all gate power costs? " , ConfigManager . RestartRequirement . GAME ) ;
2015-09-20 11:20:30 +02:00
BuildCraftCore . mainConfigManager . register ( " general.pipes.facadeBlacklist " , new String [ ] {
2014-02-23 00:41:46 +01:00
Block . blockRegistry . getNameForObject ( Blocks . end_portal_frame ) ,
Block . blockRegistry . getNameForObject ( Blocks . grass ) ,
Block . blockRegistry . getNameForObject ( Blocks . leaves ) ,
Block . blockRegistry . getNameForObject ( Blocks . leaves2 ) ,
Block . blockRegistry . getNameForObject ( Blocks . lit_pumpkin ) ,
Block . blockRegistry . getNameForObject ( Blocks . lit_redstone_lamp ) ,
Block . blockRegistry . getNameForObject ( Blocks . mob_spawner ) ,
Block . blockRegistry . getNameForObject ( Blocks . monster_egg ) ,
Block . blockRegistry . getNameForObject ( Blocks . redstone_lamp ) ,
Block . blockRegistry . getNameForObject ( Blocks . double_stone_slab ) ,
Block . blockRegistry . getNameForObject ( Blocks . double_wooden_slab ) ,
2015-04-16 15:08:33 +02:00
Block . blockRegistry . getNameForObject ( Blocks . sponge )
2015-04-02 14:46:57 +02:00
} , " What block types should be blacklisted from being a facade? " , ConfigManager . RestartRequirement . GAME ) ;
BuildCraftCore . mainConfigManager . register ( " general.pipes.facadeBlacklistAsWhitelist " , false , " Should the blacklist be treated as a whitelist instead? " , ConfigManager . RestartRequirement . GAME ) ;
2015-04-09 18:48:07 +02:00
BuildCraftCore . mainConfigManager . register ( " general.pipes.facadeNoLaserRecipe " , false , " Should non-laser (crafting table) facade recipes be forced? " , ConfigManager . RestartRequirement . GAME ) ;
2014-02-23 00:41:46 +01:00
2015-04-02 14:46:57 +02:00
reloadConfig ( ConfigManager . RestartRequirement . GAME ) ;
2014-02-23 00:41:46 +01:00
2015-09-26 16:40:37 +02:00
if ( showAllFacadesCreative ) {
new BCCreativeTab ( " facades " ) ;
}
2015-04-02 14:46:57 +02:00
filteredBufferBlock = new BlockFilteredBuffer ( ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( filteredBufferBlock . setBlockName ( " filteredBufferBlock " ) , false ) ;
2014-11-11 09:59:04 +01:00
2014-05-03 04:20:27 +02:00
pipeWaterproof = new ItemBuildCraft ( ) ;
2013-03-07 00:22:17 +01:00
pipeWaterproof . setUnlocalizedName ( " pipeWaterproof " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( pipeWaterproof , false ) ;
2013-11-19 14:26:30 +01:00
2015-01-06 14:57:21 +01:00
genericPipeBlock = ( BlockGenericPipe ) CompatHooks . INSTANCE . getBlock ( BlockGenericPipe . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( genericPipeBlock . setBlockName ( " pipeBlock " ) , ItemBlock . class , true ) ;
2014-02-08 14:47:31 +01:00
2015-07-17 16:39:11 +02:00
pipeItemsWood = buildPipe ( PipeItemsWood . class , " plankWood " , " blockGlassColorless " , " plankWood " ) ;
pipeItemsEmerald = buildPipe ( PipeItemsEmerald . class , " gemEmerald " , " blockGlassColorless " , " gemEmerald " ) ;
pipeItemsCobblestone = buildPipe ( PipeItemsCobblestone . class , " cobblestone " , " blockGlassColorless " , " cobblestone " ) ;
pipeItemsStone = buildPipe ( PipeItemsStone . class , " stone " , " blockGlassColorless " , " stone " ) ;
pipeItemsQuartz = buildPipe ( PipeItemsQuartz . class , " blockQuartz " , " blockGlassColorless " , " blockQuartz " ) ;
pipeItemsIron = buildPipe ( PipeItemsIron . class , " ingotIron " , " blockGlassColorless " , " ingotIron " ) ;
pipeItemsGold = buildPipe ( PipeItemsGold . class , " ingotGold " , " blockGlassColorless " , " ingotGold " ) ;
pipeItemsDiamond = buildPipe ( PipeItemsDiamond . class , " gemDiamond " , " blockGlassColorless " , " gemDiamond " ) ;
pipeItemsObsidian = buildPipe ( PipeItemsObsidian . class , Blocks . obsidian , " blockGlassColorless " , Blocks . obsidian ) ;
pipeItemsLapis = buildPipe ( PipeItemsLapis . class , " blockLapis " , " blockGlassColorless " , " blockLapis " ) ;
pipeItemsDaizuli = buildPipe ( PipeItemsDaizuli . class , " blockLapis " , " blockGlassColorless " , " gemDiamond " ) ;
pipeItemsSandstone = buildPipe ( PipeItemsSandstone . class , Blocks . sandstone , " blockGlassColorless " , Blocks . sandstone ) ;
pipeItemsVoid = buildPipe ( PipeItemsVoid . class , " dyeBlack " , " blockGlassColorless " , " dustRedstone " ) ;
pipeItemsEmzuli = buildPipe ( PipeItemsEmzuli . class , " blockLapis " , " blockGlassColorless " , " gemEmerald " ) ;
pipeItemsStripes = buildPipe ( PipeItemsStripes . class , " gearGold " , " blockGlassColorless " , " gearGold " ) ;
2015-09-20 11:20:30 +02:00
pipeItemsClay = buildPipe ( PipeItemsClay . class , Blocks . clay , " blockGlassColorless " , Blocks . clay ) ;
2015-07-17 16:39:11 +02:00
pipeFluidsWood = buildPipe ( PipeFluidsWood . class , pipeWaterproof , pipeItemsWood ) ;
pipeFluidsCobblestone = buildPipe ( PipeFluidsCobblestone . class , pipeWaterproof , pipeItemsCobblestone ) ;
pipeFluidsStone = buildPipe ( PipeFluidsStone . class , pipeWaterproof , pipeItemsStone ) ;
pipeFluidsQuartz = buildPipe ( PipeFluidsQuartz . class , pipeWaterproof , pipeItemsQuartz ) ;
pipeFluidsIron = buildPipe ( PipeFluidsIron . class , pipeWaterproof , pipeItemsIron ) ;
pipeFluidsGold = buildPipe ( PipeFluidsGold . class , pipeWaterproof , pipeItemsGold ) ;
pipeFluidsEmerald = buildPipe ( PipeFluidsEmerald . class , pipeWaterproof , pipeItemsEmerald ) ;
pipeFluidsDiamond = buildPipe ( PipeFluidsDiamond . class , pipeWaterproof , pipeItemsDiamond ) ;
pipeFluidsSandstone = buildPipe ( PipeFluidsSandstone . class , pipeWaterproof , pipeItemsSandstone ) ;
pipeFluidsVoid = buildPipe ( PipeFluidsVoid . class , pipeWaterproof , pipeItemsVoid ) ;
pipeFluidsClay = buildPipe ( PipeFluidsClay . class , pipeWaterproof , pipeItemsClay ) ;
pipePowerWood = buildPipe ( PipePowerWood . class , " dustRedstone " , pipeItemsWood ) ;
pipePowerCobblestone = buildPipe ( PipePowerCobblestone . class , " dustRedstone " , pipeItemsCobblestone ) ;
pipePowerStone = buildPipe ( PipePowerStone . class , " dustRedstone " , pipeItemsStone ) ;
pipePowerQuartz = buildPipe ( PipePowerQuartz . class , " dustRedstone " , pipeItemsQuartz ) ;
pipePowerIron = buildPipe ( PipePowerIron . class , " dustRedstone " , pipeItemsIron ) ;
pipePowerGold = buildPipe ( PipePowerGold . class , " dustRedstone " , pipeItemsGold ) ;
pipePowerDiamond = buildPipe ( PipePowerDiamond . class , " dustRedstone " , pipeItemsDiamond ) ;
pipePowerEmerald = buildPipe ( PipePowerEmerald . class , " dustRedstone " , pipeItemsEmerald ) ;
2015-09-20 11:20:30 +02:00
pipePowerSandstone = buildPipe ( PipePowerSandstone . class , " dustRedstone " , pipeItemsSandstone ) ;
2015-07-17 16:39:11 +02:00
2015-09-20 11:20:30 +02:00
pipeStructureCobblestone = buildPipe ( PipeStructureCobblestone . class , Blocks . cobblestone , Blocks . gravel , Blocks . cobblestone ) ;
2013-06-12 17:52:44 +02:00
2014-02-08 14:47:31 +01:00
pipeWire = new ItemPipeWire ( ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( pipeWire , false ) ;
2014-01-02 13:58:08 +01:00
PipeWire . item = pipeWire ;
2013-01-03 13:55:14 +01:00
2014-02-08 14:47:31 +01:00
pipeGate = new ItemGate ( ) ;
2013-03-07 00:22:17 +01:00
pipeGate . setUnlocalizedName ( " pipeGate " ) ;
2022-06-17 11:36:20 +02:00
if ( Loader . isModLoaded ( " BuildCraft|Silicon " ) & & BCRegistry . INSTANCE . isItemEnabled ( pipeGate ) ) {
new BCCreativeTab ( " gates " ) ;
}
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( pipeGate , false ) ;
2013-01-03 13:55:14 +01:00
2014-02-08 14:47:31 +01:00
facadeItem = new ItemFacade ( ) ;
2013-03-07 00:22:17 +01:00
facadeItem . setUnlocalizedName ( " pipeFacade " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( facadeItem , false ) ;
2015-03-15 15:58:51 +01:00
FacadeAPI . facadeItem = facadeItem ;
2013-06-12 15:14:23 +02:00
2014-02-08 14:47:31 +01:00
plugItem = new ItemPlug ( ) ;
2013-05-07 19:02:25 +02:00
plugItem . setUnlocalizedName ( " pipePlug " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( plugItem , false ) ;
2013-07-05 19:50:50 +02:00
2014-12-17 16:19:03 +01:00
lensItem = new ItemLens ( ) ;
lensItem . setUnlocalizedName ( " pipeLens " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( lensItem , false ) ;
2014-12-17 16:19:03 +01:00
2015-07-17 16:39:11 +02:00
powerAdapterItem = new ItemPowerAdapter ( ) ;
powerAdapterItem . setUnlocalizedName ( " pipePowerAdapter " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( powerAdapterItem , false ) ;
2014-12-21 12:19:34 +01:00
2014-10-25 22:22:25 +02:00
gateCopier = new ItemGateCopier ( ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( gateCopier , false ) ;
2015-02-01 16:53:48 +01:00
2014-02-10 21:49:48 +01:00
for ( PipeContents kind : PipeContents . values ( ) ) {
triggerPipe [ kind . ordinal ( ) ] = new TriggerPipeContents ( kind ) ;
}
2014-02-16 12:14:30 +01:00
2014-02-10 21:49:48 +01:00
for ( PipeWire wire : PipeWire . values ( ) ) {
triggerPipeWireActive [ wire . ordinal ( ) ] = new TriggerPipeSignal ( true , wire ) ;
triggerPipeWireInactive [ wire . ordinal ( ) ] = new TriggerPipeSignal ( false , wire ) ;
actionPipeWire [ wire . ordinal ( ) ] = new ActionSignalOutput ( wire ) ;
}
for ( Time time : TriggerClockTimer . Time . VALUES ) {
triggerTimer [ time . ordinal ( ) ] = new TriggerClockTimer ( time ) ;
}
for ( int level = 0 ; level < triggerRedstoneLevel . length ; level + + ) {
triggerRedstoneLevel [ level ] = new TriggerRedstoneFaderInput ( level + 1 ) ;
actionRedstoneLevel [ level ] = new ActionRedstoneFaderOutput ( level + 1 ) ;
}
for ( EnumColor color : EnumColor . VALUES ) {
actionPipeColor [ color . ordinal ( ) ] = new ActionPipeColor ( color ) ;
}
for ( ForgeDirection direction : ForgeDirection . VALID_DIRECTIONS ) {
actionPipeDirection [ direction . ordinal ( ) ] = new ActionPipeDirection ( direction ) ;
}
2014-09-09 04:41:48 +02:00
for ( ValveState state : ValveState . VALUES ) {
2015-09-20 11:20:30 +02:00
actionValve [ state . ordinal ( ) ] = new ActionValve ( state ) ;
2014-09-09 04:41:48 +02:00
}
2014-02-10 21:49:48 +01:00
for ( PowerMode limit : PowerMode . VALUES ) {
actionPowerLimiter [ limit . ordinal ( ) ] = new ActionPowerLimiter ( limit ) ;
}
2015-03-15 15:58:51 +01:00
triggerLightSensorBright = new TriggerLightSensor ( true ) ;
triggerLightSensorDark = new TriggerLightSensor ( false ) ;
2012-12-17 23:30:54 +01:00
} finally {
2012-08-24 19:25:54 +02:00
BuildCraftCore . mainConfiguration . save ( ) ;
}
2015-03-04 15:49:21 +01:00
InterModComms . registerHandler ( new IMCHandlerTransport ( ) ) ;
2012-08-24 19:25:54 +02:00
}
2012-10-19 04:48:58 +02:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-07-24 10:23:23 +02:00
public void init ( FMLInitializationEvent evt ) {
2015-03-04 15:49:21 +01:00
transportChannelHandler = new ChannelHandler ( ) ;
2015-04-01 08:13:06 +02:00
MinecraftForge . EVENT_BUS . register ( this ) ;
2015-03-04 15:49:21 +01:00
transportChannelHandler . registerPacketType ( PacketFluidUpdate . class ) ;
transportChannelHandler . registerPacketType ( PacketPipeTransportItemStack . class ) ;
transportChannelHandler . registerPacketType ( PacketPipeTransportItemStackRequest . class ) ;
transportChannelHandler . registerPacketType ( PacketPipeTransportTraveler . class ) ;
transportChannelHandler . registerPacketType ( PacketPowerUpdate . class ) ;
2014-01-13 20:26:16 +01:00
channels = NetworkRegistry . INSTANCE . newChannel
2015-03-04 15:49:21 +01:00
( DefaultProps . NET_CHANNEL_NAME + " -TRANSPORT " , transportChannelHandler , new PacketHandlerTransport ( ) ) ;
2014-02-16 12:14:30 +01:00
2012-08-24 15:20:43 +02:00
TransportProxy . proxy . registerTileEntities ( ) ;
2012-05-09 22:43:05 +02:00
2014-10-26 12:27:51 +01:00
BuilderAPI . schematicRegistry . registerSchematicBlock ( genericPipeBlock , SchematicPipe . class ) ;
2015-10-02 13:05:09 +02:00
BuilderAPI . schematicRegistry . registerSchematicBlock ( filteredBufferBlock , SchematicTile . class ) ;
2012-05-09 22:43:05 +02:00
2015-07-14 00:37:07 +02:00
new BptPipeRotatable ( pipeItemsWood ) ;
new BptPipeRotatable ( pipeFluidsWood ) ;
new BptPipeRotatable ( pipeItemsIron ) ;
new BptPipeRotatable ( pipeFluidsIron ) ;
new BptPipeRotatable ( pipeItemsEmerald ) ;
new BptPipeRotatable ( pipeFluidsEmerald ) ;
2012-05-09 22:43:05 +02:00
2015-07-14 00:37:07 +02:00
new BptPipeRotatable ( pipeItemsDaizuli ) ;
new BptPipeRotatable ( pipeItemsEmzuli ) ;
2012-05-09 22:43:05 +02:00
2015-07-14 00:37:07 +02:00
for ( Item itemPipe : BlockGenericPipe . pipes . keySet ( ) ) {
2015-09-12 21:30:14 +02:00
Class < ? extends Pipe < ? > > klazz = BlockGenericPipe . pipes . get ( itemPipe ) ;
2015-07-14 00:37:07 +02:00
if ( IDiamondPipe . class . isAssignableFrom ( klazz ) ) {
new BptPipeFiltered ( itemPipe ) ;
}
}
2012-05-09 22:43:05 +02:00
2015-08-08 16:14:55 +02:00
PipeEventBus . registerGlobalHandler ( new LensFilterHandler ( ) ) ;
2022-06-17 11:36:20 +02:00
if ( BCCreativeTab . isPresent ( " pipes " ) ) {
BCCreativeTab . get ( " pipes " ) . setIcon ( new ItemStack ( BuildCraftTransport . pipeItemsDiamond , 1 ) ) ;
}
if ( BCCreativeTab . isPresent ( " facades " ) ) {
2015-09-26 16:40:37 +02:00
BCCreativeTab . get ( " facades " ) . setIcon ( facadeItem . getFacadeForBlock ( Blocks . brick_block , 0 ) ) ;
}
2022-06-17 11:36:20 +02:00
if ( BCCreativeTab . isPresent ( " gates " ) ) {
2015-05-05 05:53:12 +02:00
BCCreativeTab . get ( " gates " ) . setIcon ( ItemGate . makeGateItem ( GateMaterial . DIAMOND , GateLogic . AND ) ) ;
}
2015-03-04 22:44:44 +01:00
2014-10-28 07:22:43 +01:00
StatementManager . registerParameterClass ( TriggerParameterSignal . class ) ;
StatementManager . registerParameterClass ( ActionParameterSignal . class ) ;
2014-06-13 13:15:33 +02:00
StatementManager . registerTriggerProvider ( new PipeTriggerProvider ( ) ) ;
2014-10-19 21:04:02 +02:00
StatementManager . registerActionProvider ( new PipeActionProvider ( ) ) ;
2015-02-01 16:53:48 +01:00
2015-03-21 11:20:07 +01:00
// Item use stripes handlers
PipeManager . registerStripesHandler ( new StripesHandlerRightClick ( ) , - 32768 ) ;
PipeManager . registerStripesHandler ( new StripesHandlerDispenser ( ) , - 49152 ) ;
2015-05-07 19:37:48 +02:00
PipeManager . registerStripesHandler ( new StripesHandlerPlant ( ) , 0 ) ;
2015-03-20 17:03:32 +01:00
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 ) ;
2015-03-21 11:20:07 +01:00
PipeManager . registerStripesHandler ( new StripesHandlerPlaceBlock ( ) , - 65536 ) ;
PipeManager . registerStripesHandler ( new StripesHandlerUse ( ) , - 131072 ) ;
2015-03-20 17:03:32 +01:00
PipeManager . registerStripesHandler ( new StripesHandlerHoe ( ) , 0 ) ;
2014-12-15 19:10:12 +01:00
2015-03-21 11:20:07 +01:00
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 ) ;
2014-12-15 19:10:12 +01:00
PipeManager . registerPipePluggable ( FacadePluggable . class , " facade " ) ;
PipeManager . registerPipePluggable ( GatePluggable . class , " gate " ) ;
2014-12-17 16:19:03 +01:00
PipeManager . registerPipePluggable ( LensPluggable . class , " lens " ) ;
2014-12-15 19:10:12 +01:00
PipeManager . registerPipePluggable ( PlugPluggable . class , " plug " ) ;
2015-07-17 16:39:11 +02:00
PipeManager . registerPipePluggable ( PowerAdapterPluggable . class , " powerAdapter " ) ;
2015-03-15 15:58:51 +01:00
2015-04-25 12:51:33 +02:00
GateExpansions . registerExpansion ( GateExpansionPulsar . INSTANCE ) ;
GateExpansions . registerExpansion ( GateExpansionTimer . INSTANCE ) ;
GateExpansions . registerExpansion ( GateExpansionRedstoneFader . INSTANCE ) ;
2015-03-15 15:58:51 +01:00
GateExpansions . registerExpansion ( GateExpansionLightSensor . INSTANCE , new ItemStack ( Blocks . daylight_detector ) ) ;
2012-12-17 23:30:54 +01:00
if ( BuildCraftCore . loadDefaultRecipes ) {
2012-05-09 22:43:05 +02:00
loadRecipes ( ) ;
2012-08-24 19:25:54 +02:00
}
TransportProxy . proxy . registerRenderers ( ) ;
2015-03-04 22:44:44 +01:00
NetworkRegistry . INSTANCE . registerGuiHandler ( instance , new TransportGuiHandler ( ) ) ;
2012-05-09 22:43:05 +02:00
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2012-10-19 04:48:58 +02:00
public void postInit ( FMLPostInitializationEvent evt ) {
2014-10-19 12:21:45 +02:00
facadeItem . initialize ( ) ;
2015-02-01 16:53:48 +01:00
2014-10-30 12:47:55 +01:00
if ( debugPrintFacadeList ) {
try {
PrintWriter writer = new PrintWriter ( " FacadeDebug.txt " , " UTF-8 " ) ;
writer . println ( " *** REGISTERED FACADES *** " ) ;
2014-11-29 12:58:33 +01:00
for ( ItemStack stack : ItemFacade . allFacades ) {
2014-10-30 12:47:55 +01:00
if ( facadeItem . getBlocksForFacade ( stack ) . length > 0 ) {
2014-11-01 22:25:29 +01:00
writer . println ( Block . blockRegistry . getNameForObject ( facadeItem . getBlocksForFacade ( stack ) [ 0 ] ) + " : " + facadeItem . getMetaValuesForFacade ( stack ) [ 0 ] ) ;
2014-10-30 12:47:55 +01:00
}
}
writer . close ( ) ;
2014-11-01 09:42:53 +01:00
} catch ( Exception e ) {
2014-10-30 12:47:55 +01:00
e . printStackTrace ( ) ;
}
}
2015-06-29 10:46:47 +02:00
2015-08-07 13:23:47 +02:00
ListRegistry . itemClassAsType . add ( ItemPipe . class ) ;
ListRegistry . itemClassAsType . add ( ItemGate . class ) ;
ListRegistry . itemClassAsType . add ( ItemFacade . class ) ;
ListRegistry . itemClassAsType . add ( ItemPipeWire . class ) ;
2012-10-19 04:48:58 +02:00
}
2015-04-02 14:46:57 +02:00
public void reloadConfig ( ConfigManager . RestartRequirement restartType ) {
if ( restartType = = ConfigManager . RestartRequirement . GAME ) {
facadeTreatBlacklistAsWhitelist = BuildCraftCore . mainConfigManager . get ( " general.pipes.facadeBlacklistAsWhitelist " ) . getBoolean ( ) ;
facadeBlacklist = BuildCraftCore . mainConfigManager . get ( " general.pipes.facadeBlacklist " ) . getStringList ( ) ;
gateCostMultiplier = ( float ) BuildCraftCore . mainConfigManager . get ( " power.gateCostMultiplier " ) . getDouble ( ) ;
additionalWaterproofingRecipe = BuildCraftCore . mainConfigManager . get ( " general.pipes.slimeballWaterproofRecipe " ) . getBoolean ( ) ;
debugPrintFacadeList = BuildCraftCore . mainConfigManager . get ( " debug.printFacadeList " ) . getBoolean ( ) ;
pipeFluidsBaseFlowRate = BuildCraftCore . mainConfigManager . get ( " general.pipes.baseFluidRate " ) . getInt ( ) ;
2015-04-09 22:19:40 +02:00
facadeForceNonLaserRecipe = BuildCraftCore . mainConfigManager . get ( " general.pipes.facadeNoLaserRecipe " ) . getBoolean ( ) ;
2015-09-26 16:40:37 +02:00
showAllFacadesCreative = BuildCraftCore . mainConfigManager . get ( " general.pipes.facadeShowAllInCreative " ) . getBoolean ( ) ;
2015-04-02 14:46:57 +02:00
reloadConfig ( ConfigManager . RestartRequirement . WORLD ) ;
} else if ( restartType = = ConfigManager . RestartRequirement . WORLD ) {
2015-05-26 15:32:51 +02:00
usePipeLoss = BuildCraftCore . mainConfigManager . get ( " experimental.kinesisPowerLossOnTravel " ) . getBoolean ( ) ;
2015-04-02 14:46:57 +02:00
reloadConfig ( ConfigManager . RestartRequirement . NONE ) ;
} else {
pipeDurability = ( float ) BuildCraftCore . mainConfigManager . get ( " general.pipes.hardness " ) . getDouble ( ) ;
if ( BuildCraftCore . mainConfiguration . hasChanged ( ) ) {
BuildCraftCore . mainConfiguration . save ( ) ;
}
}
}
@SubscribeEvent
public void onConfigChanged ( ConfigChangedEvent . OnConfigChangedEvent event ) {
if ( " BuildCraft|Core " . equals ( event . modID ) ) {
reloadConfig ( event . isWorldRunning ? ConfigManager . RestartRequirement . NONE : ConfigManager . RestartRequirement . WORLD ) ;
}
}
2015-04-01 08:13:06 +02:00
@SubscribeEvent
@SideOnly ( Side . CLIENT )
public void textureHook ( TextureStitchEvent . Pre event ) {
if ( event . map . getTextureType ( ) = = 0 ) {
for ( Item i : BlockGenericPipe . pipes . keySet ( ) ) {
Pipe < ? > dummyPipe = BlockGenericPipe . createPipe ( i ) ;
if ( dummyPipe ! = null ) {
dummyPipe . getIconProvider ( ) . registerIcons ( event . map ) ;
}
}
wireIconProvider . registerIcons ( event . map ) ;
for ( GateDefinition . GateMaterial material : GateDefinition . GateMaterial . VALUES ) {
material . registerBlockIcon ( event . map ) ;
}
for ( GateDefinition . GateLogic logic : GateDefinition . GateLogic . VALUES ) {
logic . registerBlockIcon ( event . map ) ;
}
for ( IGateExpansion expansion : GateExpansions . getExpansions ( ) ) {
expansion . registerBlockOverlay ( event . map ) ;
}
2015-06-04 16:17:58 +02:00
PipeRendererTESR . INSTANCE . onTextureReload ( ) ;
2015-04-01 08:13:06 +02:00
}
}
2015-03-20 15:07:12 +01:00
@Mod.EventHandler
public void serverLoading ( FMLServerStartingEvent event ) {
pipeExtensionListener = new PipeExtensionListener ( ) ;
FMLCommonHandler . instance ( ) . bus ( ) . register ( pipeExtensionListener ) ;
}
@Mod.EventHandler
public void serverUnloading ( FMLServerStoppingEvent event ) {
// One last tick
for ( WorldServer w : DimensionManager . getWorlds ( ) ) {
pipeExtensionListener . tick ( new TickEvent . WorldTickEvent ( Side . SERVER , TickEvent . Phase . END , w ) ) ;
}
FMLCommonHandler . instance ( ) . bus ( ) . unregister ( pipeExtensionListener ) ;
pipeExtensionListener = null ;
}
2014-07-27 23:05:35 +02:00
public void loadRecipes ( ) {
2012-05-09 22:43:05 +02:00
// Add base recipe for pipe waterproof.
2014-02-08 14:47:31 +01:00
GameRegistry . addShapelessRecipe ( new ItemStack ( pipeWaterproof , 1 ) , new ItemStack ( Items . dye , 1 , 2 ) ) ;
2015-02-04 04:03:17 +01:00
if ( additionalWaterproofingRecipe ) {
2015-03-16 16:45:10 +01:00
GameRegistry . addShapelessRecipe ( new ItemStack ( pipeWaterproof , 1 ) , new ItemStack ( Items . slime_ball ) ) ;
2015-02-04 04:03:17 +01:00
}
2012-05-09 22:43:05 +02:00
// Add pipe recipes
2012-12-17 23:30:54 +01:00
for ( PipeRecipe pipe : pipeRecipes ) {
if ( pipe . isShapeless ) {
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addShapelessRecipe ( pipe . result , pipe . input ) ;
2012-12-17 23:30:54 +01:00
} else {
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( pipe . result , pipe . input ) ;
2012-08-24 19:25:54 +02:00
}
}
2013-06-29 19:03:36 +02:00
2014-10-26 16:32:13 +01:00
GameRegistry . addRecipe ( new PipeColoringRecipe ( ) ) ;
2015-01-31 00:42:54 +01:00
RecipeSorter . register ( " buildcraft:pipecoloring " , PipeColoringRecipe . class , RecipeSorter . Category . SHAPELESS , " after:minecraft:shapeless " ) ;
2015-09-20 11:20:30 +02:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( filteredBufferBlock , 1 ) ,
2014-04-14 18:27:59 +02:00
" wdw " , " wcw " , " wpw " , 'w' , " plankWood " , 'd' ,
2015-09-06 16:12:44 +02:00
BuildCraftTransport . pipeItemsDiamond , 'c' , " chestWood " , 'p' ,
2015-04-25 12:51:33 +02:00
Blocks . piston ) ;
2013-07-05 19:50:50 +02:00
//Facade turning helper
GameRegistry . addRecipe ( facadeItem . new FacadeRecipe ( ) ) ;
2014-02-23 00:41:46 +01:00
RecipeSorter . register ( " facadeTurningHelper " , ItemFacade . FacadeRecipe . class , RecipeSorter . Category . SHAPELESS , " " ) ;
2013-11-17 02:19:54 +01:00
2015-04-09 18:48:07 +02:00
// Pipe Plug
2015-04-09 22:19:40 +02:00
GameRegistry . addShapelessRecipe ( new ItemStack ( plugItem , 4 ) , new ItemStack ( pipeStructureCobblestone ) ) ;
2015-07-17 17:04:27 +02:00
GameRegistry . addRecipe ( new ShapedOreRecipe ( new ItemStack ( powerAdapterItem , 4 ) , " scs " , " sbs " , " sas " , 's' , pipeStructureCobblestone , 'a' , Items . redstone , 'b' , " gearStone " , 'c' , " ingotGold " ) ) ;
2015-04-09 18:48:07 +02:00
2014-10-19 14:36:27 +02:00
if ( Loader . isModLoaded ( " BuildCraft|Silicon " ) ) {
2015-04-25 12:51:33 +02:00
TransportSiliconRecipes . loadSiliconRecipes ( ) ;
2015-03-05 16:36:04 +01:00
} else {
BCLog . logger . warn ( " ********************************************** " ) ;
BCLog . logger . warn ( " * You are using the BuildCraft Transport * " ) ;
2015-07-17 16:39:11 +02:00
BCLog . logger . warn ( " * module WITHOUT the Silicon module. Gates * " ) ;
BCLog . logger . warn ( " * will not be available. * " ) ;
2015-03-05 16:36:04 +01:00
BCLog . logger . warn ( " ********************************************** " ) ;
// Alternate recipes
// Lenses, Filters
2014-12-17 16:36:03 +01:00
for ( int i = 0 ; i < 16 ; i + + ) {
2015-03-05 16:36:04 +01:00
String dye = ColorUtils . getOreDictionaryName ( 15 - i ) ;
GameRegistry . addRecipe ( new ShapedOreRecipe ( new ItemStack ( lensItem , 8 , i ) ,
" OSO " , " SGS " , " OSO " ,
'O' , " ingotIron " , 'S' , dye , 'G' , " blockGlass "
2015-09-20 11:20:30 +02:00
) ) ;
2015-03-05 16:36:04 +01:00
GameRegistry . addRecipe ( new ShapedOreRecipe ( new ItemStack ( lensItem , 8 , i + 16 ) ,
" OSO " , " SGS " , " OSO " ,
'O' , Blocks . iron_bars , 'S' , dye , 'G' , " blockGlass "
) ) ;
2014-12-17 16:36:03 +01:00
}
2015-03-05 16:36:04 +01:00
}
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-09-12 15:27:11 +02:00
public void processIMCRequests ( IMCEvent event ) {
2013-11-19 14:26:30 +01:00
InterModComms . processIMC ( event ) ;
2012-10-25 03:57:31 +02:00
}
2015-09-12 21:30:14 +02:00
public static Item buildPipe ( Class < ? extends Pipe < ? > > clas , Object . . . ingredients ) {
2015-07-17 16:39:11 +02:00
return buildPipe ( clas , BCCreativeTab . get ( " pipes " ) , ingredients ) ;
}
@Deprecated
2015-09-12 21:30:14 +02:00
public static Item buildPipe ( Class < ? extends Pipe < ? > > clas ,
2015-07-17 16:39:11 +02:00
String descr , BCCreativeTab creativeTab ,
Object . . . ingredients ) {
return buildPipe ( clas , creativeTab , ingredients ) ;
}
2015-09-12 21:30:14 +02:00
public static Item buildPipe ( Class < ? extends Pipe < ? > > clas , BCCreativeTab creativeTab ,
2015-09-20 11:20:30 +02:00
Object . . . ingredients ) {
2015-09-29 09:54:12 +02:00
if ( ! BCRegistry . INSTANCE . isEnabled ( " pipes " , clas . getSimpleName ( ) ) ) {
return null ;
}
2014-02-16 17:21:22 +01:00
ItemPipe res = BlockGenericPipe . registerPipe ( clas , creativeTab ) ;
2013-03-07 00:22:17 +01:00
res . setUnlocalizedName ( clas . getSimpleName ( ) ) ;
2015-02-01 16:53:48 +01:00
2015-09-29 09:54:12 +02:00
for ( Object o : ingredients ) {
if ( o = = null ) {
return res ;
}
}
2014-10-25 17:34:45 +02:00
// Add appropriate recipes to temporary list
2013-06-12 15:14:23 +02:00
if ( ingredients . length = = 3 ) {
2014-10-25 17:34:45 +02:00
for ( int i = 0 ; i < 17 ; i + + ) {
PipeRecipe recipe = new PipeRecipe ( ) ;
2015-05-28 07:15:10 +02:00
Object glass ;
2015-02-01 16:53:48 +01:00
2014-10-25 17:34:45 +02:00
if ( i = = 0 ) {
2015-05-28 07:15:10 +02:00
glass = ingredients [ 1 ] ;
2014-10-25 17:34:45 +02:00
} else {
2015-10-16 09:39:50 +02:00
glass = " blockGlass " + EnumColor . fromId ( 15 - ( i - 1 ) ) . getName ( ) ;
2014-10-25 17:34:45 +02:00
}
2015-02-01 16:53:48 +01:00
2014-10-25 17:34:45 +02:00
recipe . result = new ItemStack ( res , 8 , i ) ;
recipe . input = new Object [ ] { " ABC " , 'A' , ingredients [ 0 ] , 'B' , glass , 'C' , ingredients [ 2 ] } ;
2012-05-09 22:43:05 +02:00
2014-10-25 17:34:45 +02:00
pipeRecipes . add ( recipe ) ;
}
2013-06-12 15:14:23 +02:00
} else if ( ingredients . length = = 2 ) {
2014-10-25 17:34:45 +02:00
for ( int i = 0 ; i < 17 ; i + + ) {
PipeRecipe recipe = new PipeRecipe ( ) ;
2015-02-01 16:53:48 +01:00
2014-10-25 17:34:45 +02:00
Object left = ingredients [ 0 ] ;
Object right = ingredients [ 1 ] ;
if ( ingredients [ 1 ] instanceof ItemPipe ) {
right = new ItemStack ( ( Item ) right , 1 , i ) ;
}
2015-02-01 16:53:48 +01:00
2014-10-25 17:34:45 +02:00
recipe . isShapeless = true ;
recipe . result = new ItemStack ( res , 1 , i ) ;
recipe . input = new Object [ ] { left , right } ;
pipeRecipes . add ( recipe ) ;
2015-02-01 16:53:48 +01:00
2015-09-28 11:01:12 +02:00
if ( ingredients [ 1 ] instanceof ItemPipe & & clas ! = PipeStructureCobblestone . class ) {
2014-10-25 17:34:45 +02:00
PipeRecipe uncraft = new PipeRecipe ( ) ;
uncraft . isShapeless = true ;
uncraft . input = new Object [ ] { recipe . result } ;
uncraft . result = ( ItemStack ) right ;
pipeRecipes . add ( uncraft ) ;
}
2013-06-12 15:14:23 +02:00
}
2012-05-09 22:43:05 +02:00
}
return res ;
}
2014-02-09 18:02:44 +01:00
2014-05-08 21:57:05 +02:00
@Mod.EventHandler
public void whiteListAppliedEnergetics ( FMLInitializationEvent event ) {
FMLInterModComms . sendMessage ( " appliedenergistics2 " , " whitelist-spatial " ,
TileGenericPipe . class . getCanonicalName ( ) ) ;
FMLInterModComms . sendMessage ( " appliedenergistics2 " , " whitelist-spatial " ,
TileFilteredBuffer . class . getCanonicalName ( ) ) ;
}
2015-03-05 16:36:04 +01:00
@Mod.EventHandler
public void remap ( FMLMissingMappingsEvent event ) {
for ( FMLMissingMappingsEvent . MissingMapping mapping : event . get ( ) ) {
if ( mapping . type = = GameRegistry . Type . ITEM ) {
if ( mapping . name . equals ( " BuildCraft|Transport:robotStation " ) ) {
mapping . remap ( ( Item ) Item . itemRegistry . getObject ( " BuildCraft|Robotics:robotStation " ) ) ;
}
}
}
}
2012-05-09 22:43:05 +02:00
}