Class ModLoader

java.lang.Object
  extended by ModLoader

public final class ModLoader
extends java.lang.Object

ModLoader loads classes that inherit from BaseMod and adds them to a list for use.

Version:
Beta 1.1_02

Field Summary
static boolean texturesOverridden
          Whether RegisterAllTextureOverrides has already run.
 
Method Summary
static int AddAllFuel(int id)
          Used for adding new sources of fuel to the furnace.
static void AddAllRecipes(eu recipes)
          Used to add recipes from all the mods.
static void AddAllRenderers(java.util.Map<java.lang.Class<? extends mn>,at> renderers)
          Used to add all mod entity renderers.
static int AddAllSmelting(int id)
          Used for adding new options to the furnace for item creation.
static void addAnimation(ae anim)
          Registers one animation instance.
static void AddName(java.lang.Object instance, java.lang.String name)
          This method will allow adding name to item in inventory.
static void addOverride(java.lang.String path, java.lang.String overlayPath, int index)
          Registers one texture override to be done.
static net.minecraft.client.Minecraft getMinecraftInstance()
          Use this method to get a reference to Minecraft instance.
static
<T> T
getPrivateValue(java.lang.Object instance, int fieldindex)
          Used for getting value of private fields.
static
<T> T
getPrivateValue(java.lang.Object instance, java.lang.String field)
          Used for getting value of private fields.
static int getUniqueEntityId()
          Gets next Entity ID to use.
static int getUniqueSpriteIndex(java.lang.String path)
          Gets next available index for this sprite map.
static boolean isGUIOpen(java.lang.Class<? extends br> gui)
          Use this method to check if GUI is opened for the player.
static boolean isModLoaded(java.lang.String mod)
          Checks if a mod is loaded.
static void OpenModGUI(ei player, java.lang.Object instance)
          Opens GUI for use with mods.
static void PopulateChunk(bf generator, int chunkX, int chunkZ, dd world)
          Used for generating new blocks in the world.
static void RegisterAllTextureOverrides(ge texCache)
          Processes all registered texture overrides, modifies internal buffers.
static void RegisterBlock(og block)
          Adds block to list of blocks the player can use.
static void RegisterEntityID(java.lang.Class<? extends mn> entityClass, java.lang.String entityName, int id)
          Registers an entity ID.
static void RegisterTileEntity(java.lang.Class<? extends jx> tileEntityClass, java.lang.String id)
          Registers a tile entity.
static void RunOSDHooks(net.minecraft.client.Minecraft game)
          Runs all registered OSD hooks, run by GUIInGame.
static
<T> void
setPrivateValue(java.lang.Object instance, int fieldindex, T value)
          Used for setting value of private fields.
static
<T> void
setPrivateValue(java.lang.Object instance, java.lang.String field, T value)
          Used for setting value of private fields.
static void ThrowException(java.lang.String message, java.lang.Throwable e)
          Used for catching an error and generating an error report.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

texturesOverridden

public static boolean texturesOverridden
Whether RegisterAllTextureOverrides has already run.

Method Detail

ThrowException

public static void ThrowException(java.lang.String message,
                                  java.lang.Throwable e)
Used for catching an error and generating an error report.

Parameters:
message - Title of error report.
e - Exception to report.

AddAllFuel

public static int AddAllFuel(int id)
Used for adding new sources of fuel to the furnace.

Parameters:
id - ItemID for the item to use as fuel.
Returns:
Duration of fuel provided.
See Also:
BaseMod.AddFuel(int)

AddAllRecipes

public static void AddAllRecipes(eu recipes)
Used to add recipes from all the mods.

Parameters:
recipes - Recipe instance to add to.
See Also:
BaseMod.AddRecipes(eu)

AddAllRenderers

public static void AddAllRenderers(java.util.Map<java.lang.Class<? extends mn>,at> renderers)
Used to add all mod entity renderers.

Parameters:
renderers - HashMap of the renderers. key is an entity class, value is the renderer.
See Also:
BaseMod.AddRenderer(java.util.Map, at>)

AddAllSmelting

public static int AddAllSmelting(int id)
Used for adding new options to the furnace for item creation.

Parameters:
id - ItemID of the input item.
Returns:
ItemID of the output item.
See Also:
BaseMod.AddSmelting(int)

addAnimation

public static void addAnimation(ae anim)
Registers one animation instance.

Parameters:
anim - instance of animation handler.

addOverride

public static void addOverride(java.lang.String path,
                               java.lang.String overlayPath,
                               int index)
Registers one texture override to be done.

Parameters:
path - Path to the texture file to modify.
overlayPath - Path to the texture file which is to be overlaid.
index - Sprite index into the texture to be modified.

getMinecraftInstance

public static net.minecraft.client.Minecraft getMinecraftInstance()
Use this method to get a reference to Minecraft instance.

Returns:
Minecraft instance.

getPrivateValue

public static <T> T getPrivateValue(java.lang.Object instance,
                                    int fieldindex)
                         throws java.lang.SecurityException,
                                java.lang.NoSuchFieldException
