net.minecraft.src
Class ModLoader

java.lang.Object
  extended by net.minecraft.src.ModLoader

public class ModLoader
extends Object


Field Summary
static String fmlMarker
           
static Map<String,Map<String,String>> localizedStrings
          Deprecated. 
 
Constructor Summary
ModLoader()
           
 
Method Summary
static void addAchievementDesc(Achievement achievement, String name, String description)
          Adds localization info for an achievement, Not used on the server.
static int addAllFuel(int id, int metadata)
          Deprecated. 
static void addAllRenderers(Map<Class<? extends Entity>,Render> renderers)
          Deprecated. 
static void addAnimation(TextureFX anim)
           
static int addArmor(String armor)
          Adds a new prefix to the armor texture list RenderingRegistry.addNewArmourRendererPrefix(String)
static void addBiome(BiomeGenBase biome)
          This method adds the supplied biome to the set of candidate biomes for the default world generator type.
static void addCommand(ICommand command)
           
static void addDispenserBehavior(Item item, IBehaviorDispenseItem behavior)
          Add a behaviour to the dispenser
static void addEntityTracker(BaseMod mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval, boolean sendVelocityInfo)
           
static void addLocalization(String key, String value)
          Add localization for the specified string
static void addLocalization(String key, String lang, String value)
          Add localization for the specified string
static void addName(Object instance, String name)
          Name the specified minecraft object with the supplied name
static void addName(Object instance, String lang, String name)
          Unimplemented on the server as it does not generate names
static int addOverride(String fileToOverride, String fileToAdd)
          Attempts to register a small image to be applied to a larger texture image, typically how old ModLoader mods add custom Item/Block textures.
static void addOverride(String path, String overlayPath, int index)
          Attempts to register a small image to be applied to a larger texture image, typically how old ModLoader mods add custom Item/Block textures.
static void addRecipe(ItemStack output, Object... params)
          Add a Shaped Recipe
static void addShapelessRecipe(ItemStack output, Object... params)
          Add a shapeless recipe
static void addSmelting(int input, ItemStack output)
          Add a new product to be smelted
static void addSmelting(int input, ItemStack output, float experience)
          Add a new product to be smelted
static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
          Add a mob to the spawn list
static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
          Add a mob to the spawn list
static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
          Add a mob to the spawn list
static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
          Add a mob to the spawn list
static void addTrade(int profession, TradeEntry entry)
           
static void clientSendPacket(Packet packet)
          Send a packet from the client
static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
          Deprecated. 
static void genericContainerRemoval(World world, int x, int y, int z)
          Remove a container and drop all the items in it on the ground around
static List<BaseMod> getLoadedMods()
          Get a list of all BaseMod loaded into the system ModLoaderModContainer.findAll(java.lang.Class)
static Logger getLogger()
          Get a logger instance FMLCommonHandler.getFMLLogger()
static Minecraft getMinecraftInstance()
           
static MinecraftServer getMinecraftServerInstance()
           
static
<T,E> T
getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
          Get a value from a field using reflection ObfuscationReflectionHelper.getPrivateValue(Class, Object, int)
static
<T,E> T
getPrivateValue(Class<? super E> instanceclass, E instance, String field)
          Get a value from a field using reflection ObfuscationReflectionHelper.getPrivateValue(Class, Object, String[])
static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
          Stubbed method on the server to return a unique model id
static int getUniqueEntityId()
          Get a new unique entity id EntityRegistry.findGlobalUniqueEntityId()
static int getUniqueSpriteIndex(String path)
           
static boolean isChannelActive(EntityPlayer player, String channel)
          To properly implement packet 250 protocol you should always check your channel is active prior to sending the packet
static boolean isGUIOpen(Class<? extends GuiScreen> gui)
           
static boolean isModLoaded(String modname)
          Is the named mod loaded? Loader.isModLoaded(String)
static void loadConfig()
          Deprecated. 
static BufferedImage loadImage(RenderEngine renderEngine, String path)
           
static void onItemPickup(EntityPlayer player, ItemStack item)
          Deprecated. 
static void onTick(float tick, Minecraft game)
          Deprecated. 
static void openGUI(EntityPlayer player, GuiScreen gui)
           
static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
          Deprecated. 
static void receivePacket(Packet250CustomPayload packet)
          Deprecated. 
