2014-09-24 14:32:58 +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;
|
|
|
|
|
2014-09-26 01:40:09 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2014-09-24 14:32:58 +02:00
|
|
|
import net.minecraft.init.Blocks;
|
2014-12-02 21:25:03 +01:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2014-09-24 14:32:58 +02:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
|
|
|
import net.minecraftforge.fml.common.Mod.Instance;
|
|
|
|
import net.minecraftforge.fml.common.SidedProxy;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
2014-11-26 12:55:24 +01:00
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
2015-01-27 00:13:38 +01:00
|
|
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
2014-09-24 14:32:58 +02:00
|
|
|
|
2014-09-24 15:46:42 +02:00
|
|
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:FML@[7.2,)")
|
2014-09-26 01:40:09 +02:00
|
|
|
public class IronChest
|
|
|
|
{
|
2014-09-24 14:32:58 +02: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;
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
{
|
|
|
|
Version.init(event.getVersionProperties());
|
|
|
|
event.getModMetadata().version = Version.fullVersionString();
|
2014-09-25 04:40:29 +02:00
|
|
|
|
|
|
|
PacketHandler.INSTANCE.ordinal();
|
2014-09-24 14:32:58 +02:00
|
|
|
}
|
|
|
|
|
2014-09-25 04:40:29 +02:00
|
|
|
@EventHandler
|
2014-09-24 14:32:58 +02:00
|
|
|
public void load(FMLInitializationEvent evt)
|
|
|
|
{
|
2014-09-26 01:40:09 +02:00
|
|
|
//Registration has been moved to init to account for the registration of inventory models
|
|
|
|
//Minecraft.getRenderItem() returns null before this stage
|
|
|
|
ChestChangerType.buildItems();
|
|
|
|
ironChestBlock = new BlockIronChest();
|
2014-09-27 03:31:58 +02:00
|
|
|
RegistryHelper.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
|
|
|
|
2015-01-29 17:47:46 +01:00
|
|
|
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getBlockModelShapes().registerBuiltInBlocks(ironChestBlock);
|
2014-09-26 01:40:09 +02:00
|
|
|
|
2014-09-24 14:32:58 +02:00
|
|
|
for (IronChestType typ : IronChestType.values())
|
|
|
|
{
|
2014-09-25 04:40:29 +02:00
|
|
|
GameRegistry.registerTileEntityWithAlternatives(typ.clazz, "IronChest." + typ.name(), typ.name());
|
2014-09-24 14:32:58 +02:00
|
|
|
proxy.registerTileEntitySpecialRenderer(typ);
|
|
|
|
}
|
2014-11-26 12:55:24 +01:00
|
|
|
OreDictionary.registerOre("chestWood", Blocks.chest);
|
2014-09-26 02:03:18 +02:00
|
|
|
IronChestType.registerBlocksAndRecipes(ironChestBlock);
|
|
|
|
ChestChangerType.generateRecipes();
|
2014-09-24 14:32:58 +02:00
|
|
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
|
|
|
proxy.registerRenderInformation();
|
2014-12-02 21:25:03 +01:00
|
|
|
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
2014-09-25 04:40:29 +02:00
|
|
|
}
|
2014-09-24 14:32:58 +02:00
|
|
|
}
|