2012-08-11 07:46:49 +02:00
|
|
|
package cpw.mods.ironchest;
|
|
|
|
|
|
2012-08-13 07:24:25 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2014-02-05 19:06:35 +01:00
|
|
|
import net.minecraftforge.common.config.Configuration;
|
2014-08-03 21:57:08 +02:00
|
|
|
|
2014-02-05 19:06:35 +01:00
|
|
|
import org.apache.logging.log4j.Level;
|
2014-08-03 21:57:08 +02:00
|
|
|
|
2012-08-11 07:46:49 +02:00
|
|
|
import cpw.mods.fml.common.FMLLog;
|
|
|
|
|
import cpw.mods.fml.common.Mod;
|
2013-07-02 19:54:03 +02:00
|
|
|
import cpw.mods.fml.common.Mod.EventHandler;
|
2012-08-11 07:46:49 +02:00
|
|
|
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.FMLPreInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
|
|
2014-06-26 02:04:18 +02:00
|
|
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[10.10,);required-after:FML@[7.2,)")
|
2012-08-11 07:46:49 +02:00
|
|
|
public class IronChest {
|
2012-12-18 17:22:21 +01:00
|
|
|
public static BlockIronChest ironChestBlock;
|
|
|
|
|
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
|
|
|
|
public static CommonProxy proxy;
|
|
|
|
|
@Instance("IronChest")
|
|
|
|
|
public static IronChest instance;
|
|
|
|
|
public static boolean CACHE_RENDER = true;
|
|
|
|
|
public static boolean OCELOTS_SITONCHESTS = true;
|
2012-08-11 07:46:49 +02:00
|
|
|
|
2013-07-02 19:54:03 +02:00
|
|
|
@EventHandler
|
2012-12-18 17:22:21 +01:00
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
|
{
|
|
|
|
|
Version.init(event.getVersionProperties());
|
|
|
|
|
event.getModMetadata().version = Version.fullVersionString();
|
|
|
|
|
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
cfg.load();
|
2014-02-05 19:06:35 +01:00
|
|
|
ChestChangerType.buildItems(cfg);
|
2012-12-18 17:22:21 +01:00
|
|
|
CACHE_RENDER = cfg.get(Configuration.CATEGORY_GENERAL, "cacheRenderingInformation", true).getBoolean(true);
|
|
|
|
|
OCELOTS_SITONCHESTS = cfg.get(Configuration.CATEGORY_GENERAL, "ocelotsSitOnChests", true).getBoolean(true);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2014-03-31 02:48:46 +02:00
|
|
|
FMLLog.log(Level.ERROR, e, "IronChest has a problem loading its configuration");
|
2012-12-18 17:22:21 +01:00
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
2013-07-02 19:54:03 +02:00
|
|
|
if (cfg.hasChanged())
|
|
|
|
|
cfg.save();
|
2012-12-18 17:22:21 +01:00
|
|
|
}
|
2014-02-05 19:06:35 +01:00
|
|
|
ironChestBlock = new BlockIronChest();
|
2013-07-02 19:54:03 +02:00
|
|
|
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
2014-02-05 19:06:35 +01:00
|
|
|
PacketHandler.INSTANCE.ordinal();
|
2012-12-18 17:22:21 +01:00
|
|
|
}
|
2012-08-11 07:46:49 +02:00
|
|
|
|
2013-07-02 19:54:03 +02:00
|
|
|
@EventHandler
|
2012-12-18 17:22:21 +01:00
|
|
|
public void load(FMLInitializationEvent evt)
|
|
|
|
|
{
|
|
|
|
|
for (IronChestType typ : IronChestType.values())
|
|
|
|
|
{
|
2013-01-22 22:17:22 +01:00
|
|
|
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest."+typ.name(), typ.name());
|
2012-12-18 17:22:21 +01:00
|
|
|
proxy.registerTileEntitySpecialRenderer(typ);
|
|
|
|
|
}
|
2013-04-11 14:43:34 +02:00
|
|
|
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
2012-12-18 17:22:21 +01:00
|
|
|
ChestChangerType.generateRecipes();
|
2014-02-05 19:06:35 +01:00
|
|
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
2012-12-18 17:22:21 +01:00
|
|
|
proxy.registerRenderInformation();
|
|
|
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-11 07:46:49 +02:00
|
|
|
}
|