static KeyBinding[] registerAllKeys(KeyBinding[] keys)
          Deprecated. 
static void registerAllTextureOverrides(RenderEngine cache)
          Deprecated. 
static void registerBlock(Block block)
          Register a new block
static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
          Register a new block
static void registerContainerID(BaseMod mod, int id)
           
static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
          Register a new entity ID
static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
          Register a new entity ID
static void registerKey(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
           
static void registerPacketChannel(BaseMod mod, String channel)
          Register the mod for packets on this channel.
static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
          Register a new tile entity class
static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, TileEntitySpecialRenderer renderer)
           
static void removeBiome(BiomeGenBase biome)
          Remove a biome from the list of generated biomes
static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
          Remove a spawn
static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
          Remove a spawn
static void removeSpawn(String entityName, EnumCreatureType spawnList)
          Remove a spawn
static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
          Remove a spawn
static boolean renderBlockIsItemFull3D(int modelID)
          Deprecated. 
static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
          Deprecated. 
static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
          Deprecated. 
static void saveConfig()
          Deprecated. 
static void sendPacket(Packet packet)
          Send a packet from client to server
static void serverChat(String text)
          Deprecated. 
static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
          Deprecated. 
static void serverOpenWindow(EntityPlayerMP player, Container container, int ID, int x, int y, int z)
           
static void serverSendPacket(NetServerHandler handler, Packet packet)
           
static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
          Indicate that you want to receive ticks
static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
           
static
<T,E> void
setPrivateValue(Class<? super T> instanceclass, T instance, int fieldindex, E value)
          Set a private field to a value using reflection ObfuscationReflectionHelper.setPrivateValue(Class, Object, int, Object)
static
<T,E> void
setPrivateValue(Class<? super T> instanceclass, T instance, String field, E value)
          Set a private field to a value using reflection ObfuscationReflectionHelper.setPrivateValue(Class, Object, String, Object)
static void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix)
          Deprecated. 
static void takenFromFurnace(EntityPlayer player, ItemStack item)
          Deprecated. 
static void throwException(String message, Throwable e)
          Throw the offered exception.
static void throwException(Throwable e)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fmlMarker

public static final String fmlMarker
See Also:
Constant Field Values

localizedStrings

@Deprecated
public static final Map<String,Map<String,String>> localizedStrings
Deprecated. 
Constructor Detail

ModLoader

public ModLoader()
Method Detail

addAchievementDesc

public static void addAchievementDesc(Achievement achievement,
                                      String name,
                                      String description)
Adds localization info for an achievement, Not used on the server.

Parameters:
achievement - The achievement to name
name - The name
description - The description

addAllFuel

@Deprecated
public static int addAllFuel(int id,
                                        int metadata)
Deprecated. 

This method is a call in hook from modified external code. Implemented elsewhere. GameRegistry.getFuelValue(ItemStack)

Parameters:
id - The Item ID
metadata - The Item Metadata
Returns:
The fuel strength, in ticks, 0 if unhandled

addAllRenderers

@Deprecated
public static void addAllRenderers(Map<Class<? extends Entity>,Render> renderers)
Deprecated. 


addAnimation

public static void addAnimation(TextureFX anim)

addArmor

public static int addArmor(String armor)
Adds a new prefix to the armor texture list RenderingRegistry.addNewArmourRendererPrefix(String)

Parameters:
armor - The new armor prefix
Returns:
The new armor index

addBiome

public static void addBiome(BiomeGenBase biome)
This method adds the supplied biome to the set of candidate biomes for the default world generator type.

Parameters:
biome - The biome to add

addEntityTracker

public static void addEntityTracker(BaseMod mod,
                                    Class<? extends Entity> entityClass,
                                    int entityTypeId,
                                    int updateRange,
                                    int updateInterval,
                                    boolean sendVelocityInfo)

addCommand

public static void addCommand(ICommand command)

addDispenserBehavior

public static void addDispenserBehavior(Item item,
                                        IBehaviorDispenseItem behavior)
Add a behaviour to the dispenser

Parameters:
item -
behavior -

addLocalization

public static void addLocalization(String key,
                                   String value)
Add localization for the specified string

Parameters:
key - Key
value - Value

addLocalization

public static void addLocalization(String key,
                                   String lang,
                                   String value)
