2012-08-11 07:46:49 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2012 cpw.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the GNU Public License v3.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.gnu.org/licenses/gpl.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* cpw - initial API and implementation
|
|
|
|
******************************************************************************/
|
|
|
|
package cpw.mods.ironchest;
|
|
|
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
2013-01-22 22:17:22 +01:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2012-08-11 07:46:49 +02:00
|
|
|
import net.minecraftforge.common.Configuration;
|
2012-08-13 07:24:25 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2012-12-18 17:22:21 +01:00
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
2012-08-11 07:46:49 +02:00
|
|
|
import cpw.mods.fml.common.FMLLog;
|
|
|
|
import cpw.mods.fml.common.Mod;
|
|
|
|
import cpw.mods.fml.common.Mod.Init;
|
|
|
|
import cpw.mods.fml.common.Mod.Instance;
|
|
|
|
import cpw.mods.fml.common.Mod.PostInit;
|
|
|
|
import cpw.mods.fml.common.Mod.PreInit;
|
|
|
|
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.NetworkMod;
|
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
|
|
|
2013-03-10 00:07:20 +01:00
|
|
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[7.0,);required-after:FML@[5.0.5,)")
|
|
|
|
@NetworkMod(channels = { "IronChest" }, versionBounds = "[5.2,)", clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
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;
|
|
|
|
private int blockId;
|
2012-08-11 07:46:49 +02:00
|
|
|
|
2012-12-18 17:22:21 +01:00
|
|
|
@PreInit
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
{
|
|
|
|
Version.init(event.getVersionProperties());
|
|
|
|
event.getModMetadata().version = Version.fullVersionString();
|
|
|
|
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
|
|
|
try
|
|
|
|
{
|
|
|
|
cfg.load();
|
2012-12-19 14:43:19 +01:00
|
|
|
blockId = cfg.getBlock("ironChests", 975).getInt(975);
|
|
|
|
ChestChangerType.buildItems(cfg, 19501);
|
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)
|
|
|
|
{
|
|
|
|
FMLLog.log(Level.SEVERE, e, "IronChest has a problem loading it's configuration");
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
cfg.save();
|
|
|
|
}
|
|
|
|
}
|
2012-08-11 07:46:49 +02:00
|
|
|
|
2012-12-18 17:22:21 +01:00
|
|
|
@Init
|
|
|
|
public void load(FMLInitializationEvent evt)
|
|
|
|
{
|
|
|
|
ironChestBlock = new BlockIronChest(blockId);
|
2012-12-19 14:43:19 +01:00
|
|
|
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
2012-12-18 17:22:21 +01:00
|
|
|
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
|
|
|
LanguageRegistry.instance().addStringLocalization(typ.name() + ".name", "en_US", typ.friendlyName);
|
|
|
|
proxy.registerTileEntitySpecialRenderer(typ);
|
|
|
|
}
|
|
|
|
for (ChestChangerType typ : ChestChangerType.values())
|
|
|
|
{
|
|
|
|
LanguageRegistry.instance().addStringLocalization("item." + typ.itemName + ".name", "en_US", typ.descriptiveName);
|
|
|
|
}
|
|
|
|
IronChestType.generateTieredRecipes(ironChestBlock);
|
|
|
|
ChestChangerType.generateRecipes();
|
|
|
|
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
|
|
|
|
proxy.registerRenderInformation();
|
|
|
|
if (OCELOTS_SITONCHESTS)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
|
|
|
}
|
|
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostInit
|
|
|
|
public void modsLoaded(FMLPostInitializationEvent evt)
|
|
|
|
{
|
|
|
|
}
|
2012-08-11 07:46:49 +02:00
|
|
|
|
|
|
|
}
|