2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct;
|
|
|
|
|
|
2014-02-05 10:28:54 -05:00
|
|
|
import mantle.lib.TabTools;
|
2014-01-19 17:20:12 +11:00
|
|
|
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2014-02-04 18:00:13 -05:00
|
|
|
|
2014-02-05 10:28:54 -05:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2014-02-04 18:00:13 -05:00
|
|
|
|
2014-01-19 17:20:12 +11:00
|
|
|
import tconstruct.achievements.TAchievements;
|
2014-02-04 18:00:13 -05:00
|
|
|
import tconstruct.client.TControls;
|
2014-02-11 21:35:05 -05:00
|
|
|
import tconstruct.client.event.EventCloakRender;
|
2014-02-05 10:28:54 -05:00
|
|
|
import tconstruct.common.TContent;
|
|
|
|
|
import tconstruct.common.TProxyCommon;
|
|
|
|
|
import tconstruct.common.TRecipes;
|
|
|
|
|
import tconstruct.common.TRepo;
|
2013-07-26 21:18:53 -07:00
|
|
|
import tconstruct.library.TConstructRegistry;
|
2014-02-05 10:28:54 -05:00
|
|
|
import tconstruct.library.crafting.Detailing;
|
|
|
|
|
import tconstruct.library.crafting.LiquidCasting;
|
2013-11-16 16:34:38 +00:00
|
|
|
import tconstruct.plugins.PluginController;
|
2014-02-05 10:28:54 -05:00
|
|
|
import tconstruct.util.EnvironmentChecks;
|
2014-02-21 09:25:00 -05:00
|
|
|
import tconstruct.util.TCraftingHandler;
|
2014-02-05 10:28:54 -05:00
|
|
|
import tconstruct.util.TEventHandler;
|
|
|
|
|
import tconstruct.util.TEventHandlerAchievement;
|
|
|
|
|
import tconstruct.util.config.DimensionBlacklist;
|
|
|
|
|
import tconstruct.util.config.PHConstruct;
|
2013-09-05 12:39:18 -07:00
|
|
|
import tconstruct.util.landmine.behavior.Behavior;
|
|
|
|
|
import tconstruct.util.landmine.behavior.stackCombo.SpecialStackHandler;
|
2014-01-28 20:50:29 +11:00
|
|
|
import tconstruct.util.network.packet.PacketPipeline;
|
2013-07-26 21:18:53 -07:00
|
|
|
import tconstruct.util.player.TPlayerHandler;
|
2014-02-05 10:28:54 -05:00
|
|
|
import tconstruct.worldgen.SlimeIslandGen;
|
|
|
|
|
import tconstruct.worldgen.TBaseWorldGenerator;
|
|
|
|
|
import tconstruct.worldgen.TerrainGenEventHandler;
|
|
|
|
|
import tconstruct.worldgen.village.ComponentSmeltery;
|
|
|
|
|
import tconstruct.worldgen.village.ComponentToolWorkshop;
|
|
|
|
|
import tconstruct.worldgen.village.TVillageTrades;
|
|
|
|
|
import tconstruct.worldgen.village.VillageSmelteryHandler;
|
|
|
|
|
import tconstruct.worldgen.village.VillageToolStationHandler;
|
|
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
|
|
|
|
import cpw.mods.fml.common.Loader;
|
|
|
|
|
import cpw.mods.fml.common.Mod;
|
|
|
|
|
import cpw.mods.fml.common.Mod.EventHandler;
|
|
|
|
|
import cpw.mods.fml.common.Mod.Instance;
|
|
|
|
|
import cpw.mods.fml.common.SidedProxy;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
|
import cpw.mods.fml.common.registry.VillagerRegistry;
|
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2014-02-16 14:23:50 -05:00
|
|
|
/**
|
|
|
|
|
* TConstruct, the tool mod. Craft your tools with style, then modify until the
|
|
|
|
|
* original is gone!
|
|
|
|
|
*
|
2013-10-22 16:49:14 +01:00
|
|
|
* @author mDiyo
|
2013-07-26 21:18:53 -07:00
|
|
|
*/
|
|
|
|
|
|
2013-12-05 16:34:01 -05:00
|
|
|
@Mod(modid = "TConstruct", name = "TConstruct", version = "${version}",
|
2013-12-12 03:30:41 -05:00
|
|
|
dependencies = "required-after:Forge@[9.11,);required-after:Mantle;after:ForgeMultipart;after:MineFactoryReloaded;after:NotEnoughItems;after:Waila;after:ThermalExpansion")
|
2013-07-26 21:18:53 -07:00
|
|
|
public class TConstruct
|
|
|
|
|
{
|
|
|
|
|
/** The value of one ingot in millibuckets */
|
|
|
|
|
public static final int ingotLiquidValue = 144;
|
2013-11-04 00:33:39 +01:00
|
|
|
public static final int oreLiquidValue = ingotLiquidValue * 2;
|
|
|
|
|
public static final int blockLiquidValue = ingotLiquidValue * 9;
|
|
|
|
|
public static final int chunkLiquidValue = ingotLiquidValue / 2;
|
|
|
|
|
public static final int nuggetLiquidValue = ingotLiquidValue / 9;
|
|
|
|
|
|
2013-07-26 21:18:53 -07:00
|
|
|
public static final int liquidUpdateAmount = 6;
|
|
|
|
|
|
2013-10-12 23:46:35 +01:00
|
|
|
// Shared mod logger
|
2014-01-07 15:07:07 -05:00
|
|
|
public static final Logger logger = LogManager.getLogger("TConstruct");
|
2013-10-12 23:46:35 +01:00
|
|
|
|
2013-07-26 21:18:53 -07:00
|
|
|
/* Instance of this mod, used for grabbing prototype fields */
|
|
|
|
|
@Instance("TConstruct")
|
|
|
|
|
public static TConstruct instance;
|
|
|
|
|
/* Proxies for sides, used for graphics processing */
|
|
|
|
|
@SidedProxy(clientSide = "tconstruct.client.TProxyClient", serverSide = "tconstruct.common.TProxyCommon")
|
|
|
|
|
public static TProxyCommon proxy;
|
|
|
|
|
|
2014-02-16 14:23:50 -05:00
|
|
|
// The packet pipeline
|
2014-01-28 20:50:29 +11:00
|
|
|
public static final PacketPipeline packetPipeline = new PacketPipeline();
|
2014-02-05 09:11:06 -05:00
|
|
|
|
2013-07-26 21:18:53 -07:00
|
|
|
public TConstruct()
|
|
|
|
|
{
|
2014-01-10 17:03:06 -05:00
|
|
|
|
2014-02-21 09:25:00 -05:00
|
|
|
//logger.setParent(FMLCommonHandler.instance().getFMLLogger());
|
2013-07-26 21:18:53 -07:00
|
|
|
if (Loader.isModLoaded("Natura"))
|
|
|
|
|
{
|
2014-01-10 17:03:06 -05:00
|
|
|
logger.info("Natura, what are we going to do tomorrow night?");
|
|
|
|
|
LogManager.getLogger("Natura").info("TConstruct, we're going to take over the world!");
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-01-10 17:03:06 -05:00
|
|
|
logger.info("Preparing to take over the world");
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
2013-12-13 16:07:26 -05:00
|
|
|
|
2013-10-22 20:09:21 +01:00
|
|
|
EnvironmentChecks.verifyEnvironmentSanity();
|
2013-12-12 03:08:05 -08:00
|
|
|
MinecraftForge.EVENT_BUS.register(events = new TEventHandler());
|
2013-11-16 16:34:38 +00:00
|
|
|
PluginController.getController().registerBuiltins();
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
2013-09-28 08:45:28 -07:00
|
|
|
public void preInit (FMLPreInitializationEvent event)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-02-05 09:11:06 -05:00
|
|
|
|
2013-11-29 19:52:03 +00:00
|
|
|
PHConstruct.initProps(event.getSuggestedConfigurationFile());
|
2013-07-26 21:18:53 -07:00
|
|
|
TConstructRegistry.materialTab = new TabTools("TConstructMaterials");
|
|
|
|
|
TConstructRegistry.toolTab = new TabTools("TConstructTools");
|
2014-04-03 22:28:37 -04:00
|
|
|
TConstructRegistry.partTab = new TabTools("TConstructParts");
|
2013-07-26 21:18:53 -07:00
|
|
|
TConstructRegistry.blockTab = new TabTools("TConstructBlocks");
|
|
|
|
|
|
|
|
|
|
tableCasting = new LiquidCasting();
|
|
|
|
|
basinCasting = new LiquidCasting();
|
|
|
|
|
chiselDetailing = new Detailing();
|
|
|
|
|
|
|
|
|
|
content = new TContent();
|
2014-02-05 09:11:06 -05:00
|
|
|
|
2014-02-04 18:00:13 -05:00
|
|
|
recipes = new TRecipes();
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2014-02-04 18:00:13 -05:00
|
|
|
events = new TEventHandler();
|
|
|
|
|
MinecraftForge.EVENT_BUS.register(events);
|
2013-11-17 19:59:56 +11:00
|
|
|
MinecraftForge.EVENT_BUS.register(new TEventHandlerAchievement());
|
2013-12-13 16:07:26 -05:00
|
|
|
recipes.oreRegistry();
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
proxy.registerRenderer();
|
|
|
|
|
proxy.addNames();
|
|
|
|
|
proxy.readManuals();
|
|
|
|
|
proxy.registerKeys();
|
2013-11-14 14:26:37 -08:00
|
|
|
proxy.registerTickHandler();
|
2013-11-29 23:50:14 -05:00
|
|
|
|
2014-01-18 02:52:49 -05:00
|
|
|
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator(), 0);
|
2013-07-26 21:18:53 -07:00
|
|
|
MinecraftForge.TERRAIN_GEN_BUS.register(new TerrainGenEventHandler());
|
|
|
|
|
GameRegistry.registerFuelHandler(content);
|
2014-02-21 09:25:00 -05:00
|
|
|
MinecraftForge.EVENT_BUS.register(new TCraftingHandler());
|
2014-01-10 17:03:06 -05:00
|
|
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
if (PHConstruct.addToVillages)
|
|
|
|
|
{
|
2013-10-22 22:11:04 -04:00
|
|
|
// adds to the villager spawner egg
|
|
|
|
|
VillagerRegistry.instance().registerVillagerId(78943);
|
|
|
|
|
// moved down, not needed if 'addToVillages' is false
|
|
|
|
|
VillagerRegistry.instance().registerVillageTradeHandler(78943, new TVillageTrades());
|
2013-07-26 21:18:53 -07:00
|
|
|
VillagerRegistry.instance().registerVillageCreationHandler(new VillageToolStationHandler());
|
|
|
|
|
VillagerRegistry.instance().registerVillageCreationHandler(new VillageSmelteryHandler());
|
2013-09-28 08:45:28 -07:00
|
|
|
try
|
|
|
|
|
{
|
2013-12-13 16:07:26 -05:00
|
|
|
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
|
|
|
|
|
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
|
2013-09-28 08:45:28 -07:00
|
|
|
}
|
|
|
|
|
catch (Throwable e)
|
|
|
|
|
{
|
2014-01-07 15:07:07 -05:00
|
|
|
logger.error("Error registering TConstruct Structures with Vanilla Minecraft: this is expected in versions earlier than 1.6.4");
|
2013-09-28 08:45:28 -07:00
|
|
|
}
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
2013-09-29 09:05:08 -07:00
|
|
|
|
2013-07-26 21:18:53 -07:00
|
|
|
playerTracker = new TPlayerHandler();
|
2014-02-16 14:23:50 -05:00
|
|
|
// GameRegistry.registerPlayerTracker(playerTracker);
|
2014-02-04 18:00:13 -05:00
|
|
|
FMLCommonHandler.instance().bus().register(playerTracker);
|
2014-03-06 21:55:46 +11:00
|
|
|
MinecraftForge.EVENT_BUS.register(playerTracker);
|
2014-02-05 09:11:06 -05:00
|
|
|
|
2014-02-04 18:00:13 -05:00
|
|
|
if (event.getSide() == Side.CLIENT)
|
|
|
|
|
{
|
2014-02-05 09:11:06 -05:00
|
|
|
FMLCommonHandler.instance().bus().register(new TControls());
|
2014-02-04 18:00:13 -05:00
|
|
|
}
|
2013-11-16 16:34:38 +00:00
|
|
|
|
|
|
|
|
PluginController.getController().preInit();
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
2013-09-28 08:45:28 -07:00
|
|
|
public void init (FMLInitializationEvent event)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-02-05 09:11:06 -05:00
|
|
|
packetPipeline.initalise();
|
2013-08-31 05:13:31 -07:00
|
|
|
if (event.getSide() == Side.CLIENT)
|
|
|
|
|
{
|
2014-02-11 21:35:05 -05:00
|
|
|
MinecraftForge.EVENT_BUS.register(new EventCloakRender());
|
2013-08-31 05:13:31 -07:00
|
|
|
}
|
|
|
|
|
|
2013-11-30 17:06:50 +00:00
|
|
|
DimensionBlacklist.getBadBimensions();
|
2014-02-05 09:11:06 -05:00
|
|
|
GameRegistry.registerWorldGenerator(new SlimeIslandGen(TRepo.slimePool, 2), 2);
|
2013-11-16 16:34:38 +00:00
|
|
|
|
|
|
|
|
PluginController.getController().init();
|
2013-11-29 23:50:14 -05:00
|
|
|
|
|
|
|
|
if (PHConstruct.achievementsEnabled)
|
|
|
|
|
{
|
|
|
|
|
TAchievements.init();
|
2013-11-17 19:59:56 +11:00
|
|
|
}
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
2013-09-28 08:45:28 -07:00
|
|
|
public void postInit (FMLPostInitializationEvent evt)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2013-10-29 19:30:44 -04:00
|
|
|
proxy.postInit();
|
2014-01-28 20:50:29 +11:00
|
|
|
packetPipeline.postInitialise();
|
2013-08-31 05:13:31 -07:00
|
|
|
Behavior.registerBuiltInBehaviors();
|
|
|
|
|
SpecialStackHandler.registerBuiltInStackHandlers();
|
2013-12-13 16:07:26 -05:00
|
|
|
recipes.modIntegration();
|
|
|
|
|
recipes.addOreDictionarySmelteryRecipes();
|
2013-07-26 21:18:53 -07:00
|
|
|
content.createEntities();
|
2013-12-13 16:07:26 -05:00
|
|
|
recipes.modRecipes();
|
2013-11-16 16:34:38 +00:00
|
|
|
|
|
|
|
|
PluginController.getController().postInit();
|
2013-09-28 08:45:28 -07:00
|
|
|
}
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2013-09-28 08:45:28 -07:00
|
|
|
public static LiquidCasting getTableCasting ()
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
|
|
|
|
return tableCasting;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 08:45:28 -07:00
|
|
|
public static LiquidCasting getBasinCasting ()
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
|
|
|
|
return basinCasting;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 08:45:28 -07:00
|
|
|
public static Detailing getChiselDetailing ()
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
|
|
|
|
return chiselDetailing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static TContent content;
|
2013-12-13 16:07:26 -05:00
|
|
|
public static TRecipes recipes;
|
2013-07-26 21:18:53 -07:00
|
|
|
public static TEventHandler events;
|
|
|
|
|
public static TPlayerHandler playerTracker;
|
|
|
|
|
public static LiquidCasting tableCasting;
|
|
|
|
|
public static LiquidCasting basinCasting;
|
|
|
|
|
public static Detailing chiselDetailing;
|
|
|
|
|
}
|