Add localization for the specified string

Parameters:
key - Key
lang - Language identifier
value - Value

addName

public static void addName(Object instance,
                           String name)
Name the specified minecraft object with the supplied name

Parameters:
instance - Item to name
name - The name to give it

addName

public static void addName(Object instance,
                           String lang,
                           String name)
Unimplemented on the server as it does not generate names

Parameters:
instance - Item to name
lang - Languge identifier
name - Name to give it

addOverride

public static int addOverride(String fileToOverride,
                              String fileToAdd)
Attempts to register a small image to be applied to a larger texture image, typically how old ModLoader mods add custom Item/Block textures. Forge mods should use setTextureFile in Item/Block Will return the icon index it was applied to. Unimplemented on the server as it does not render textures

Parameters:
fileToOverride - The texture to apply the new image to
fileToAdd - The new image
Returns:
The 'icon index' in the main image that the new image will be applied to

addOverride

public static void addOverride(String path,
                               String overlayPath,
                               int index)
Attempts to register a small image to be applied to a larger texture image, typically how old ModLoader mods add custom Item/Block textures. Forge mods should use setTextureFile in Item/Block Unimplemented on the server as it does not render textures

Parameters:
path - The texture to apply the new image to
overlayPath - The new image
index - Where on the texture to apply it

addRecipe

public static void addRecipe(ItemStack output,
                             Object... params)
Add a Shaped Recipe

Parameters:
output - The result
params - The input

addShapelessRecipe

public static void addShapelessRecipe(ItemStack output,
                                      Object... params)
Add a shapeless recipe

Parameters:
output - The result
params - The input

addSmelting

public static void addSmelting(int input,
                               ItemStack output)
Add a new product to be smelted

Parameters:
input -
output -

addSmelting

public static void addSmelting(int input,
                               ItemStack output,
                               float experience)
Add a new product to be smelted

Parameters:
input -
output -

addSpawn

public static void addSpawn(Class<? extends EntityLiving> entityClass,
                            int weightedProb,
                            int min,
                            int max,
                            EnumCreatureType spawnList)
Add a mob to the spawn list

Parameters:
entityClass -
weightedProb -
min -
max -
spawnList -

addSpawn

public static void addSpawn(Class<? extends EntityLiving> entityClass,
                            int weightedProb,
                            int min,
                            int max,
                            EnumCreatureType spawnList,
                            BiomeGenBase... biomes)
Add a mob to the spawn list

Parameters:
entityClass -
weightedProb -
min -
max -
spawnList -
biomes -

addSpawn

public static void addSpawn(String entityName,
                            int weightedProb,
                            int min,
                            int max,
                            EnumCreatureType spawnList)
Add a mob to the spawn list

Parameters:
entityName -
weightedProb -
min -
max -
spawnList -

addSpawn

public static void addSpawn(String entityName,
                            int weightedProb,
                            int min,
                            int max,
                            EnumCreatureType spawnList,
                            BiomeGenBase... biomes)
Add a mob to the spawn list

Parameters:
entityName -
weightedProb -
min -
max -
spawnList -
biomes -

addTrade

public static void addTrade(int profession,
                            TradeEntry entry)

clientSendPacket

public static void clientSendPacket(Packet packet)
Send a packet from the client

Parameters:
packet -

dispenseEntity

@Deprecated
public static boolean dispenseEntity(World world,
                                                double x,
                                                double y,
                                                double z,
                                                int xVel,
                                                int zVel,
                                                ItemStack item)
Deprecated. 

This method is a call in hook from modified external code. Implemented elsewhere.

Parameters:
world -
x -
y -
z -
xVel -
zVel -
item -
Returns:
Always false, not implemented here

genericContainerRemoval

public static void genericContainerRemoval(World world,
                                           int x,
                                           int y,
                                           int z)
Remove a container and drop all the items in it on the ground around

Parameters:
world -
x -
y -
z -

getLoadedMods

public static List<BaseMod> getLoadedMods()
Get a list of all BaseMod loaded into the system ModLoaderModContainer.findAll(java.lang.Class)

Returns:
A list containing all loaded ModLoader mods

getLogger

public static Logger getLogger()
Get a logger instance FMLCommonHandler.getFMLLogger()

Returns:
The current logger

getMinecraftInstance

