2012-07-25 12:45:15 +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-07-25 12:45:15 +02:00
* /
package buildcraft ;
2013-08-31 19:01:31 +02:00
import java.io.File ;
2014-07-04 22:30:19 +02:00
import java.util.UUID ;
2015-05-07 19:15:17 +02:00
2014-05-13 20:32:14 +02:00
import com.mojang.authlib.GameProfile ;
2015-05-07 19:49:53 +02:00
2013-08-31 19:01:31 +02:00
import net.minecraft.block.Block ;
2014-03-10 17:43:12 +01:00
import net.minecraft.block.BlockLiquid ;
2013-08-31 19:01:31 +02:00
import net.minecraft.entity.EntityList ;
2014-02-08 14:47:31 +01:00
import net.minecraft.init.Blocks ;
import net.minecraft.init.Items ;
2013-08-31 19:01:31 +02:00
import net.minecraft.item.Item ;
2015-06-28 20:20:38 +02:00
import net.minecraft.item.ItemFood ;
2013-08-31 19:01:31 +02:00
import net.minecraft.item.ItemStack ;
2014-03-12 14:10:46 +01:00
import net.minecraft.stats.Achievement ;
2014-01-12 23:05:36 +01:00
import net.minecraft.util.IIcon ;
2015-09-20 11:20:30 +02:00
2015-04-02 14:46:57 +02:00
import cpw.mods.fml.client.event.ConfigChangedEvent ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.FMLCommonHandler ;
2015-06-05 21:47:30 +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 ;
import cpw.mods.fml.common.event.FMLInterModComms ;
import cpw.mods.fml.common.event.FMLPostInitializationEvent ;
import cpw.mods.fml.common.event.FMLPreInitializationEvent ;
import cpw.mods.fml.common.event.FMLServerStartingEvent ;
2015-04-09 18:48:07 +02:00
import cpw.mods.fml.common.event.FMLServerStoppingEvent ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.eventhandler.SubscribeEvent ;
import cpw.mods.fml.common.network.NetworkRegistry ;
import cpw.mods.fml.relauncher.Side ;
import cpw.mods.fml.relauncher.SideOnly ;
2013-08-31 19:01:31 +02:00
import net.minecraftforge.client.event.TextureStitchEvent ;
import net.minecraftforge.common.IPlantable ;
import net.minecraftforge.common.MinecraftForge ;
2014-06-10 17:10:07 +02:00
import net.minecraftforge.event.world.WorldEvent ;
2014-02-08 16:04:03 +01:00
import net.minecraftforge.fluids.BlockFluidBase ;
2014-02-16 17:21:22 +01:00
import net.minecraftforge.oredict.OreDictionary ;
2015-05-07 19:49:53 +02:00
2014-10-26 12:27:51 +01:00
import buildcraft.api.blueprints.BuilderAPI ;
2014-04-27 11:03:18 +02:00
import buildcraft.api.core.BCLog ;
2012-07-25 12:45:15 +02:00
import buildcraft.api.core.BuildCraftAPI ;
2014-07-20 23:41:43 +02:00
import buildcraft.api.core.EnumColor ;
2013-03-16 09:21:48 +01:00
import buildcraft.api.core.IIconProvider ;
2014-10-27 12:16:15 +01:00
import buildcraft.api.core.IWorldProperty ;
2015-05-25 17:41:52 +02:00
import buildcraft.api.crops.CropManager ;
2015-06-14 14:13:17 +02:00
import buildcraft.api.filler.FillerManager ;
import buildcraft.api.filler.IFillerPattern ;
2015-08-07 19:20:20 +02:00
import buildcraft.api.lists.ListRegistry ;
2014-06-02 16:29:13 +02:00
import buildcraft.api.recipes.BuildcraftRecipeRegistry ;
2014-10-28 16:36:06 +01:00
import buildcraft.api.statements.IActionExternal ;
import buildcraft.api.statements.IActionInternal ;
import buildcraft.api.statements.IStatement ;
import buildcraft.api.statements.ITriggerExternal ;
import buildcraft.api.statements.ITriggerInternal ;
import buildcraft.api.statements.StatementManager ;
import buildcraft.api.statements.StatementParameterItemStack ;
2015-04-09 18:48:07 +02:00
import buildcraft.api.tablet.TabletAPI ;
2014-10-28 20:15:30 +01:00
import buildcraft.api.tiles.IControllable ;
2015-03-03 21:47:33 +01:00
import buildcraft.core.AchievementManager ;
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-20 10:47:52 +01:00
import buildcraft.core.BlockBuildTool ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.BlockEngine ;
2015-06-30 19:01:44 +02:00
import buildcraft.core.BlockMarker ;
import buildcraft.core.BlockPathMarker ;
2013-01-16 16:18:21 +01:00
import buildcraft.core.BlockSpring ;
2015-03-06 16:45:05 +01:00
import buildcraft.core.CompatHooks ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.CoreGuiHandler ;
2013-03-23 09:40:22 +01:00
import buildcraft.core.CoreIconProvider ;
2015-06-05 21:47:30 +02:00
import buildcraft.core.CoreSiliconRecipes ;
2012-07-25 12:45:15 +02:00
import buildcraft.core.DefaultProps ;
2013-09-12 15:27:11 +02:00
import buildcraft.core.InterModComms ;
2015-03-07 11:00:00 +01:00
import buildcraft.core.ItemDebugger ;
2014-07-27 23:05:35 +02:00
import buildcraft.core.ItemGear ;
2014-08-29 00:03:05 +02:00
import buildcraft.core.ItemList ;
2014-06-15 03:28:35 +02:00
import buildcraft.core.ItemMapLocation ;
2015-03-14 17:03:20 +01:00
import buildcraft.core.ItemPaintbrush ;
2013-05-01 22:31:18 +02:00
import buildcraft.core.ItemSpring ;
2012-07-25 12:45:15 +02:00
import buildcraft.core.ItemWrench ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.SchematicEngine ;
2013-01-16 16:18:21 +01:00
import buildcraft.core.SpringPopulate ;
2014-07-27 23:05:35 +02:00
import buildcraft.core.TickHandlerCore ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.TileEngineWood ;
2015-06-30 19:01:44 +02:00
import buildcraft.core.TilePathMarker ;
2012-09-08 21:46:17 +02:00
import buildcraft.core.Version ;
2015-10-06 18:55:38 +02:00
import buildcraft.core.blueprints.BuildingSlotMapIterator ;
2015-10-02 13:05:09 +02:00
import buildcraft.core.blueprints.SchematicHelper ;
2014-10-26 12:27:51 +01:00
import buildcraft.core.blueprints.SchematicRegistry ;
2015-06-15 13:04:08 +02:00
import buildcraft.core.builders.patterns.FillerPattern ;
2015-06-14 14:13:17 +02:00
import buildcraft.core.builders.patterns.FillerRegistry ;
import buildcraft.core.builders.patterns.PatternBox ;
import buildcraft.core.builders.patterns.PatternClear ;
import buildcraft.core.builders.patterns.PatternCylinder ;
import buildcraft.core.builders.patterns.PatternFill ;
import buildcraft.core.builders.patterns.PatternFlatten ;
import buildcraft.core.builders.patterns.PatternFrame ;
import buildcraft.core.builders.patterns.PatternHorizon ;
2015-06-14 14:58:09 +02:00
import buildcraft.core.builders.patterns.PatternParameterCenter ;
2015-06-15 13:04:08 +02:00
import buildcraft.core.builders.patterns.PatternParameterHollow ;
2015-06-14 14:13:17 +02:00
import buildcraft.core.builders.patterns.PatternParameterXZDir ;
import buildcraft.core.builders.patterns.PatternParameterYDir ;
import buildcraft.core.builders.patterns.PatternPyramid ;
import buildcraft.core.builders.patterns.PatternStairs ;
2015-06-30 19:01:44 +02:00
import buildcraft.core.builders.schematics.SchematicIgnore ;
2015-05-07 19:49:53 +02:00
import buildcraft.core.command.SubCommandChangelog ;
2015-09-30 16:17:54 +02:00
import buildcraft.core.command.SubCommandDeop ;
import buildcraft.core.command.SubCommandOp ;
2015-05-07 19:49:53 +02:00
import buildcraft.core.command.SubCommandVersion ;
2015-04-03 13:16:22 +02:00
import buildcraft.core.config.BuildCraftConfiguration ;
2015-04-02 14:46:57 +02:00
import buildcraft.core.config.ConfigManager ;
2015-05-25 17:41:52 +02:00
import buildcraft.core.crops.CropHandlerPlantable ;
import buildcraft.core.crops.CropHandlerReeds ;
2015-05-07 19:49:53 +02:00
import buildcraft.core.lib.commands.RootCommand ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.lib.engines.ItemEngine ;
2015-03-06 16:45:05 +01:00
import buildcraft.core.lib.engines.TileEngineBase ;
import buildcraft.core.lib.network.ChannelHandler ;
2015-09-04 14:45:29 +02:00
import buildcraft.core.lib.render.FluidRenderer ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.lib.utils.ColorUtils ;
2015-03-14 17:03:20 +01:00
import buildcraft.core.lib.utils.NBTUtils ;
2015-05-07 10:48:00 +02:00
import buildcraft.core.lib.utils.Utils ;
2015-05-05 09:51:42 +02:00
import buildcraft.core.lib.utils.XorShift128Random ;
2015-08-07 19:20:20 +02:00
import buildcraft.core.list.ListMatchHandlerArmor ;
2015-06-28 20:20:38 +02:00
import buildcraft.core.list.ListMatchHandlerClass ;
2015-06-29 10:46:47 +02:00
import buildcraft.core.list.ListMatchHandlerFluid ;
2015-06-28 20:20:38 +02:00
import buildcraft.core.list.ListMatchHandlerOreDictionary ;
2015-08-07 13:23:47 +02:00
import buildcraft.core.list.ListMatchHandlerTools ;
2015-08-03 18:33:57 +02:00
import buildcraft.core.list.ListOreDictionaryCache ;
2015-07-19 11:52:40 +02:00
import buildcraft.core.list.ListTooltipHandler ;
2015-04-18 10:23:41 +02:00
import buildcraft.core.network.PacketHandlerCore ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.properties.WorldPropertyIsDirt ;
import buildcraft.core.properties.WorldPropertyIsFarmland ;
import buildcraft.core.properties.WorldPropertyIsFluidSource ;
import buildcraft.core.properties.WorldPropertyIsHarvestable ;
import buildcraft.core.properties.WorldPropertyIsLeaf ;
import buildcraft.core.properties.WorldPropertyIsOre ;
2015-09-11 20:20:49 +02:00
import buildcraft.core.properties.WorldPropertyIsReplaceable ;
2015-03-31 23:21:00 +02:00
import buildcraft.core.properties.WorldPropertyIsShoveled ;
import buildcraft.core.properties.WorldPropertyIsSoft ;
import buildcraft.core.properties.WorldPropertyIsWood ;
2012-09-05 22:29:38 +02:00
import buildcraft.core.proxy.CoreProxy ;
2014-02-16 17:21:22 +01:00
import buildcraft.core.recipes.AssemblyRecipeManager ;
import buildcraft.core.recipes.IntegrationRecipeManager ;
2015-02-24 14:39:23 +01:00
import buildcraft.core.recipes.ProgrammingRecipeManager ;
2014-02-16 17:21:22 +01:00
import buildcraft.core.recipes.RefineryRecipeManager ;
2014-04-10 22:23:25 +02:00
import buildcraft.core.render.BlockHighlightHandler ;
2015-06-04 16:01:26 +02:00
import buildcraft.core.render.RenderLEDTile ;
2015-09-04 14:45:29 +02:00
import buildcraft.core.render.RenderLaser ;
2014-10-26 13:20:08 +01:00
import buildcraft.core.statements.ActionMachineControl ;
import buildcraft.core.statements.ActionRedstoneOutput ;
import buildcraft.core.statements.DefaultActionProvider ;
import buildcraft.core.statements.DefaultTriggerProvider ;
import buildcraft.core.statements.StatementParameterDirection ;
2015-07-24 01:01:26 +02:00
import buildcraft.core.statements.StatementParameterItemStackExact ;
2014-10-26 17:56:18 +01:00
import buildcraft.core.statements.StatementParameterRedstoneGateSideOnly ;
2014-10-26 13:20:08 +01:00
import buildcraft.core.statements.TriggerEnergy ;
import buildcraft.core.statements.TriggerFluidContainer ;
import buildcraft.core.statements.TriggerFluidContainerLevel ;
import buildcraft.core.statements.TriggerInventory ;
import buildcraft.core.statements.TriggerInventoryLevel ;
import buildcraft.core.statements.TriggerMachine ;
import buildcraft.core.statements.TriggerRedstoneInput ;
2015-04-18 10:23:41 +02:00
import buildcraft.core.tablet.ItemTablet ;
2015-04-09 18:48:07 +02:00
import buildcraft.core.tablet.PacketTabletMessage ;
import buildcraft.core.tablet.TabletProgramMenuFactory ;
import buildcraft.core.tablet.manager.TabletManagerClient ;
import buildcraft.core.tablet.manager.TabletManagerServer ;
2012-07-25 12:45:15 +02:00
2015-04-02 14:46:57 +02:00
@Mod ( name = " BuildCraft " , version = Version . VERSION , useMetadata = false , modid = " BuildCraft|Core " , acceptedMinecraftVersions = " [1.7.10,1.8) " , dependencies = " required-after:Forge@[10.13.2.1236,) " , guiFactory = " buildcraft.core.config.ConfigManager " )
2014-01-13 20:26:16 +01:00
public class BuildCraftCore extends BuildCraftMod {
2014-07-28 23:51:50 +02:00
@Mod.Instance ( " BuildCraft|Core " )
public static BuildCraftCore instance ;
2015-09-19 12:59:05 +02:00
public static final boolean DEVELOPER_MODE = false ;
2014-03-05 20:51:37 +01:00
2015-05-23 13:12:48 +02:00
public enum RenderMode {
2012-07-25 12:45:15 +02:00
Full , NoDynamic
2014-04-14 18:27:59 +02:00
}
2015-03-31 23:21:00 +02:00
2015-05-07 19:15:17 +02:00
public static RootCommand commandBuildcraft = new RootCommand ( " buildcraft " ) ;
2015-05-05 09:51:42 +02:00
public static XorShift128Random random = new XorShift128Random ( ) ;
2012-07-25 12:45:15 +02:00
public static RenderMode render = RenderMode . Full ;
2014-10-30 12:47:55 +01:00
public static boolean debugWorldgen = false ;
2012-07-25 12:45:15 +02:00
public static boolean modifyWorld = false ;
2013-08-31 19:01:31 +02:00
public static boolean colorBlindMode = false ;
2015-01-17 07:30:51 +01:00
public static boolean hidePowerNumbers = false ;
public static boolean hideFluidNumbers = false ;
2015-03-20 10:47:52 +01:00
public static boolean canEnginesExplode = false ;
2015-10-12 17:11:26 +02:00
public static boolean useServerDataOnClient = true ;
2022-06-17 11:12:38 +02:00
public static boolean alphaPassBugPresent = true ;
2012-11-17 11:44:23 +01:00
public static int itemLifespan = 1200 ;
2012-07-25 12:45:15 +02:00
public static int updateFactor = 10 ;
2015-10-06 16:12:16 +02:00
public static int builderMaxPerItemFactor = 1024 ;
2012-12-15 09:47:42 +01:00
public static long longUpdateFactor = 40 ;
2012-07-25 12:45:15 +02:00
public static BuildCraftConfiguration mainConfiguration ;
2015-04-02 14:46:57 +02:00
public static ConfigManager mainConfigManager ;
2014-02-16 17:21:22 +01:00
2015-03-06 16:45:05 +01:00
public static BlockEngine engineBlock ;
2015-06-30 19:01:44 +02:00
public static BlockMarker markerBlock ;
public static BlockPathMarker pathMarkerBlock ;
2013-01-16 16:18:21 +01:00
public static Block springBlock ;
2015-03-20 10:47:52 +01:00
public static BlockBuildTool buildToolBlock ;
2012-07-25 12:45:15 +02:00
public static Item woodenGearItem ;
public static Item stoneGearItem ;
public static Item ironGearItem ;
public static Item goldGearItem ;
public static Item diamondGearItem ;
public static Item wrenchItem ;
2014-06-15 03:28:35 +02:00
public static Item mapLocationItem ;
2015-03-07 11:00:00 +01:00
public static Item debuggerItem ;
2015-03-14 17:03:20 +01:00
public static Item paintbrushItem ;
2015-02-28 09:38:31 +01:00
public static ItemList listItem ;
2015-04-09 18:48:07 +02:00
public static ItemTablet tabletItem ;
2013-03-07 06:31:35 +01:00
@SideOnly ( Side . CLIENT )
2014-01-12 23:05:36 +01:00
public static IIcon redLaserTexture ;
2013-11-18 16:06:38 +01:00
@SideOnly ( Side . CLIENT )
2014-01-12 23:05:36 +01:00
public static IIcon blueLaserTexture ;
2013-11-18 16:06:38 +01:00
@SideOnly ( Side . CLIENT )
2014-01-12 23:05:36 +01:00
public static IIcon stripesLaserTexture ;
2013-11-18 16:06:38 +01:00
@SideOnly ( Side . CLIENT )
2014-01-12 23:05:36 +01:00
public static IIcon transparentTexture ;
2013-11-18 16:06:38 +01:00
@SideOnly ( Side . CLIENT )
public static IIconProvider iconProvider ;
2012-07-25 12:45:15 +02:00
public static int blockByEntityModel ;
2015-03-13 09:27:06 +01:00
public static int complexBlockModel ;
2012-07-25 12:45:15 +02:00
public static int markerModel ;
2014-10-28 16:36:06 +01:00
public static ITriggerExternal triggerMachineActive = new TriggerMachine ( true ) ;
public static ITriggerExternal triggerMachineInactive = new TriggerMachine ( false ) ;
2015-03-18 09:19:47 +01:00
public static IStatement triggerEnergyHigh = new TriggerEnergy ( true ) ;
public static IStatement triggerEnergyLow = new TriggerEnergy ( false ) ;
2014-10-28 16:36:06 +01:00
public static ITriggerExternal triggerEmptyInventory = new TriggerInventory ( TriggerInventory . State . Empty ) ;
public static ITriggerExternal triggerContainsInventory = new TriggerInventory ( TriggerInventory . State . Contains ) ;
public static ITriggerExternal triggerSpaceInventory = new TriggerInventory ( TriggerInventory . State . Space ) ;
public static ITriggerExternal triggerFullInventory = new TriggerInventory ( TriggerInventory . State . Full ) ;
public static ITriggerExternal triggerEmptyFluid = new TriggerFluidContainer ( TriggerFluidContainer . State . Empty ) ;
public static ITriggerExternal triggerContainsFluid = new TriggerFluidContainer ( TriggerFluidContainer . State . Contains ) ;
public static ITriggerExternal triggerSpaceFluid = new TriggerFluidContainer ( TriggerFluidContainer . State . Space ) ;
public static ITriggerExternal triggerFullFluid = new TriggerFluidContainer ( TriggerFluidContainer . State . Full ) ;
public static ITriggerInternal triggerRedstoneActive = new TriggerRedstoneInput ( true ) ;
public static ITriggerInternal triggerRedstoneInactive = new TriggerRedstoneInput ( false ) ;
2014-11-01 07:47:52 +01:00
public static ITriggerExternal triggerInventoryBelow25 = new TriggerInventoryLevel ( TriggerInventoryLevel . TriggerType . BELOW25 ) ;
public static ITriggerExternal triggerInventoryBelow50 = new TriggerInventoryLevel ( TriggerInventoryLevel . TriggerType . BELOW50 ) ;
public static ITriggerExternal triggerInventoryBelow75 = new TriggerInventoryLevel ( TriggerInventoryLevel . TriggerType . BELOW75 ) ;
public static ITriggerExternal triggerFluidContainerBelow25 = new TriggerFluidContainerLevel ( TriggerFluidContainerLevel . TriggerType . BELOW25 ) ;
public static ITriggerExternal triggerFluidContainerBelow50 = new TriggerFluidContainerLevel ( TriggerFluidContainerLevel . TriggerType . BELOW50 ) ;
public static ITriggerExternal triggerFluidContainerBelow75 = new TriggerFluidContainerLevel ( TriggerFluidContainerLevel . TriggerType . BELOW75 ) ;
2014-10-28 16:36:06 +01:00
public static IActionInternal actionRedstone = new ActionRedstoneOutput ( ) ;
2014-10-28 20:15:30 +01:00
public static IActionExternal [ ] actionControl ;
2015-09-20 11:20:30 +02:00
2012-07-25 12:45:15 +02:00
public static boolean loadDefaultRecipes = true ;
2013-08-09 10:36:01 +02:00
public static boolean consumeWaterSources = false ;
2015-09-30 16:17:54 +02:00
public static boolean miningAllowPlayerProtectedBlocks = false ;
2015-03-04 15:49:21 +01:00
public static float miningMultiplier ;
2014-07-27 23:05:35 +02:00
2015-03-03 21:47:33 +01:00
public static AchievementManager achievementManager ;
2014-03-12 14:10:46 +01:00
public static Achievement woodenGearAchievement ;
public static Achievement stoneGearAchievement ;
public static Achievement ironGearAchievement ;
public static Achievement goldGearAchievement ;
public static Achievement diamondGearAchievement ;
2014-03-12 15:58:00 +01:00
public static Achievement wrenchAchievement ;
2015-03-06 16:45:05 +01:00
public static Achievement engineRedstoneAchievement ;
2014-03-15 23:57:59 +01:00
2014-07-04 22:30:19 +02:00
public static GameProfile gameProfile = new GameProfile ( UUID . nameUUIDFromBytes ( " buildcraft.core " . getBytes ( ) ) , " [BuildCraft] " ) ;
2014-05-13 20:32:14 +02:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2012-08-24 19:25:54 +02:00
public void loadConfiguration ( FMLPreInitializationEvent evt ) {
2015-07-17 16:39:11 +02:00
BCLog . logger . info ( " Starting BuildCraft " + Version . getVersion ( ) ) ;
2017-11-10 19:30:16 +01:00
BCLog . logger . info ( " Copyright (c) the BuildCraft team, 2011-2017 " ) ;
2015-07-17 16:39:11 +02:00
BCLog . logger . info ( " http://www.mod-buildcraft.com " ) ;
2013-11-18 16:06:38 +01:00
2015-05-07 19:15:17 +02:00
commandBuildcraft . addAlias ( " bc " ) ;
commandBuildcraft . addChildCommand ( new SubCommandVersion ( ) ) ;
2015-05-07 19:26:13 +02:00
commandBuildcraft . addChildCommand ( new SubCommandChangelog ( ) ) ;
2015-09-30 16:17:54 +02:00
commandBuildcraft . addChildCommand ( new SubCommandDeop ( ) ) ;
commandBuildcraft . addChildCommand ( new SubCommandOp ( ) ) ;
2015-05-07 19:15:17 +02:00
2014-06-02 16:29:13 +02:00
BuildcraftRecipeRegistry . assemblyTable = AssemblyRecipeManager . INSTANCE ;
BuildcraftRecipeRegistry . integrationTable = IntegrationRecipeManager . INSTANCE ;
BuildcraftRecipeRegistry . refinery = RefineryRecipeManager . INSTANCE ;
2015-02-24 14:39:23 +01:00
BuildcraftRecipeRegistry . programmingTable = ProgrammingRecipeManager . INSTANCE ;
2013-12-02 06:57:31 +01:00
2015-10-02 13:05:09 +02:00
BuilderAPI . schematicHelper = SchematicHelper . INSTANCE ;
2014-10-26 12:27:51 +01:00
BuilderAPI . schematicRegistry = SchematicRegistry . INSTANCE ;
2015-06-30 19:01:44 +02:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . setRegistryConfig ( new File ( evt . getModConfigurationDirectory ( ) , " buildcraft/objects.cfg " ) ) ;
2015-04-02 14:46:57 +02:00
mainConfiguration = new BuildCraftConfiguration ( new File ( evt . getModConfigurationDirectory ( ) , " buildcraft/main.cfg " ) ) ;
mainConfigManager = new ConfigManager ( mainConfiguration ) ;
2015-06-28 22:28:47 +02:00
mainConfiguration . load ( ) ;
mainConfigManager . getCat ( " debug " ) . setShowInGui ( false ) ;
mainConfigManager . getCat ( " vars " ) . setShowInGui ( false ) ;
2015-10-12 17:11:26 +02:00
mainConfigManager . register ( " general.useServerDataOnClient " , BuildCraftCore . useServerDataOnClient , " Allows BuildCraft to use the integrated server's data on the client on singleplayer worlds. Disable if you're getting the odd crash caused by it. " , ConfigManager . RestartRequirement . NONE ) ;
2015-10-06 16:12:16 +02:00
mainConfigManager . register ( " general.builderMaxIterationsPerItemFactor " , BuildCraftCore . builderMaxPerItemFactor , " Lower this number if BuildCraft builders/fillers are causing TPS lag. Raise it if you think they are being too slow. " , ConfigManager . RestartRequirement . NONE ) ;
2015-09-30 16:17:54 +02:00
mainConfigManager . register ( " general.miningBreaksPlayerProtectedBlocks " , false , " Should BuildCraft miners be allowed to break blocks using player-specific protection? " , ConfigManager . RestartRequirement . NONE ) ;
2015-06-28 22:28:47 +02:00
mainConfigManager . register ( " general.updateCheck " , true , " Should I check the BuildCraft version on startup? " , ConfigManager . RestartRequirement . NONE ) ;
mainConfigManager . register ( " display.hidePowerValues " , false , " Should all power values (RF, RF/t) be hidden? " , ConfigManager . RestartRequirement . NONE ) ;
mainConfigManager . register ( " display.hideFluidValues " , false , " Should all fluid values (mB, mB/t) be hidden? " , ConfigManager . RestartRequirement . NONE ) ;
mainConfigManager . register ( " general.itemLifespan " , 60 , " How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60) " , ConfigManager . RestartRequirement . NONE )
2015-09-20 11:20:30 +02:00
. setMinValue ( 5 ) ;
2015-06-28 22:28:47 +02:00
mainConfigManager . register ( " network.updateFactor " , 10 , " How often, in ticks, should network update packets be sent? Increasing this might help network performance. " , ConfigManager . RestartRequirement . GAME )
2015-09-20 11:20:30 +02:00
. setMinValue ( 1 ) ;
2015-06-28 22:28:47 +02:00
mainConfigManager . register ( " network.longUpdateFactor " , 40 , " How often, in ticks, should full network sync packets be sent? Increasing this might help network performance. " , ConfigManager . RestartRequirement . GAME )
2015-09-20 11:20:30 +02:00
. setMinValue ( 1 ) ;
2015-06-28 22:28:47 +02:00
mainConfigManager . register ( " general.canEnginesExplode " , false , " Should engines explode upon overheat? " , ConfigManager . RestartRequirement . NONE ) ;
mainConfigManager . register ( " worldgen.enable " , true , " Should BuildCraft generate anything in the world? " , ConfigManager . RestartRequirement . GAME ) ;
mainConfigManager . register ( " general.pumpsConsumeWater " , false , " Should pumps consume water? Enabling this might cause performance issues! " , ConfigManager . RestartRequirement . NONE ) ;
mainConfigManager . register ( " power.miningUsageMultiplier " , 1 . 0D , " What should the multiplier of all mining-related power usage be? " , ConfigManager . RestartRequirement . NONE ) ;
mainConfigManager . register ( " display.colorBlindMode " , false , " Should I enable colorblind mode? " , ConfigManager . RestartRequirement . GAME ) ;
mainConfigManager . register ( " worldgen.generateWaterSprings " , true , " Should BuildCraft generate water springs? " , ConfigManager . RestartRequirement . GAME ) ;
reloadConfig ( ConfigManager . RestartRequirement . GAME ) ;
wrenchItem = ( new ItemWrench ( ) ) . setUnlocalizedName ( " wrenchItem " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( wrenchItem , false ) ;
2015-06-28 22:28:47 +02:00
mapLocationItem = ( new ItemMapLocation ( ) ) . setUnlocalizedName ( " mapLocation " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( mapLocationItem , false ) ;
2015-06-28 22:28:47 +02:00
listItem = ( ItemList ) ( new ItemList ( ) ) . setUnlocalizedName ( " list " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( listItem , false ) ;
2015-06-28 22:28:47 +02:00
debuggerItem = ( new ItemDebugger ( ) ) . setUnlocalizedName ( " debugger " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( debuggerItem , false ) ;
2015-06-28 22:28:47 +02:00
if ( BuildCraftCore . modifyWorld ) {
BlockSpring . EnumSpring . WATER . canGen = BuildCraftCore . mainConfigManager . get ( " worldgen.generateWaterSprings " ) . getBoolean ( ) ;
springBlock = new BlockSpring ( ) . setBlockName ( " eternalSpring " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( springBlock , ItemSpring . class , false ) ;
2012-08-24 19:25:54 +02:00
}
2014-01-06 19:59:09 +01:00
2015-06-28 22:28:47 +02:00
woodenGearItem = ( new ItemGear ( ) ) . setUnlocalizedName ( " woodenGearItem " ) ;
2015-09-29 09:54:12 +02:00
if ( BCRegistry . INSTANCE . registerItem ( woodenGearItem , false ) ) {
OreDictionary . registerOre ( " gearWood " , new ItemStack ( woodenGearItem ) ) ;
}
2015-06-28 22:28:47 +02:00
stoneGearItem = ( new ItemGear ( ) ) . setUnlocalizedName ( " stoneGearItem " ) ;
2015-09-29 09:54:12 +02:00
if ( BCRegistry . INSTANCE . registerItem ( stoneGearItem , false ) ) {
OreDictionary . registerOre ( " gearStone " , new ItemStack ( stoneGearItem ) ) ;
}
2015-06-28 22:28:47 +02:00
ironGearItem = ( new ItemGear ( ) ) . setUnlocalizedName ( " ironGearItem " ) ;
2015-09-29 09:54:12 +02:00
if ( BCRegistry . INSTANCE . registerItem ( ironGearItem , false ) ) {
OreDictionary . registerOre ( " gearIron " , new ItemStack ( ironGearItem ) ) ;
}
2015-06-28 22:28:47 +02:00
goldGearItem = ( new ItemGear ( ) ) . setUnlocalizedName ( " goldGearItem " ) ;
2015-09-29 09:54:12 +02:00
if ( BCRegistry . INSTANCE . registerItem ( goldGearItem , false ) ) {
OreDictionary . registerOre ( " gearGold " , new ItemStack ( goldGearItem ) ) ;
}
2015-06-28 22:28:47 +02:00
diamondGearItem = ( new ItemGear ( ) ) . setUnlocalizedName ( " diamondGearItem " ) ;
2015-09-29 09:54:12 +02:00
if ( BCRegistry . INSTANCE . registerItem ( diamondGearItem , false ) ) {
OreDictionary . registerOre ( " gearDiamond " , new ItemStack ( diamondGearItem ) ) ;
}
2015-06-28 22:28:47 +02:00
paintbrushItem = ( new ItemPaintbrush ( ) ) . setUnlocalizedName ( " paintbrush " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( paintbrushItem , false ) ;
2015-06-28 22:28:47 +02:00
2015-09-19 12:59:05 +02:00
if ( DEVELOPER_MODE ) {
2015-06-28 22:28:47 +02:00
tabletItem = new ItemTablet ( ) ;
tabletItem . setUnlocalizedName ( " tablet " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( tabletItem , false ) ;
2015-06-28 22:28:47 +02:00
}
buildToolBlock = new BlockBuildTool ( ) ;
buildToolBlock . setBlockName ( " buildToolBlock " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( buildToolBlock , true ) ;
2015-06-28 22:28:47 +02:00
engineBlock = ( BlockEngine ) CompatHooks . INSTANCE . getBlock ( BlockEngine . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( engineBlock , ItemEngine . class , true ) ;
engineBlock . registerTile ( ( Class < ? extends TileEngineBase > ) CompatHooks . INSTANCE . getTile ( TileEngineWood . class ) , 0 , " tile.engineWood " , " buildcraftcore:engineWood " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileEngineWood . class , " net.minecraft.src.buildcraft.energy.TileEngineWood " ) ;
2015-06-28 22:28:47 +02:00
2015-06-30 19:01:44 +02:00
markerBlock = ( BlockMarker ) CompatHooks . INSTANCE . getBlock ( BlockMarker . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( markerBlock . setBlockName ( " markerBlock " ) , false ) ;
2015-06-30 19:01:44 +02:00
pathMarkerBlock = ( BlockPathMarker ) CompatHooks . INSTANCE . getBlock ( BlockPathMarker . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( pathMarkerBlock . setBlockName ( " pathMarkerBlock " ) , false ) ;
2015-06-30 19:01:44 +02:00
2015-06-28 22:28:47 +02:00
FMLCommonHandler . instance ( ) . bus ( ) . register ( this ) ;
MinecraftForge . EVENT_BUS . register ( this ) ;
MinecraftForge . EVENT_BUS . register ( new BlockHighlightHandler ( ) ) ;
2015-07-19 11:52:40 +02:00
MinecraftForge . EVENT_BUS . register ( new ListTooltipHandler ( ) ) ;
2015-09-06 16:12:44 +02:00
OreDictionary . registerOre ( " chestWood " , Blocks . chest ) ;
OreDictionary . registerOre ( " craftingTableWood " , Blocks . crafting_table ) ;
2012-08-24 19:25:54 +02:00
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2014-10-19 14:36:27 +02:00
public void init ( FMLInitializationEvent evt ) {
2014-04-26 16:10:57 +02:00
BuildCraftAPI . proxy = CoreProxy . proxy ;
2015-04-09 18:48:07 +02:00
ChannelHandler coreChannelHandler = new ChannelHandler ( ) ;
coreChannelHandler . registerPacketType ( PacketTabletMessage . class ) ;
2014-01-13 20:26:16 +01:00
channels = NetworkRegistry . INSTANCE . newChannel
2015-04-09 18:48:07 +02:00
( DefaultProps . NET_CHANNEL_NAME + " -CORE " , coreChannelHandler , new PacketHandlerCore ( ) ) ;
2014-02-16 17:21:22 +01:00
2015-04-09 18:48:07 +02:00
achievementManager = new AchievementManager ( " BuildCraft " ) ;
2015-03-03 21:47:33 +01:00
FMLCommonHandler . instance ( ) . bus ( ) . register ( achievementManager ) ;
woodenGearAchievement = achievementManager . registerAchievement ( new Achievement ( " achievement.woodenGear " , " woodenGearAchievement " , 0 , 0 , woodenGearItem , null ) ) ;
stoneGearAchievement = achievementManager . registerAchievement ( new Achievement ( " achievement.stoneGear " , " stoneGearAchievement " , 2 , 0 , stoneGearItem , woodenGearAchievement ) ) ;
ironGearAchievement = achievementManager . registerAchievement ( new Achievement ( " achievement.ironGear " , " ironGearAchievement " , 4 , 0 , ironGearItem , stoneGearAchievement ) ) ;
goldGearAchievement = achievementManager . registerAchievement ( new Achievement ( " achievement.goldGear " , " goldGearAchievement " , 6 , 0 , goldGearItem , ironGearAchievement ) ) ;
diamondGearAchievement = achievementManager . registerAchievement ( new Achievement ( " achievement.diamondGear " , " diamondGearAchievement " , 8 , 0 , diamondGearItem , goldGearAchievement ) ) ;
wrenchAchievement = achievementManager . registerAchievement ( new Achievement ( " achievement.wrench " , " wrenchAchievement " , 3 , 2 , wrenchItem , stoneGearAchievement ) ) ;
2015-03-06 16:45:05 +01:00
engineRedstoneAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.redstoneEngine " , " engineAchievement1 " , 1 , - 2 , new ItemStack ( engineBlock , 1 , 0 ) , BuildCraftCore . woodenGearAchievement ) ) ;
2015-03-03 21:47:33 +01:00
2014-10-28 16:36:06 +01:00
// BuildCraft 6.1.4 and below - migration only
StatementManager . registerParameterClass ( " buildcraft:stackTrigger " , StatementParameterItemStack . class ) ;
StatementManager . registerParameterClass ( " buildcraft:stackAction " , StatementParameterItemStack . class ) ;
2015-09-12 21:30:14 +02:00
2014-10-28 12:17:52 +01:00
StatementManager . registerParameterClass ( StatementParameterItemStack . class ) ;
2015-07-24 01:01:26 +02:00
StatementManager . registerParameterClass ( StatementParameterItemStackExact . class ) ;
2014-10-28 07:22:43 +01:00
StatementManager . registerParameterClass ( StatementParameterDirection . class ) ;
StatementManager . registerParameterClass ( StatementParameterRedstoneGateSideOnly . class ) ;
2014-06-13 13:15:33 +02:00
StatementManager . registerTriggerProvider ( new DefaultTriggerProvider ( ) ) ;
StatementManager . registerActionProvider ( new DefaultActionProvider ( ) ) ;
2012-07-25 12:45:15 +02:00
2013-02-01 08:10:14 +01:00
if ( BuildCraftCore . modifyWorld ) {
MinecraftForge . EVENT_BUS . register ( new SpringPopulate ( ) ) ;
}
2014-05-10 22:08:23 +02:00
if ( mainConfiguration . hasChanged ( ) ) {
mainConfiguration . save ( ) ;
}
2012-12-17 23:30:54 +01:00
if ( BuildCraftCore . loadDefaultRecipes ) {
2012-07-25 12:45:15 +02:00
loadRecipes ( ) ;
2012-08-24 19:25:54 +02:00
}
2015-03-04 22:44:44 +01:00
2022-06-17 11:36:20 +02:00
if ( BCCreativeTab . isPresent ( " main " ) ) {
BCCreativeTab . get ( " main " ) . setIcon ( new ItemStack ( BuildCraftCore . wrenchItem , 1 ) ) ;
}
2015-03-04 22:44:44 +01:00
2012-08-25 19:04:35 +02:00
EntityList . stringToClassMapping . remove ( " BuildCraft|Core.bcLaser " ) ;
EntityList . stringToClassMapping . remove ( " BuildCraft|Core.bcEnergyLaser " ) ;
2012-07-25 12:45:15 +02:00
2015-03-06 16:45:05 +01:00
BuilderAPI . schematicRegistry . registerSchematicBlock ( engineBlock , SchematicEngine . class ) ;
2012-09-05 22:29:38 +02:00
CoreProxy . proxy . initializeRendering ( ) ;
CoreProxy . proxy . initializeEntityRendering ( ) ;
2014-03-15 23:57:59 +01:00
2015-03-04 22:44:44 +01:00
NetworkRegistry . INSTANCE . registerGuiHandler ( instance , new CoreGuiHandler ( ) ) ;
2015-04-09 18:48:07 +02:00
FMLCommonHandler . instance ( ) . bus ( ) . register ( TabletManagerClient . INSTANCE ) ;
FMLCommonHandler . instance ( ) . bus ( ) . register ( TabletManagerServer . INSTANCE ) ;
MinecraftForge . EVENT_BUS . register ( TabletManagerClient . INSTANCE ) ;
MinecraftForge . EVENT_BUS . register ( TabletManagerServer . INSTANCE ) ;
TabletAPI . registerProgram ( new TabletProgramMenuFactory ( ) ) ;
2015-06-14 14:13:17 +02:00
// 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 ( ) ) ;
FillerManager . registry . addPattern ( new PatternFrame ( ) ) ;
} catch ( Error error ) {
2015-08-07 13:23:47 +02:00
BCLog . logErrorAPI ( error , IFillerPattern . class ) ;
2015-06-14 14:13:17 +02:00
throw error ;
}
StatementManager . registerParameterClass ( PatternParameterYDir . class ) ;
StatementManager . registerParameterClass ( PatternParameterXZDir . class ) ;
2015-06-14 14:58:09 +02:00
StatementManager . registerParameterClass ( PatternParameterCenter . class ) ;
2015-06-15 13:04:08 +02:00
StatementManager . registerParameterClass ( PatternParameterHollow . class ) ;
2015-06-28 20:20:38 +02:00
ListRegistry . registerHandler ( new ListMatchHandlerClass ( ) ) ;
2015-06-29 10:46:47 +02:00
ListRegistry . registerHandler ( new ListMatchHandlerFluid ( ) ) ;
2015-08-07 13:23:47 +02:00
ListRegistry . registerHandler ( new ListMatchHandlerTools ( ) ) ;
2015-08-07 19:20:20 +02:00
ListRegistry . registerHandler ( new ListMatchHandlerArmor ( ) ) ;
2015-08-07 13:23:47 +02:00
ListRegistry . itemClassAsType . add ( ItemFood . class ) ;
2022-06-17 11:12:38 +02:00
if ( Loader . isModLoaded ( " foamfix " ) ) {
alphaPassBugPresent = false ;
}
2012-07-25 12:45:15 +02:00
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2012-12-17 23:30:54 +01:00
public void postInit ( FMLPostInitializationEvent event ) {
2015-04-05 14:56:57 +02:00
BCLog . logger . info ( " BuildCraft's fake player: UUID = " + gameProfile . getId ( ) . toString ( ) + " , name = ' " + gameProfile . getName ( ) + " '! " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . save ( ) ;
2014-02-08 20:39:39 +01:00
for ( Object o : Block . blockRegistry ) {
Block block = ( Block ) o ;
2014-07-12 00:24:45 +02:00
2014-03-10 17:43:12 +01:00
if ( block instanceof BlockFluidBase | | block instanceof BlockLiquid | | block instanceof IPlantable ) {
2014-02-08 20:39:39 +01:00
BuildCraftAPI . softBlocks . add ( block ) ;
2012-10-30 21:27:14 +01:00
}
}
2014-02-16 17:21:22 +01:00
2014-02-08 20:39:39 +01:00
BuildCraftAPI . softBlocks . add ( Blocks . snow ) ;
BuildCraftAPI . softBlocks . add ( Blocks . vine ) ;
BuildCraftAPI . softBlocks . add ( Blocks . fire ) ;
2014-02-16 17:21:22 +01:00
2014-07-27 23:05:35 +02:00
FMLCommonHandler . instance ( ) . bus ( ) . register ( new TickHandlerCore ( ) ) ;
2014-06-11 16:58:09 +02:00
2015-05-31 20:40:50 +02:00
CropManager . setDefaultHandler ( new CropHandlerPlantable ( ) ) ;
2015-05-25 17:41:52 +02:00
CropManager . registerHandler ( new CropHandlerReeds ( ) ) ;
2021-11-27 10:43:41 +01:00
CropHandlerPlantable . forbidBlock ( Blocks . reeds ) ;
2015-09-11 20:20:49 +02:00
BuildCraftAPI . registerWorldProperty ( " replaceable " , new WorldPropertyIsReplaceable ( ) ) ;
2015-02-27 13:59:31 +01:00
BuildCraftAPI . registerWorldProperty ( " soft " , new WorldPropertyIsSoft ( ) ) ;
BuildCraftAPI . registerWorldProperty ( " wood " , new WorldPropertyIsWood ( ) ) ;
BuildCraftAPI . registerWorldProperty ( " leaves " , new WorldPropertyIsLeaf ( ) ) ;
for ( int i = 0 ; i < 4 ; i + + ) {
BuildCraftAPI . registerWorldProperty ( " ore@hardness= " + i , new WorldPropertyIsOre ( i ) ) ;
2014-10-27 12:16:15 +01:00
}
2015-02-27 13:59:31 +01:00
BuildCraftAPI . registerWorldProperty ( " harvestable " , new WorldPropertyIsHarvestable ( ) ) ;
BuildCraftAPI . registerWorldProperty ( " farmland " , new WorldPropertyIsFarmland ( ) ) ;
BuildCraftAPI . registerWorldProperty ( " shoveled " , new WorldPropertyIsShoveled ( ) ) ;
BuildCraftAPI . registerWorldProperty ( " dirt " , new WorldPropertyIsDirt ( ) ) ;
BuildCraftAPI . registerWorldProperty ( " fluidSource " , new WorldPropertyIsFluidSource ( ) ) ;
2015-06-30 19:01:44 +02:00
// Landmarks are often caught incorrectly, making building them counter-productive.
SchematicRegistry . INSTANCE . registerSchematicBlock ( markerBlock , SchematicIgnore . class ) ;
SchematicRegistry . INSTANCE . registerSchematicBlock ( pathMarkerBlock , SchematicIgnore . class ) ;
2014-10-26 16:32:13 +01:00
ColorUtils . initialize ( ) ;
2015-09-20 11:20:30 +02:00
2014-10-28 20:15:30 +01:00
actionControl = new IActionExternal [ IControllable . Mode . values ( ) . length ] ;
for ( IControllable . Mode mode : IControllable . Mode . values ( ) ) {
2015-02-23 21:31:28 +01:00
if ( mode ! = IControllable . Mode . Unknown & & mode ! = IControllable . Mode . Mode ) {
2014-10-28 20:15:30 +01:00
actionControl [ mode . ordinal ( ) ] = new ActionMachineControl ( mode ) ;
}
}
2015-06-28 20:20:38 +02:00
2015-07-01 17:05:15 +02:00
MinecraftForge . EVENT_BUS . register ( ListOreDictionaryCache . INSTANCE ) ;
2015-06-28 20:20:38 +02:00
for ( String s : OreDictionary . getOreNames ( ) ) {
2015-07-01 17:05:15 +02:00
ListOreDictionaryCache . INSTANCE . registerName ( s ) ;
2015-06-28 20:20:38 +02:00
}
ListRegistry . registerHandler ( new ListMatchHandlerOreDictionary ( ) ) ;
2012-12-17 23:30:54 +01:00
}
2012-10-30 21:27:14 +01:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-11-18 16:06:38 +01:00
public void serverStarting ( FMLServerStartingEvent event ) {
2015-05-07 19:15:17 +02:00
event . registerServerCommand ( commandBuildcraft ) ;
2015-05-07 10:48:00 +02:00
2015-10-06 16:12:16 +02:00
/ * Increase the builder speed in singleplayer mode .
Singleplayer users generally run far fewer of them . * /
if ( FMLCommonHandler . instance ( ) . getSide ( ) = = Side . CLIENT ) {
BuildingSlotMapIterator . MAX_PER_ITEM = builderMaxPerItemFactor * 4 ;
} else {
BuildingSlotMapIterator . MAX_PER_ITEM = builderMaxPerItemFactor ;
}
2015-05-07 10:48:00 +02:00
if ( Utils . CAULDRON_DETECTED ) {
BCLog . logger . warn ( " ############################################ " ) ;
BCLog . logger . warn ( " # # " ) ;
BCLog . logger . warn ( " # Cauldron has been detected! Please keep # " ) ;
2015-10-06 16:12:16 +02:00
BCLog . logger . warn ( " # in mind that BuildCraft may NOT provide # " ) ;
BCLog . logger . warn ( " # support to Cauldron users, as the mod is # " ) ;
BCLog . logger . warn ( " # primarily tested without Bukkit/Spigot's # " ) ;
BCLog . logger . warn ( " # changes to the Minecraft internals. # " ) ;
2015-05-07 10:48:00 +02:00
BCLog . logger . warn ( " # # " ) ;
BCLog . logger . warn ( " # Any lag caused by BuildCraft on top of # " ) ;
2015-10-06 16:12:16 +02:00
BCLog . logger . warn ( " # Cauldron likely arises from workarounds # " ) ;
BCLog . logger . warn ( " # which we apply to make sure BuildCraft # " ) ;
BCLog . logger . warn ( " # works properly with Cauldron installed. # " ) ;
BCLog . logger . warn ( " # # " ) ;
BCLog . logger . warn ( " # Thanks for your attention! ~ BC devs # " ) ;
2015-05-07 10:48:00 +02:00
BCLog . logger . warn ( " # # " ) ;
BCLog . logger . warn ( " ############################################ " ) ;
// To people reading that code and thinking we're lying:
// Cauldron does not invalidate tile entities properly, causing
// issues with our tile entity cache. That is the bug and that
// is also the reason for the extra lag caused when using Cauldron.
}
2012-09-08 21:46:17 +02:00
}
2013-03-30 01:47:12 +01:00
2015-04-09 18:48:07 +02:00
@Mod.EventHandler
public void serverStopping ( FMLServerStoppingEvent event ) {
TabletManagerClient . INSTANCE . onServerStopping ( ) ;
TabletManagerServer . INSTANCE . onServerStopping ( ) ;
}
2014-02-08 16:04:03 +01:00
@SubscribeEvent
2013-03-21 00:24:41 +01:00
@SideOnly ( Side . CLIENT )
2013-12-02 06:57:31 +01:00
public void textureHook ( TextureStitchEvent . Pre event ) {
2015-06-15 13:04:08 +02:00
for ( FillerPattern pattern : FillerPattern . patterns . values ( ) ) {
pattern . registerIcons ( event . map ) ;
}
2014-02-08 16:04:03 +01:00
if ( event . map . getTextureType ( ) = = 1 ) {
2013-03-21 00:24:41 +01:00
iconProvider = new CoreIconProvider ( ) ;
iconProvider . registerIcons ( event . map ) ;
2015-06-21 18:07:24 +02:00
StatementManager . registerIcons ( event . map ) ;
2014-02-08 16:04:03 +01:00
} else if ( event . map . getTextureType ( ) = = 0 ) {
2015-03-09 13:59:13 +01:00
BuildCraftCore . redLaserTexture = event . map . registerIcon ( " buildcraftcore:laserBox/blockRedLaser " ) ;
BuildCraftCore . blueLaserTexture = event . map . registerIcon ( " buildcraftcore:laserBox/blockBlueLaser " ) ;
BuildCraftCore . stripesLaserTexture = event . map . registerIcon ( " buildcraftcore:laserBox/blockStripesLaser " ) ;
2015-03-11 22:07:02 +01:00
BuildCraftCore . transparentTexture = event . map . registerIcon ( " buildcraftcore:misc/transparent " ) ;
2015-06-04 16:01:26 +02:00
RenderLEDTile . registerBlockIcons ( event . map ) ;
2013-03-22 21:52:35 +01:00
}
2015-04-02 14:46:57 +02:00
}
2015-09-04 14:45:29 +02:00
@SubscribeEvent
@SideOnly ( Side . CLIENT )
public void textureHook ( TextureStitchEvent . Post event ) {
FluidRenderer . onTextureReload ( ) ;
RenderLaser . onTextureReload ( ) ;
}
2015-04-02 14:46:57 +02:00
public void reloadConfig ( ConfigManager . RestartRequirement restartType ) {
if ( restartType = = ConfigManager . RestartRequirement . GAME ) {
modifyWorld = mainConfigManager . get ( " worldgen.enable " ) . getBoolean ( ) ;
updateFactor = mainConfigManager . get ( " network.updateFactor " ) . getInt ( ) ;
longUpdateFactor = mainConfigManager . get ( " network.longUpdateFactor " ) . getInt ( ) ;
colorBlindMode = mainConfigManager . get ( " display.colorBlindMode " ) . getBoolean ( ) ;
reloadConfig ( ConfigManager . RestartRequirement . WORLD ) ;
} else if ( restartType = = ConfigManager . RestartRequirement . WORLD ) {
reloadConfig ( ConfigManager . RestartRequirement . NONE ) ;
} else {
2015-10-12 17:11:26 +02:00
useServerDataOnClient = mainConfigManager . get ( " general.useServerDataOnClient " ) . getBoolean ( true ) ;
2015-10-06 16:12:16 +02:00
builderMaxPerItemFactor = mainConfigManager . get ( " general.builderMaxIterationsPerItemFactor " ) . getInt ( ) ;
2015-04-02 14:46:57 +02:00
hideFluidNumbers = mainConfigManager . get ( " display.hideFluidValues " ) . getBoolean ( ) ;
hidePowerNumbers = mainConfigManager . get ( " display.hidePowerValues " ) . getBoolean ( ) ;
itemLifespan = mainConfigManager . get ( " general.itemLifespan " ) . getInt ( ) ;
canEnginesExplode = mainConfigManager . get ( " general.canEnginesExplode " ) . getBoolean ( ) ;
consumeWaterSources = mainConfigManager . get ( " general.pumpsConsumeWater " ) . getBoolean ( ) ;
miningMultiplier = ( float ) mainConfigManager . get ( " power.miningUsageMultiplier " ) . getDouble ( ) ;
2015-09-30 16:17:54 +02:00
miningAllowPlayerProtectedBlocks = mainConfigManager . get ( " general.miningBreaksPlayerProtectedBlocks " ) . getBoolean ( ) ;
2015-04-02 14:46:57 +02:00
2015-10-06 16:12:16 +02:00
BuildingSlotMapIterator . MAX_PER_ITEM = builderMaxPerItemFactor ;
2017-04-08 10:29:40 +02:00
if ( miningMultiplier < = 0 ) {
2017-03-09 11:44:22 +01:00
throw new RuntimeException ( " Please do not set the miningMultiplier to values <= 0.0! " ) ;
2017-04-08 10:29:40 +02:00
}
2017-03-09 11:44:22 +01:00
2015-04-02 14:46:57 +02:00
if ( mainConfigManager . get ( " general.updateCheck " ) . getBoolean ( true ) ) {
Version . check ( ) ;
}
if ( mainConfiguration . hasChanged ( ) ) {
mainConfiguration . save ( ) ;
}
}
}
2013-03-30 02:24:49 +01:00
2015-04-02 14:46:57 +02:00
@SubscribeEvent
public void onConfigChanged ( ConfigChangedEvent . OnConfigChangedEvent event ) {
if ( " BuildCraft|Core " . equals ( event . modID ) ) {
reloadConfig ( event . isWorldRunning ? ConfigManager . RestartRequirement . NONE : ConfigManager . RestartRequirement . WORLD ) ;
}
2013-03-21 00:24:41 +01:00
}
2012-09-26 05:19:29 +02:00
2014-07-27 23:05:35 +02:00
public void loadRecipes ( ) {
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( wrenchItem ) , " I I " , " G " , " I " , 'I' , " ingotIron " , 'G' , " gearStone " ) ;
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( woodenGearItem ) , " S " , " S S " ,
2014-07-27 23:05:35 +02:00
" S " , 'S' ,
2014-07-25 08:40:47 +02:00
" stickWood " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( stoneGearItem ) , " I " , " IGI " ,
2014-07-27 23:05:35 +02:00
" I " , 'I' ,
2014-07-25 08:40:47 +02:00
" cobblestone " , 'G' ,
2014-11-11 23:14:16 +01:00
" gearWood " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( ironGearItem ) , " I " , " IGI " ,
2014-07-27 23:05:35 +02:00
" I " , 'I' ,
2014-11-11 23:14:16 +01:00
" ingotIron " , 'G' , " gearStone " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( goldGearItem ) , " I " , " IGI " ,
2014-07-27 23:05:35 +02:00
" I " , 'I' ,
2014-11-11 23:14:16 +01:00
" ingotGold " , 'G' , " gearIron " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe (
2014-11-11 23:14:16 +01:00
new ItemStack ( diamondGearItem ) , " I " , " IGI " , " I " , 'I' , " gemDiamond " , 'G' , " gearGold " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( mapLocationItem ) , " ppp " , " pYp " , " ppp " , 'p' , Items . paper , 'Y' , " dyeYellow " ) ;
2015-03-06 16:45:05 +01:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( engineBlock , 1 , 0 ) ,
2015-03-06 16:45:05 +01:00
" www " , " g " , " GpG " , 'w' , " plankWood " , 'g' , " blockGlass " , 'G' ,
" gearWood " , 'p' , Blocks . piston ) ;
2015-03-14 17:03:20 +01:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( markerBlock , 1 ) , " l " , " r " , 'l' ,
2015-06-30 19:01:44 +02:00
new ItemStack ( Items . dye , 1 , 4 ) , 'r' , Blocks . redstone_torch ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( pathMarkerBlock , 1 ) , " l " , " r " , 'l' ,
2015-06-30 19:01:44 +02:00
" dyeGreen " , 'r' , Blocks . redstone_torch ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( paintbrushItem ) , " iw " , " gi " , " s " ,
2015-03-14 17:03:20 +01:00
's' , " stickWood " , 'g' , " gearWood " , 'w' , new ItemStack ( Blocks . wool , 1 , 0 ) , 'i' , Items . string ) ;
2015-07-19 22:38:57 +02:00
ItemStack anyPaintbrush = new ItemStack ( paintbrushItem , 1 , OreDictionary . WILDCARD_VALUE ) ;
2015-03-14 17:03:20 +01:00
for ( int i = 0 ; i < 16 ; i + + ) {
ItemStack outputStack = new ItemStack ( paintbrushItem ) ;
NBTUtils . getItemData ( outputStack ) . setByte ( " color " , ( byte ) i ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addShapelessRecipe ( outputStack , anyPaintbrush , EnumColor . fromId ( i ) . getDye ( ) ) ;
2015-03-14 17:03:20 +01:00
}
2015-06-05 21:47:30 +02:00
2015-07-19 15:48:48 +02:00
// Convert old lists to new lists
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addShapelessRecipe ( new ItemStack ( listItem , 1 , 1 ) , new ItemStack ( listItem , 1 , 0 ) ) ;
2015-07-19 15:48:48 +02:00
2015-06-05 21:47:30 +02:00
if ( Loader . isModLoaded ( " BuildCraft|Silicon " ) ) {
CoreSiliconRecipes . loadSiliconRecipes ( ) ;
} else {
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( listItem , 1 , 1 ) , " ppp " , " pYp " , " ppp " , 'p' , Items . paper , 'Y' ,
2015-06-05 21:47:30 +02:00
" dyeGreen " ) ;
}
2012-07-25 12:45:15 +02:00
}
2013-11-18 16:06:38 +01:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-11-18 16:06:38 +01:00
public void processIMCRequests ( FMLInterModComms . IMCEvent event ) {
InterModComms . processIMC ( event ) ;
}
2014-02-19 00:23:06 +01:00
2014-06-10 17:10:07 +02:00
@SubscribeEvent
2015-06-30 19:01:44 +02:00
public void cleanRegistries ( WorldEvent . Unload event ) {
2015-02-27 13:59:31 +01:00
for ( IWorldProperty property : BuildCraftAPI . worldProperties . values ( ) ) {
property . clear ( ) ;
2014-10-27 12:16:15 +01:00
}
2015-06-30 19:01:44 +02:00
if ( FMLCommonHandler . instance ( ) . getEffectiveSide ( ) = = Side . SERVER ) {
TilePathMarker . clearAvailableMarkersList ( event . world ) ;
}
2014-06-10 17:10:07 +02:00
}
2012-07-25 12:45:15 +02:00
}