Used for getting value of private fields.

Type Parameters:
T - Return type.
Parameters:
instance - Object to get private field from.
fieldindex - Name of the field.
Returns:
Value of private field.
Throws:
java.lang.SecurityException - if the thread is not allowed to access field.
java.lang.NoSuchFieldException - if field does not exist.

getPrivateValue

public static <T> T getPrivateValue(java.lang.Object instance,
                                    java.lang.String field)
                         throws java.lang.SecurityException,
                                java.lang.NoSuchFieldException
Used for getting value of private fields.

Type Parameters:
T - Return type.
Parameters:
instance - Object to get private field from.
field - Name of the field.
Returns:
Value of private field.
Throws:
java.lang.SecurityException - if the thread is not allowed to access field.
java.lang.NoSuchFieldException - if field does not exist.

getUniqueEntityId

public static int getUniqueEntityId()
Gets next Entity ID to use.

Returns:
Assigned ID.

getUniqueSpriteIndex

public static int getUniqueSpriteIndex(java.lang.String path)
Gets next available index for this sprite map.

Parameters:
path - Sprite map to get available index from.
Returns:
Assigned sprite index to use.

isModLoaded

public static boolean isModLoaded(java.lang.String mod)
Checks if a mod is loaded.

Parameters:
mod - Name of the mod to check for.
Returns:
Returns true if a mod with supplied name exists in the mod list.

AddName

public static void AddName(java.lang.Object instance,
                           java.lang.String name)
This method will allow adding name to item in inventory. Requires name tag.

Parameters:
instance - A block or item reference to name.
name - The name to give.

OpenModGUI

public static void OpenModGUI(ei player,
                              java.lang.Object instance)
Opens GUI for use with mods.

Parameters:
player - Player instance to open GUI for.
instance - Used for identifying which mod this call is for. Allows for passing extra data to GUI.
See Also:
BaseMod.OpenModGUI(ei, java.lang.Object)

isGUIOpen

public static boolean isGUIOpen(java.lang.Class<? extends br> gui)
Use this method to check if GUI is opened for the player.

Parameters:
gui - The type of GUI to check for. If null, will check for any GUI.
Returns:
True if GUI is open.

PopulateChunk

public static void PopulateChunk(bf generator,
                                 int chunkX,
                                 int chunkZ,
                                 dd world)
Used for generating new blocks in the world.

Parameters:
generator - Generator to pair with.
chunkX - X coordinate of chunk.
chunkZ - Z coordinate of chunk.
world - World to generate blocks in.
See Also:
BaseMod.GenerateSurface(dd, java.util.Random, int, int), BaseMod.GenerateNether(dd, java.util.Random, int, int)

RegisterAllTextureOverrides

public static void RegisterAllTextureOverrides(ge texCache)
Processes all registered texture overrides, modifies internal buffers.

Parameters:
texCache - Reference to texture cache.
See Also:
BaseMod.RegisterTextureOverrides()

RegisterBlock

public static void RegisterBlock(og block)
Adds block to list of blocks the player can use.

Parameters:
block - Block to add.

RegisterEntityID

public static void RegisterEntityID(java.lang.Class<? extends mn> entityClass,
                                    java.lang.String entityName,
                                    int id)
Registers an entity ID.

Parameters:
entityClass - Class of entity to register.
entityName - The given name of entity. Used for saving.
id - Numeric ID of entity.

RegisterTileEntity

public static void RegisterTileEntity(java.lang.Class<? extends jx> tileEntityClass,
                                      java.lang.String id)
Registers a tile entity.

Parameters:
tileEntityClass - Class of tile entity to register.
id - The given name of entity. Used for saving.

RunOSDHooks

public static void RunOSDHooks(net.minecraft.client.Minecraft game)
Runs all registered OSD hooks, run by GUIInGame.

Parameters:
game - instance of the game class.
See Also:
BaseMod.OSDHook(net.minecraft.client.Minecraft)

setPrivateValue

public static <T> void setPrivateValue(java.lang.Object instance,
                                       int fieldindex,
                                       T value)
                            throws java.lang.SecurityException,
                                   java.lang.NoSuchFieldException
Used for setting value of private fields.

Type Parameters:
T - Type of value.
Parameters:
instance - Object to get private field from.
fieldindex - The field number to use.
value - Value to set.
Throws:
java.lang.SecurityException - if the thread is not allowed to access field.
java.lang.NoSuchFieldException - if field does not exist.

setPrivateValue

public static <T> void setPrivateValue(java.lang.Object instance,
                                       java.lang.String field,
                                       T value)
                            throws java.lang.SecurityException,
                                   java.lang.NoSuchFieldException
Used for setting value of private fields.

Type Parameters:
T - Type of value.
Parameters:
instance - Object to get private field from.
field - Name of the field.
value - Value to set.
Throws:
java.lang.SecurityException - if the thread is not allowed to access field.
java.lang.NoSuchFieldException - if field does not exist.