public static Minecraft getMinecraftInstance()

getMinecraftServerInstance

public static MinecraftServer getMinecraftServerInstance()

getPrivateValue

public static <T,E> T getPrivateValue(Class<? super E> instanceclass,
                                      E instance,
                                      int fieldindex)
Get a value from a field using reflection ObfuscationReflectionHelper.getPrivateValue(Class, Object, int)

Parameters:
instanceclass -
instance -
fieldindex -
Returns:
The value in the specified field.

getPrivateValue

public static <T,E> T getPrivateValue(Class<? super E> instanceclass,
                                      E instance,
                                      String field)
Get a value from a field using reflection ObfuscationReflectionHelper.getPrivateValue(Class, Object, String[])

Parameters:
instanceclass -
instance -
field -
Returns:
The value in the specified field.

getUniqueBlockModelID

public static int getUniqueBlockModelID(BaseMod mod,
                                        boolean inventoryRenderer)
Stubbed method on the server to return a unique model id


getUniqueEntityId

public static int getUniqueEntityId()
Get a new unique entity id EntityRegistry.findGlobalUniqueEntityId()

Returns:
A unique entity ID

getUniqueSpriteIndex

public static int getUniqueSpriteIndex(String path)

isChannelActive

public static boolean isChannelActive(EntityPlayer player,
                                      String channel)
To properly implement packet 250 protocol you should always check your channel is active prior to sending the packet

Parameters:
player -
channel -
Returns:
If the channel is registered to the current connection.

isGUIOpen

public static boolean isGUIOpen(Class<? extends GuiScreen> gui)

isModLoaded

public static boolean isModLoaded(String modname)
Is the named mod loaded? Loader.isModLoaded(String)

Parameters:
modname -
Returns:
If the specified mod is loaded

loadConfig

@Deprecated
public static void loadConfig()
Deprecated. 

Implemented elsewhere


loadImage

public static BufferedImage loadImage(RenderEngine renderEngine,
                                      String path)
                               throws Exception
Throws:
Exception

onItemPickup

@Deprecated
public static void onItemPickup(EntityPlayer player,
                                           ItemStack item)
Deprecated. 

Call in from elsewhere. Unimplemented here.

Parameters:
player -
item -

onTick

@Deprecated
public static void onTick(float tick,
                                     Minecraft game)
Deprecated. 

Call in from elsewhere. Unimplemented here.


openGUI

public static void openGUI(EntityPlayer player,
                           GuiScreen gui)

populateChunk

@Deprecated
public static void populateChunk(IChunkProvider generator,
                                            int chunkX,
                                            int chunkZ,
                                            World world)
Deprecated. 


receivePacket

@Deprecated
public static void receivePacket(Packet250CustomPayload packet)
Deprecated. 

This method is a call in hook from modified external code. Implemented elsewhere.

Parameters:
packet -

registerAllKeys

@Deprecated
public static KeyBinding[] registerAllKeys(KeyBinding[] keys)
Deprecated. 


registerAllTextureOverrides

@Deprecated
public static void registerAllTextureOverrides(RenderEngine cache)
Deprecated. 


registerBlock

public static void registerBlock(Block block)
Register a new block

Parameters:
block -

registerBlock

public static void registerBlock(Block block,
                                 Class<? extends ItemBlock> itemclass)
Register a new block

Parameters:
block -
itemclass -

registerContainerID

public static void registerContainerID(BaseMod mod,
                                       int id)

registerEntityID

public static void registerEntityID(Class<? extends Entity> entityClass,
                                    String entityName,
                                    int id)
Register a new entity ID

Parameters:
entityClass -
entityName -
id -

registerEntityID

public static void registerEntityID(Class<? extends Entity> entityClass,
                                    String entityName,
                                    int id,
                                    int background,
                                    int foreground)
Register a new entity ID

Parameters:
entityClass -
entityName -
id -
background -
foreground -

registerKey

public static void registerKey(BaseMod mod,
                               KeyBinding keyHandler,
                               boolean allowRepeat)

registerPacketChannel

public static void registerPacketChannel(BaseMod mod,
                                         String channel)
Register the mod for packets on this channel. NetworkRegistry.registerChannel(IPacketHandler, String)

Parameters:
mod -
channel -

registerTileEntity

public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass,
                                      String id)
