resonant-induction/src/main/java/resonantinduction/ResonantInduction.java

386 lines
16 KiB
Java
Raw Normal View History

2013-08-02 02:17:42 +02:00
package resonantinduction;
2013-08-25 11:15:00 +02:00
import ic2.api.item.Items;
2013-08-02 02:24:57 +02:00
import java.io.File;
2013-08-02 02:38:42 +02:00
import java.util.Arrays;
2014-01-05 07:20:01 +01:00
import java.util.HashMap;
import java.util.Map;
2013-08-02 02:38:42 +02:00
import java.util.logging.Logger;
2013-08-02 02:24:57 +02:00
2013-08-02 02:29:44 +02:00
import net.minecraft.block.Block;
2013-08-02 05:07:56 +02:00
import net.minecraft.item.Item;
2013-08-02 04:03:44 +02:00
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
2014-01-05 07:20:01 +01:00
import net.minecraft.util.Icon;
import net.minecraftforge.client.event.TextureStitchEvent;
2013-08-02 02:24:57 +02:00
import net.minecraftforge.common.Configuration;
2014-01-04 06:18:26 +01:00
import net.minecraftforge.common.MinecraftForge;
2014-01-05 07:20:01 +01:00
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
2013-08-02 05:07:56 +02:00
import net.minecraftforge.oredict.ShapedOreRecipe;
2013-08-25 11:15:00 +02:00
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.modstats.ModstatInfo;
import org.modstats.Modstats;
2014-01-04 15:48:03 +01:00
import resonantinduction.machine.BlockMachinePart;
2014-01-04 05:04:43 +01:00
import resonantinduction.machine.furnace.BlockAdvancedFurnace;
import resonantinduction.machine.furnace.TileAdvancedFurnace;
2014-01-05 08:35:42 +01:00
import resonantinduction.machine.grinder.BlockGrinderWheel;
import resonantinduction.machine.grinder.ItemDust;
2014-01-05 07:20:01 +01:00
import resonantinduction.machine.liquid.BlockFluidMixture;
2014-01-05 07:50:43 +01:00
import resonantinduction.machine.liquid.TileFluidMixture;
2014-01-04 05:04:43 +01:00
import resonantinduction.transport.battery.BlockBattery;
import resonantinduction.transport.battery.ItemBlockBattery;
import resonantinduction.transport.battery.TileBattery;
2014-01-04 16:38:19 +01:00
import resonantinduction.transport.levitator.BlockLevitator;
2014-01-04 05:04:43 +01:00
import resonantinduction.transport.levitator.ItemBlockContractor;
import resonantinduction.transport.levitator.ItemLinker;
import resonantinduction.transport.levitator.TileEMLevitator;
import resonantinduction.transport.tesla.BlockTesla;
import resonantinduction.transport.tesla.TileTesla;
import resonantinduction.transport.transformer.ItemTransformer;
import resonantinduction.transport.wire.EnumWireMaterial;
import resonantinduction.transport.wire.ItemWire;
2014-01-05 06:46:07 +01:00
import resonantinduction.utility.multimeter.ItemMultimeter;
2013-12-19 14:12:46 +01:00
import calclavia.lib.UniversalRecipe;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.network.PacketTile;
2013-12-20 09:29:13 +01:00
import calclavia.lib.prefab.TranslationHelper;
2013-12-23 04:26:39 +01:00
import codechicken.lib.colour.ColourRGBA;
2013-08-02 02:38:42 +02:00
import cpw.mods.fml.common.FMLLog;
2013-08-02 02:24:57 +02:00
import cpw.mods.fml.common.Loader;
2013-08-02 02:17:42 +02:00
import cpw.mods.fml.common.Mod;
2013-08-02 02:29:44 +02:00
import cpw.mods.fml.common.Mod.EventHandler;
2013-08-02 02:20:14 +02:00
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
2013-08-02 02:48:07 +02:00
import cpw.mods.fml.common.SidedProxy;
2013-08-02 02:29:44 +02:00
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
2013-08-02 02:38:42 +02:00
import cpw.mods.fml.common.network.NetworkMod;
2013-08-04 01:43:10 +02:00
import cpw.mods.fml.common.network.NetworkRegistry;
2013-08-02 02:57:56 +02:00
import cpw.mods.fml.common.registry.GameRegistry;
2014-01-05 07:20:01 +01:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
2013-08-02 02:17:42 +02:00
/**
* @author Calclavia
*
*/
2013-12-30 16:03:55 +01:00
@Mod(modid = ResonantInduction.ID, name = ResonantInduction.NAME, version = ResonantInduction.VERSION, dependencies = "required-after:CalclaviaCore;before:ThermalExpansion;before:IC2")
2013-08-02 02:38:42 +02:00
@NetworkMod(channels = ResonantInduction.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
2013-08-06 23:58:17 +02:00
@ModstatInfo(prefix = "resonantin")
2013-08-02 02:17:42 +02:00
public class ResonantInduction
{
2013-08-02 02:24:57 +02:00
/**
* Mod Information
*/
2013-08-02 03:08:46 +02:00
public static final String ID = "resonantinduction";
2013-08-02 02:17:42 +02:00
public static final String NAME = "Resonant Induction";
2013-08-05 21:53:54 +02:00
public static final String CHANNEL = "RESIND";
2013-08-02 02:17:42 +02:00
public static final String MAJOR_VERSION = "@MAJOR@";
public static final String MINOR_VERSION = "@MINOR@";
public static final String REVISION_VERSION = "@REVIS@";
public static final String BUILD_VERSION = "@BUILD@";
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVISION_VERSION;
2013-08-02 02:20:14 +02:00
@Instance(ID)
public static ResonantInduction INSTANCE;
2013-08-02 02:20:14 +02:00
2013-08-02 02:48:07 +02:00
@SidedProxy(clientSide = ID + ".ClientProxy", serverSide = ID + ".CommonProxy")
public static CommonProxy proxy;
2013-08-02 02:20:14 +02:00
@Mod.Metadata(ID)
public static ModMetadata metadata;
2013-08-02 02:24:57 +02:00
2013-08-02 02:38:42 +02:00
public static final Logger LOGGER = Logger.getLogger(NAME);
2013-08-02 02:24:57 +02:00
/**
* Directory Information
*/
public static final String DOMAIN = "resonantinduction";
public static final String PREFIX = DOMAIN + ":";
public static final String DIRECTORY = "/assets/" + DOMAIN + "/";
public static final String TEXTURE_DIRECTORY = "textures/";
2013-08-04 01:43:10 +02:00
public static final String GUI_DIRECTORY = TEXTURE_DIRECTORY + "gui/";
2013-08-02 03:15:02 +02:00
public static final String BLOCK_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + "blocks/";
public static final String ITEM_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + "items/";
2014-01-05 06:26:34 +01:00
public static final String MODEL_PATH = "models/";
public static final String MODEL_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + MODEL_PATH;
public static final String MODEL_DIRECTORY = DIRECTORY + MODEL_PATH;
2013-08-02 02:24:57 +02:00
2013-08-02 04:19:01 +02:00
public static final String LANGUAGE_DIRECTORY = DIRECTORY + "languages/";
public static final String[] LANGUAGES = new String[] { "en_US", "de_DE" };
2013-08-02 02:24:57 +02:00
/**
* Settings
*/
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
public static int FURNACE_WATTAGE = 50000;
2013-08-04 01:11:50 +02:00
public static boolean SOUND_FXS = true;
public static boolean LO_FI_INSULATION = false;
public static boolean SHINY_SILVER = true;
public static boolean REPLACE_FURNACE = true;
2013-08-02 02:24:57 +02:00
2013-08-02 02:29:44 +02:00
/** Block ID by Jyzarc */
private static final int BLOCK_ID_PREFIX = 3200;
/** Item ID by Horfius */
private static final int ITEM_ID_PREFIX = 20150;
2013-08-05 23:20:08 +02:00
public static int MAX_CONTRACTOR_DISTANCE = 200;
2013-08-02 02:29:44 +02:00
private static int NEXT_BLOCK_ID = BLOCK_ID_PREFIX;
private static int NEXT_ITEM_ID = ITEM_ID_PREFIX;
public static int getNextBlockID()
{
return NEXT_BLOCK_ID++;
}
public static int getNextItemID()
{
return NEXT_ITEM_ID++;
}
2013-08-02 15:03:12 +02:00
// Items
2013-12-23 09:18:45 +01:00
/**
2014-01-04 06:18:26 +01:00
* Transport
2013-12-23 09:18:45 +01:00
*/
2014-01-04 06:18:26 +01:00
public static Item itemLinker;
2013-10-09 08:02:46 +02:00
private static Item itemPartWire;
2013-12-23 09:18:45 +01:00
public static Item itemMultimeter;
2013-12-23 14:12:23 +01:00
public static Item itemTransformer;
2014-01-04 06:18:26 +01:00
/**
* Machines
*/
public static Item itemDust;
2013-08-02 02:29:44 +02:00
2013-08-02 15:03:12 +02:00
// Blocks
2014-01-04 15:48:03 +01:00
public static Block blockTesla, blockEMContractor, blockBattery, blockAdvancedFurnace,
2014-01-05 08:35:42 +01:00
blockMachinePart, blockGrinderWheel, blockFluidMixture;
2014-01-05 07:20:01 +01:00
public static Fluid MIXTURE;
2013-09-21 05:20:39 +02:00
2013-12-19 14:12:46 +01:00
/**
* Packets
*/
public static final PacketTile PACKET_TILE = new PacketTile(CHANNEL);
public static final PacketMultiPart PACKET_MULTIPART = new PacketMultiPart(CHANNEL);
2013-12-22 17:55:08 +01:00
public static final ColourRGBA[] DYE_COLORS = new ColourRGBA[] { new ColourRGBA(255, 255, 255, 255), new ColourRGBA(1, 0, 0, 1d), new ColourRGBA(0, 0.608, 0.232, 1d), new ColourRGBA(0.588, 0.294, 0, 1d), new ColourRGBA(0, 0, 1, 1d), new ColourRGBA(0.5, 0, 05, 1d), new ColourRGBA(0, 1, 1, 1d), new ColourRGBA(0.8, 0.8, 0.8, 1d), new ColourRGBA(0.3, 0.3, 0.3, 1d), new ColourRGBA(1, 0.412, 0.706, 1d), new ColourRGBA(0.616, 1, 0, 1d), new ColourRGBA(1, 1, 0, 1d), new ColourRGBA(0.46f, 0.932, 1, 1d), new ColourRGBA(0.5, 0.2, 0.5, 1d), new ColourRGBA(0.7, 0.5, 0.1, 1d), new ColourRGBA(1, 1, 1, 1d) };
2013-08-02 02:29:44 +02:00
@EventHandler
public void preInit(FMLPreInitializationEvent evt)
{
2013-08-02 02:38:42 +02:00
LOGGER.setParent(FMLLog.getLogger());
2013-08-04 03:38:12 +02:00
NetworkRegistry.instance().registerGuiHandler(this, ResonantInduction.proxy);
2013-08-06 23:58:17 +02:00
Modstats.instance().getReporter().registerMod(this);
2013-08-02 02:48:07 +02:00
CONFIGURATION.load();
2013-08-02 15:03:12 +02:00
2013-08-02 15:06:32 +02:00
// Config
2013-12-20 09:29:13 +01:00
FURNACE_WATTAGE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage Per Tick", FURNACE_WATTAGE).getInt(FURNACE_WATTAGE);
2013-08-04 01:11:50 +02:00
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
LO_FI_INSULATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Use lo-fi insulation texture", LO_FI_INSULATION).getBoolean(LO_FI_INSULATION);
SHINY_SILVER = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", SHINY_SILVER).getBoolean(SHINY_SILVER);
2013-08-05 23:20:08 +02:00
MAX_CONTRACTOR_DISTANCE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MAX_CONTRACTOR_DISTANCE).getInt(MAX_CONTRACTOR_DISTANCE);
REPLACE_FURNACE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Replace vanilla furnace", REPLACE_FURNACE).getBoolean(REPLACE_FURNACE);
2013-08-04 03:38:12 +02:00
2013-12-23 14:40:20 +01:00
TileEMLevitator.ACCELERATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Acceleration", TileEMLevitator.ACCELERATION).getDouble(TileEMLevitator.ACCELERATION);
TileEMLevitator.MAX_REACH = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Reach", TileEMLevitator.MAX_REACH).getInt(TileEMLevitator.MAX_REACH);
TileEMLevitator.MAX_SPEED = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Speed", TileEMLevitator.MAX_SPEED).getDouble(TileEMLevitator.MAX_SPEED);
TileEMLevitator.PUSH_DELAY = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Push Delay", TileEMLevitator.PUSH_DELAY).getInt(TileEMLevitator.PUSH_DELAY);
2013-08-04 01:19:20 +02:00
2013-08-02 15:06:32 +02:00
// Items
2013-08-04 16:20:45 +02:00
itemLinker = new ItemLinker(getNextItemID());
2013-12-22 06:45:21 +01:00
itemPartWire = new ItemWire(getNextItemID());
2013-12-23 09:18:45 +01:00
itemMultimeter = new ItemMultimeter(getNextItemID());
itemTransformer = new ItemTransformer(getNextItemID());
2014-01-04 06:18:26 +01:00
itemDust = new ItemDust(getNextItemID());
2013-08-04 04:23:06 +02:00
2013-08-02 15:06:32 +02:00
// Blocks
2013-08-02 02:48:07 +02:00
blockTesla = new BlockTesla(getNextBlockID());
2014-01-04 16:38:19 +01:00
blockEMContractor = new BlockLevitator(getNextBlockID());
2013-12-23 13:45:37 +01:00
blockBattery = new BlockBattery(getNextBlockID());
2014-01-04 15:48:03 +01:00
blockMachinePart = new BlockMachinePart(getNextBlockID());
2014-01-05 08:35:42 +01:00
blockGrinderWheel = new BlockGrinderWheel(getNextBlockID());
2013-10-09 08:02:46 +02:00
2014-01-05 07:20:01 +01:00
MIXTURE = new Fluid("mixture");
FluidRegistry.registerFluid(MIXTURE);
blockFluidMixture = new BlockFluidMixture(getNextBlockID(), MIXTURE);
if (REPLACE_FURNACE)
{
2013-12-20 17:01:30 +01:00
blockAdvancedFurnace = BlockAdvancedFurnace.createNew(false);
GameRegistry.registerBlock(blockAdvancedFurnace, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
2013-12-23 10:56:25 +01:00
GameRegistry.registerTileEntity(TileAdvancedFurnace.class, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
}
2013-08-04 01:43:10 +02:00
CONFIGURATION.save();
2013-08-04 01:19:20 +02:00
2013-08-07 01:24:24 +02:00
GameRegistry.registerItem(itemLinker, itemLinker.getUnlocalizedName());
2013-12-23 09:18:45 +01:00
GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName());
GameRegistry.registerItem(itemTransformer, itemTransformer.getUnlocalizedName());
2014-01-04 06:18:26 +01:00
GameRegistry.registerItem(itemDust, itemDust.getUnlocalizedName());
2013-08-07 01:46:08 +02:00
2014-01-05 07:20:01 +01:00
GameRegistry.registerBlock(blockFluidMixture, blockFluidMixture.getUnlocalizedName());
2014-01-04 21:10:47 +01:00
GameRegistry.registerBlock(blockMachinePart, blockMachinePart.getUnlocalizedName());
2013-08-02 02:57:56 +02:00
GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName());
2013-08-03 19:41:37 +02:00
GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName());
2013-12-23 14:12:23 +01:00
GameRegistry.registerBlock(blockBattery, ItemBlockBattery.class, blockBattery.getUnlocalizedName());
2013-10-09 08:02:46 +02:00
2013-08-02 15:06:32 +02:00
// Tiles
2013-12-23 14:40:20 +01:00
GameRegistry.registerTileEntity(TileTesla.class, blockTesla.getUnlocalizedName());
GameRegistry.registerTileEntity(TileEMLevitator.class, blockEMContractor.getUnlocalizedName());
GameRegistry.registerTileEntity(TileBattery.class, blockBattery.getUnlocalizedName());
2014-01-05 07:50:43 +01:00
GameRegistry.registerTileEntity(TileFluidMixture.class, blockFluidMixture.getUnlocalizedName());
2013-10-09 08:02:46 +02:00
ResonantInduction.proxy.registerRenderers();
2013-08-02 04:03:44 +02:00
2013-10-09 08:02:46 +02:00
/**
* Set reference itemstacks
*/
2013-12-24 07:20:16 +01:00
TabRI.ITEMSTACK = new ItemStack(blockBattery);
2013-10-09 08:02:46 +02:00
2013-12-20 17:01:30 +01:00
for (EnumWireMaterial material : EnumWireMaterial.values())
2013-10-09 08:02:46 +02:00
{
2013-12-20 17:01:30 +01:00
material.setWire(itemPartWire);
2013-10-09 08:02:46 +02:00
}
2014-01-04 06:18:26 +01:00
MinecraftForge.EVENT_BUS.register(itemDust);
2013-08-02 02:29:44 +02:00
}
@EventHandler
public void init(FMLInitializationEvent evt)
{
LOGGER.fine("Languages Loaded:" + TranslationHelper.loadLanguages(LANGUAGE_DIRECTORY, LANGUAGES));
// TODO localize this
2013-08-02 02:38:42 +02:00
metadata.modId = ID;
metadata.name = NAME;
metadata.description = TranslationHelper.getLocal("meta.resonantinduction.description");
2013-08-05 18:33:09 +02:00
metadata.url = "http://universalelectricity.com/resonant-induction";
2013-08-07 01:24:24 +02:00
metadata.logoFile = "/ri_logo.png";
2013-08-02 02:38:42 +02:00
metadata.version = VERSION + BUILD_VERSION;
metadata.authorList = Arrays.asList(new String[] { "Calclavia", "Aidancbrady" });
metadata.credits = TranslationHelper.getLocal("meta.resonantinduction.credits");
2013-08-07 01:24:24 +02:00
metadata.autogenerated = false;
2013-12-21 12:02:12 +01:00
MultipartRI.INSTANCE = new MultipartRI();
UniversalRecipe.init();
2013-08-02 02:29:44 +02:00
}
@EventHandler
2013-08-03 08:55:44 +02:00
public void postInit(FMLPostInitializationEvent evt)
2013-08-02 02:29:44 +02:00
{
2013-08-02 05:07:56 +02:00
/**
* Recipes
*/
2013-10-09 08:02:46 +02:00
final ItemStack defaultWire = EnumWireMaterial.IRON.getWire();
2013-08-12 13:05:59 +02:00
2013-08-05 05:50:59 +02:00
/** Linker **/
2013-12-21 12:02:12 +01:00
GameRegistry.addRecipe(new ShapedOreRecipe(itemLinker, " E ", "GCG", " E ", 'E', Item.eyeOfEnder, 'C', UniversalRecipe.BATTERY.get(), 'G', UniversalRecipe.SECONDARY_METAL.get()));
2013-08-05 05:50:59 +02:00
/** Tesla - by Jyzarc */
2013-12-21 12:02:12 +01:00
GameRegistry.addRecipe(new ShapedOreRecipe(blockTesla, "WEW", " C ", " I ", 'W', defaultWire, 'E', Item.eyeOfEnder, 'C', UniversalRecipe.BATTERY.get(), 'I', UniversalRecipe.PRIMARY_PLATE.get()));
2013-08-05 05:50:59 +02:00
/** Multimeter */
2013-12-23 09:18:45 +01:00
GameRegistry.addRecipe(new ShapedOreRecipe(itemMultimeter, "WWW", "ICI", 'W', defaultWire, 'C', UniversalRecipe.BATTERY.get(), 'I', UniversalRecipe.PRIMARY_METAL.get()));
2013-08-05 05:50:59 +02:00
2013-12-21 12:02:12 +01:00
/** Battery */
2013-12-23 13:45:37 +01:00
GameRegistry.addRecipe(new ShapedOreRecipe(blockBattery, "III", "IRI", "III", 'R', Block.blockRedstone, 'I', UniversalRecipe.PRIMARY_METAL.get()));
2013-08-05 05:50:59 +02:00
/** EM Contractor */
2013-12-21 12:02:12 +01:00
GameRegistry.addRecipe(new ShapedOreRecipe(blockEMContractor, " I ", "GCG", "WWW", 'W', UniversalRecipe.PRIMARY_METAL.get(), 'C', UniversalRecipe.BATTERY.get(), 'G', UniversalRecipe.SECONDARY_METAL.get(), 'I', UniversalRecipe.PRIMARY_METAL.get()));
2013-08-07 05:34:06 +02:00
/** Wires **/
2013-10-09 08:02:46 +02:00
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper"));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.TIN.getWire(3), "MMM", 'M', "ingotTin"));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.IRON.getWire(3), "MMM", 'M', Item.ingotIron));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.ALUMINUM.getWire(3), "MMM", 'M', "ingotAluminum"));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SILVER.getWire(), "MMM", 'M', "ingotSilver"));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", 'M', "ingotSuperconductor"));
2013-10-09 08:17:51 +02:00
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", "MEM", "MMM", 'M', Item.ingotGold, 'E', Item.eyeOfEnder));
2013-08-07 05:34:06 +02:00
2013-08-25 11:15:00 +02:00
/** Wire Compatiblity **/
if (Loader.isModLoaded("IC2"))
{
2013-10-09 08:02:46 +02:00
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire(), Items.getItem("copperCableItem")));
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.TIN.getWire(), Items.getItem("tinCableItem")));
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.IRON.getWire(), Items.getItem("ironCableItem")));
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(), Items.getItem("glassFiberCableItem")));
2013-08-25 11:15:00 +02:00
}
if (Loader.isModLoaded("Mekanism"))
{
2013-10-09 08:02:46 +02:00
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire(), "universalCable"));
}
2014-01-04 06:18:26 +01:00
/** Auto-gen dusts */
ItemDust.postInit();
2014-01-04 15:38:57 +01:00
ResonantInduction.proxy.postInit();
2014-01-04 06:18:26 +01:00
/** Inject new furnace tile class */
2013-12-23 10:56:25 +01:00
replaceTileEntity(TileEntityFurnace.class, TileAdvancedFurnace.class);
}
public static void replaceTileEntity(Class<? extends TileEntity> findTile, Class<? extends TileEntity> replaceTile)
{
try
{
Map<String, Class> nameToClassMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_a", "nameToClassMap", "a");
Map<Class, String> classToNameMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_b", "classToNameMap", "b");
String findTileID = classToNameMap.get(findTile);
if (findTileID != null)
{
nameToClassMap.put(findTileID, replaceTile);
classToNameMap.put(replaceTile, findTileID);
classToNameMap.remove(findTile);
2013-09-21 05:20:39 +02:00
LOGGER.fine("Replaced TileEntity: " + findTile);
}
else
{
LOGGER.severe("Failed to replace TileEntity: " + findTile);
}
}
catch (Exception e)
{
LOGGER.severe("Failed to replace TileEntity: " + findTile);
e.printStackTrace();
}
2013-08-02 02:29:44 +02:00
}
2014-01-05 07:20:01 +01:00
public static final HashMap<String, Icon> fluidIconMap = new HashMap<String, Icon>();
public void registerIcon(String name, TextureStitchEvent.Pre event)
{
fluidIconMap.put(name, event.map.registerIcon(name));
}
@ForgeSubscribe
@SideOnly(Side.CLIENT)
public void preTextureHook(TextureStitchEvent.Pre event)
{
if (event.map.textureType == 0)
{
registerIcon(PREFIX + "mixture", event);
}
}
@ForgeSubscribe
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Post event)
{
MIXTURE.setIcons(fluidIconMap.get(PREFIX + "mixture"));
}
2013-08-02 02:17:42 +02:00
}