2013-08-02 02:17:42 +02:00
package resonantinduction ;
2013-08-02 02:24:57 +02:00
import java.io.File ;
2013-08-02 02:38:42 +02:00
import java.util.Arrays ;
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 ;
2013-08-02 02:24:57 +02:00
import net.minecraftforge.common.Configuration ;
2013-08-02 05:07:56 +02:00
import net.minecraftforge.oredict.ShapedOreRecipe ;
2013-08-03 04:18:03 +02:00
import resonantinduction.contractor.BlockEMContractor ;
2013-08-03 19:41:37 +02:00
import resonantinduction.contractor.ItemBlockContractor ;
2013-08-03 04:18:03 +02:00
import resonantinduction.contractor.TileEntityEMContractor ;
2013-08-02 07:25:41 +02:00
import resonantinduction.entangler.ItemQuantumEntangler ;
2013-08-02 02:57:56 +02:00
import resonantinduction.tesla.BlockTesla ;
import resonantinduction.tesla.TileEntityTesla ;
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 ;
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-02 02:57:56 +02:00
import cpw.mods.fml.common.registry.GameRegistry ;
2013-08-02 02:38:42 +02:00
import cpw.mods.fml.common.registry.LanguageRegistry ;
2013-08-02 02:17:42 +02:00
/ * *
* @author Calclavia
*
* /
@Mod ( modid = ResonantInduction . ID , name = ResonantInduction . NAME , version = ResonantInduction . VERSION )
2013-08-02 02:38:42 +02:00
@NetworkMod ( channels = ResonantInduction . CHANNEL , clientSideRequired = true , serverSideRequired = false , packetHandler = PacketHandler . class )
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-02 07:25:41 +02:00
public static final String CHANNEL = " R_INDUC " ;
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 INSTNACE ;
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/ " ;
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/ " ;
public static final String MODEL_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + " models/ " ;
2013-08-02 02:24:57 +02:00
2013-08-02 04:19:01 +02:00
public static final String LANGUAGE_DIRECTORY = DIRECTORY + " languages/ " ;
2013-08-02 02:24:57 +02:00
public static final String [ ] LANGUAGES = new String [ ] { " en_US " } ;
/ * *
* Settings
* /
public static final Configuration CONFIGURATION = new Configuration ( new File ( Loader . instance ( ) . getConfigDir ( ) , NAME + " .cfg " ) ) ;
2013-08-03 05:35:55 +02:00
public static float POWER_PER_COAL = 8 ;
2013-08-04 01:11:50 +02:00
public static boolean SOUND_FXS = 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 ;
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-08-02 07:25:41 +02:00
public static Item itemQuantumEntangler ;
2013-08-02 02:29:44 +02:00
2013-08-02 15:03:12 +02:00
// Blocks
2013-08-02 02:29:44 +02:00
public static Block blockTesla ;
2013-08-03 04:18:03 +02:00
public static Block blockEMContractor ;
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-02 02:29:44 +02:00
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-08-02 03:52:12 +02:00
POWER_PER_COAL = ( float ) CONFIGURATION . get ( Configuration . CATEGORY_GENERAL , " Coal Wattage " , POWER_PER_COAL ) . getDouble ( POWER_PER_COAL ) ;
2013-08-04 01:11:50 +02:00
SOUND_FXS = CONFIGURATION . get ( Configuration . CATEGORY_GENERAL , " Tesla Sound FXs " , SOUND_FXS ) . getBoolean ( SOUND_FXS ) ;
2013-08-02 15:06:32 +02:00
// Items
2013-08-02 07:25:41 +02:00
itemQuantumEntangler = new ItemQuantumEntangler ( getNextItemID ( ) ) ;
GameRegistry . registerItem ( itemQuantumEntangler , itemQuantumEntangler . getUnlocalizedName ( ) ) ;
2013-08-02 15:03:12 +02:00
2013-08-02 15:06:32 +02:00
// Blocks
2013-08-02 02:48:07 +02:00
blockTesla = new BlockTesla ( getNextBlockID ( ) ) ;
2013-08-02 02:57:56 +02:00
GameRegistry . registerBlock ( blockTesla , blockTesla . getUnlocalizedName ( ) ) ;
2013-08-03 03:50:14 +02:00
2013-08-03 04:18:03 +02:00
blockEMContractor = new BlockEMContractor ( getNextBlockID ( ) ) ;
2013-08-03 19:41:37 +02:00
GameRegistry . registerBlock ( blockEMContractor , ItemBlockContractor . class , blockEMContractor . getUnlocalizedName ( ) ) ;
2013-08-02 15:03:12 +02:00
2013-08-02 07:25:41 +02:00
CONFIGURATION . save ( ) ;
2013-08-02 15:03:12 +02:00
2013-08-02 15:06:32 +02:00
// Tiles
2013-08-02 02:57:56 +02:00
GameRegistry . registerTileEntity ( TileEntityTesla . class , blockTesla . getUnlocalizedName ( ) ) ;
2013-08-03 04:18:03 +02:00
GameRegistry . registerTileEntity ( TileEntityEMContractor . class , blockEMContractor . getUnlocalizedName ( ) ) ;
2013-08-02 07:25:41 +02:00
2013-08-02 06:31:06 +02:00
ResonantInduction . proxy . registerRenderers ( ) ;
2013-08-02 04:03:44 +02:00
TabRI . ITEMSTACK = new ItemStack ( blockTesla ) ;
2013-08-02 02:29:44 +02:00
}
@EventHandler
public void init ( FMLInitializationEvent evt )
{
2013-08-02 04:03:44 +02:00
LOGGER . fine ( " Languages Loaded: " + loadLanguages ( LANGUAGE_DIRECTORY , LANGUAGES ) ) ;
2013-08-02 02:38:42 +02:00
metadata . modId = ID ;
metadata . name = NAME ;
metadata . description = " Resonant Induction is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place! " ;
metadata . url = " http://universalelectricity.com " ;
metadata . version = VERSION + BUILD_VERSION ;
metadata . authorList = Arrays . asList ( new String [ ] { " Calclavia " , " Aidancbrady " } ) ;
2013-08-02 04:03:44 +02:00
metadata . logoFile = " / " ;
metadata . credits = " Thanks to Archadia for the assets. " ;
2013-08-02 02:38:42 +02:00
metadata . autogenerated = true ;
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
* /
/** by Jyzarc */
GameRegistry . addRecipe ( new ShapedOreRecipe ( blockTesla , " EEE " , " C " , " I " , 'E' , Item . eyeOfEnder , 'C' , Item . redstone , 'I' , Block . blockIron ) ) ;
2013-08-02 02:29:44 +02:00
}
2013-08-02 02:38:42 +02:00
public static int loadLanguages ( String languagePath , String [ ] languageSupported )
{
int loaded = 0 ;
for ( String language : languageSupported )
{
LanguageRegistry . instance ( ) . loadLocalization ( languagePath + language + " .properties " , language , false ) ;
loaded + + ;
}
return loaded ;
}
2013-08-02 02:17:42 +02:00
}