Register a new tile entity class

Parameters:
tileEntityClass -
id -

registerTileEntity

public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass,
                                      String id,
                                      TileEntitySpecialRenderer renderer)

removeBiome

public static void removeBiome(BiomeGenBase biome)
Remove a biome from the list of generated biomes

Parameters:
biome -

removeSpawn

public static void removeSpawn(Class<? extends EntityLiving> entityClass,
                               EnumCreatureType spawnList)
Remove a spawn

Parameters:
entityClass -
spawnList -

removeSpawn

public static void removeSpawn(Class<? extends EntityLiving> entityClass,
                               EnumCreatureType spawnList,
                               BiomeGenBase... biomes)
Remove a spawn

Parameters:
entityClass -
spawnList -
biomes -

removeSpawn

public static void removeSpawn(String entityName,
                               EnumCreatureType spawnList)
Remove a spawn

Parameters:
entityName -
spawnList -

removeSpawn

public static void removeSpawn(String entityName,
                               EnumCreatureType spawnList,
                               BiomeGenBase... biomes)
Remove a spawn

Parameters:
entityName -
spawnList -
biomes -

renderBlockIsItemFull3D

@Deprecated
public static boolean renderBlockIsItemFull3D(int modelID)
Deprecated. 


renderInvBlock

@Deprecated
public static void renderInvBlock(RenderBlocks renderer,
                                             Block block,
                                             int metadata,
                                             int modelID)
Deprecated. 


renderWorldBlock

@Deprecated
public static boolean renderWorldBlock(RenderBlocks renderer,
                                                  IBlockAccess world,
                                                  int x,
                                                  int y,
                                                  int z,
                                                  Block block,
                                                  int modelID)
Deprecated. 


saveConfig

@Deprecated
public static void saveConfig()
Deprecated. 

Configuration is handled elsewhere ModLoaderModContainer


sendPacket

public static void sendPacket(Packet packet)
Send a packet from client to server

Parameters:
packet -

serverChat

@Deprecated
public static void serverChat(String text)
Deprecated. 

Send a chat message to the server

Parameters:
text -

serverLogin

@Deprecated
public static void serverLogin(NetClientHandler handler,
                                          Packet1Login loginPacket)
Deprecated. 


serverSendPacket

public static void serverSendPacket(NetServerHandler handler,
                                    Packet packet)

serverOpenWindow

public static void serverOpenWindow(EntityPlayerMP player,
                                    Container container,
                                    int ID,
                                    int x,
                                    int y,
                                    int z)

setInGameHook

public static void setInGameHook(BaseMod mod,
                                 boolean enable,
                                 boolean useClock)
Indicate that you want to receive ticks

Parameters:
mod - receiving the events
enable - indicates whether you want to recieve them or not
useClock - don't receive render subticks, just world ticks

setInGUIHook

public static void setInGUIHook(BaseMod mod,
                                boolean enable,
                                boolean useClock)

setPrivateValue

public static <T,E> void setPrivateValue(Class<? super T> instanceclass,
                                         T instance,
                                         int fieldindex,
                                         E value)
Set a private field to a value using reflection ObfuscationReflectionHelper.setPrivateValue(Class, Object, int, Object)

Parameters:
instanceclass -
instance -
fieldindex -
value -

setPrivateValue

public static <T,E> void setPrivateValue(Class<? super T> instanceclass,
                                         T instance,
                                         String field,
                                         E value)
Set a private field to a value using reflection ObfuscationReflectionHelper.setPrivateValue(Class, Object, String, Object)

Parameters:
instanceclass -
instance -
field -
value -

takenFromCrafting

@Deprecated
public static void takenFromCrafting(EntityPlayer player,
                                                ItemStack item,
                                                IInventory matrix)
Deprecated. 

This method is a call in hook from modified external code. Implemented elsewhere.

Parameters:
player -
item -
matrix -

takenFromFurnace

@Deprecated
public static void takenFromFurnace(EntityPlayer player,
                                               ItemStack item)
Deprecated. 

This method is a call in hook from modified external code. Implemented elsewhere.

Parameters:
player -
item -

throwException

public static void throwException(String message,
                                  Throwable e)
Throw the offered exception. Likely will stop the game.

Parameters:
message -
e -

throwException

public static void throwException(Throwable e)