Add in a mechanism to get the modcontainer for a mod - so things can be programmatically changed
This commit is contained in:
parent
a7caad10ba
commit
5a5ff97f39
|
@ -38,7 +38,7 @@ public class ModLoader
|
||||||
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
|
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
|
||||||
/**
|
/**
|
||||||
* Not used on the server.
|
* Not used on the server.
|
||||||
*
|
*
|
||||||
* @param achievement
|
* @param achievement
|
||||||
* @param name
|
* @param name
|
||||||
* @param description
|
* @param description
|
||||||
|
@ -52,9 +52,9 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
*
|
*
|
||||||
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param metadata
|
* @param metadata
|
||||||
* @return
|
* @return
|
||||||
|
@ -144,7 +144,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unimplemented on the server as it does not render textures
|
* Unimplemented on the server as it does not render textures
|
||||||
*
|
*
|
||||||
* @param fileToOverride
|
* @param fileToOverride
|
||||||
* @param fileToAdd
|
* @param fileToAdd
|
||||||
* @return
|
* @return
|
||||||
|
@ -158,7 +158,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unimplemented on the server as it does not render textures
|
* Unimplemented on the server as it does not render textures
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @param overlayPath
|
* @param overlayPath
|
||||||
* @param index
|
* @param index
|
||||||
|
@ -217,7 +217,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a mob to the spawn list
|
* Add a mob to the spawn list
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param weightedProb
|
* @param weightedProb
|
||||||
* @param min
|
* @param min
|
||||||
|
@ -246,7 +246,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a mob to the spawn list
|
* Add a mob to the spawn list
|
||||||
*
|
*
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param weightedProb
|
* @param weightedProb
|
||||||
* @param min
|
* @param min
|
||||||
|
@ -262,7 +262,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLClientHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
|
* {@link FMLClientHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
|
@ -365,7 +365,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This is not the server
|
* This is not the server
|
||||||
* {@link FMLClientHandler#getServer()}
|
* {@link FMLClientHandler#getServer()}
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Object getMinecraftServerInstance()
|
public static Object getMinecraftServerInstance()
|
||||||
|
@ -390,7 +390,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Get a value from a field using reflection
|
* Get a value from a field using reflection
|
||||||
* {@link ReflectionHelper#getPrivateValue(Class, Object, String)}
|
* {@link ReflectionHelper#getPrivateValue(Class, Object, String)}
|
||||||
*
|
*
|
||||||
* @param instanceclass
|
* @param instanceclass
|
||||||
* @param instance
|
* @param instance
|
||||||
* @param field
|
* @param field
|
||||||
|
@ -403,7 +403,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stubbed method on the server to return a unique model id
|
* Stubbed method on the server to return a unique model id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
||||||
{
|
{
|
||||||
|
@ -425,11 +425,11 @@ public class ModLoader
|
||||||
{
|
{
|
||||||
return SpriteHelper.getUniqueSpriteIndex(path);
|
return SpriteHelper.getUniqueSpriteIndex(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To properly implement packet 250 protocol you should always check your
|
* To properly implement packet 250 protocol you should always check your
|
||||||
* channel is active prior to sending the packet
|
* channel is active prior to sending the packet
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param channel
|
* @param channel
|
||||||
* @return
|
* @return
|
||||||
|
@ -447,7 +447,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Is the named mod loaded?
|
* Is the named mod loaded?
|
||||||
* {@link Loader#isModLoaded(String)}
|
* {@link Loader#isModLoaded(String)}
|
||||||
*
|
*
|
||||||
* @param modname
|
* @param modname
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -499,7 +499,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
|
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -520,7 +520,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new block
|
* Register a new block
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block
|
||||||
*/
|
*/
|
||||||
public static void registerBlock(Block block)
|
public static void registerBlock(Block block)
|
||||||
|
@ -530,7 +530,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new block
|
* Register a new block
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block
|
||||||
* @param itemclass
|
* @param itemclass
|
||||||
*/
|
*/
|
||||||
|
@ -541,7 +541,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new entity ID
|
* Register a new entity ID
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -553,7 +553,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new entity ID
|
* Register a new entity ID
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -575,18 +575,18 @@ public class ModLoader
|
||||||
* channel with Forge Mod Loader, not with clients connecting- use
|
* channel with Forge Mod Loader, not with clients connecting- use
|
||||||
* BaseMod.onClientLogin to tell them about your custom channel
|
* BaseMod.onClientLogin to tell them about your custom channel
|
||||||
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
||||||
*
|
*
|
||||||
* @param mod
|
* @param mod
|
||||||
* @param channel
|
* @param channel
|
||||||
*/
|
*/
|
||||||
public static void registerPacketChannel(BaseMod mod, String channel)
|
public static void registerPacketChannel(BaseMod mod, String channel)
|
||||||
{
|
{
|
||||||
FMLCommonHandler.instance().registerChannel(ModLoaderModContainer.findContainerFor(mod), channel);
|
FMLCommonHandler.instance().registerChannel(FMLCommonHandler.instance().findContainerFor(mod), channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new tile entity class
|
* Register a new tile entity class
|
||||||
*
|
*
|
||||||
* @param tileEntityClass
|
* @param tileEntityClass
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
|
@ -602,7 +602,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a biome from the list of generated biomes
|
* Remove a biome from the list of generated biomes
|
||||||
*
|
*
|
||||||
* @param biome
|
* @param biome
|
||||||
*/
|
*/
|
||||||
public static void removeBiome(BiomeGenBase biome)
|
public static void removeBiome(BiomeGenBase biome)
|
||||||
|
@ -612,7 +612,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
*/
|
*/
|
||||||
|
@ -623,7 +623,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
* @param biomes
|
* @param biomes
|
||||||
|
@ -635,7 +635,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
*/
|
*/
|
||||||
|
@ -646,7 +646,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
* @param biomes
|
* @param biomes
|
||||||
|
@ -689,7 +689,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Send a chat message to the server
|
* Send a chat message to the server
|
||||||
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -716,7 +716,7 @@ public class ModLoader
|
||||||
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
||||||
{
|
{
|
||||||
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
||||||
|
@ -725,7 +725,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Set a private field to a value using reflection
|
* Set a private field to a value using reflection
|
||||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
* {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
||||||
*
|
*
|
||||||
* @param instanceclass
|
* @param instanceclass
|
||||||
* @param instance
|
* @param instance
|
||||||
* @param fieldindex
|
* @param fieldindex
|
||||||
|
@ -739,7 +739,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Set a private field to a value using reflection
|
* Set a private field to a value using reflection
|
||||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
* {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
||||||
*
|
*
|
||||||
* @param instanceclass
|
* @param instanceclass
|
||||||
* @param instance
|
* @param instance
|
||||||
* @param field
|
* @param field
|
||||||
|
@ -753,7 +753,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLClientHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
|
* {@link FMLClientHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param item
|
* @param item
|
||||||
* @param matrix
|
* @param matrix
|
||||||
|
@ -766,7 +766,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLClientHandler#onItemSmelted(EntityPlayer, ItemStack)}
|
* {@link FMLClientHandler#onItemSmelted(EntityPlayer, ItemStack)}
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
|
@ -778,7 +778,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Throw the offered exception. Likely will stop the game.
|
* Throw the offered exception. Likely will stop the game.
|
||||||
* {@link FMLClientHandler#raiseException(Throwable, String, boolean)}
|
* {@link FMLClientHandler#raiseException(Throwable, String, boolean)}
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
|
@ -786,7 +786,7 @@ public class ModLoader
|
||||||
{
|
{
|
||||||
FMLCommonHandler.instance().raiseException(e, message, true);
|
FMLCommonHandler.instance().raiseException(e, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void throwException(Throwable e)
|
public static void throwException(Throwable e)
|
||||||
{
|
{
|
||||||
throwException("Exception in ModLoader", e);
|
throwException("Exception in ModLoader", e);
|
||||||
|
|
|
@ -41,14 +41,14 @@ import cpw.mods.fml.common.ModContainer.SourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class for non-obfuscated hook handling code
|
* The main class for non-obfuscated hook handling code
|
||||||
*
|
*
|
||||||
* Anything that doesn't require obfuscated or client/server specific code should
|
* Anything that doesn't require obfuscated or client/server specific code should
|
||||||
* go in this handler
|
* go in this handler
|
||||||
*
|
*
|
||||||
* It also contains a reference to the sided handler instance that is valid
|
* It also contains a reference to the sided handler instance that is valid
|
||||||
* allowing for common code to access specific properties from the obfuscated world
|
* allowing for common code to access specific properties from the obfuscated world
|
||||||
* without a direct dependency
|
* without a direct dependency
|
||||||
*
|
*
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -72,18 +72,18 @@ public class FMLCommonHandler
|
||||||
*/
|
*/
|
||||||
private Map<Object, Set<String>> activeChannels = new HashMap<Object, Set<String>>();
|
private Map<Object, Set<String>> activeChannels = new HashMap<Object, Set<String>>();
|
||||||
/**
|
/**
|
||||||
* The delegate for side specific data and functions
|
* The delegate for side specific data and functions
|
||||||
*/
|
*/
|
||||||
private IFMLSidedHandler sidedDelegate;
|
private IFMLSidedHandler sidedDelegate;
|
||||||
|
|
||||||
private int uniqueEntityListId = 220;
|
private int uniqueEntityListId = 220;
|
||||||
|
|
||||||
private List<ModContainer> auxilliaryContainers = new ArrayList<ModContainer>();
|
private List<ModContainer> auxilliaryContainers = new ArrayList<ModContainer>();
|
||||||
|
|
||||||
private Map<String,Properties> modLanguageData=new HashMap<String,Properties>();
|
private Map<String,Properties> modLanguageData=new HashMap<String,Properties>();
|
||||||
|
|
||||||
private Set<ITickHandler> tickHandlers = new HashSet<ITickHandler>();
|
private Set<ITickHandler> tickHandlers = new HashSet<ITickHandler>();
|
||||||
|
|
||||||
private Set<IWorldGenerator> worldGenerators = new HashSet<IWorldGenerator>();
|
private Set<IWorldGenerator> worldGenerators = new HashSet<IWorldGenerator>();
|
||||||
/**
|
/**
|
||||||
* We register our delegate here
|
* We register our delegate here
|
||||||
|
@ -113,7 +113,7 @@ public class FMLCommonHandler
|
||||||
}
|
}
|
||||||
sidedDelegate.profileEnd();
|
sidedDelegate.profileEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tickEnd(EnumSet<TickType> ticks, Object ... data)
|
public void tickEnd(EnumSet<TickType> ticks, Object ... data)
|
||||||
{
|
{
|
||||||
sidedDelegate.profileStart("modTickEnd$"+ticks);
|
sidedDelegate.profileStart("modTickEnd$"+ticks);
|
||||||
|
@ -130,7 +130,7 @@ public class FMLCommonHandler
|
||||||
}
|
}
|
||||||
sidedDelegate.profileEnd();
|
sidedDelegate.profileEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IKeyHandler> gatherKeyBindings() {
|
public List<IKeyHandler> gatherKeyBindings() {
|
||||||
List<IKeyHandler> allKeys=new ArrayList<IKeyHandler>();
|
List<IKeyHandler> allKeys=new ArrayList<IKeyHandler>();
|
||||||
for (ModContainer mod : Loader.getModList())
|
for (ModContainer mod : Loader.getModList())
|
||||||
|
@ -150,7 +150,22 @@ public class FMLCommonHandler
|
||||||
{
|
{
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Find the container that associates with the supplied mod object
|
||||||
|
* @param mod
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ModContainer findContainerFor(Object mod)
|
||||||
|
{
|
||||||
|
for (ModContainer mc : Loader.getModList())
|
||||||
|
{
|
||||||
|
if (mc.matches(mod))
|
||||||
|
{
|
||||||
|
return mc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Lookup the mod for a channel
|
* Lookup the mod for a channel
|
||||||
* @param channel
|
* @param channel
|
||||||
|
@ -308,7 +323,7 @@ public class FMLCommonHandler
|
||||||
{
|
{
|
||||||
return sidedDelegate.loadBaseModMod(clazz, canonicalFile);
|
return sidedDelegate.loadBaseModMod(clazz, canonicalFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getMinecraftRootDirectory() {
|
public File getMinecraftRootDirectory() {
|
||||||
return sidedDelegate.getMinecraftRootDirectory();
|
return sidedDelegate.getMinecraftRootDirectory();
|
||||||
}
|
}
|
||||||
|
@ -342,7 +357,7 @@ public class FMLCommonHandler
|
||||||
modLanguageData.put(lang, langPack);
|
modLanguageData.put(lang, langPack);
|
||||||
}
|
}
|
||||||
langPack.put(key,value);
|
langPack.put(key,value);
|
||||||
|
|
||||||
handleLanguageLoad(sidedDelegate.getCurrentLanguageTable(), lang);
|
handleLanguageLoad(sidedDelegate.getCurrentLanguageTable(), lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +382,7 @@ public class FMLCommonHandler
|
||||||
{
|
{
|
||||||
return sidedDelegate.getSide();
|
return sidedDelegate.getSide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAuxilliaryModContainer(ModContainer ticker)
|
public void addAuxilliaryModContainer(ModContainer ticker)
|
||||||
{
|
{
|
||||||
auxilliaryContainers.add(ticker);
|
auxilliaryContainers.add(ticker);
|
||||||
|
@ -375,7 +390,7 @@ public class FMLCommonHandler
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called from the furnace to lookup fuel values
|
* Called from the furnace to lookup fuel values
|
||||||
*
|
*
|
||||||
* @param itemId
|
* @param itemId
|
||||||
* @param itemDamage
|
* @param itemDamage
|
||||||
* @return
|
* @return
|
||||||
|
@ -383,24 +398,24 @@ public class FMLCommonHandler
|
||||||
public int fuelLookup(int itemId, int itemDamage)
|
public int fuelLookup(int itemId, int itemDamage)
|
||||||
{
|
{
|
||||||
int fv = 0;
|
int fv = 0;
|
||||||
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
for (ModContainer mod : Loader.getModList())
|
||||||
{
|
{
|
||||||
fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage));
|
fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage));
|
||||||
}
|
}
|
||||||
|
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNameForObject(Object minecraftObject, String lang, String name) {
|
public void addNameForObject(Object minecraftObject, String lang, String name) {
|
||||||
String label=sidedDelegate.getObjectName(minecraftObject);
|
String label=sidedDelegate.getObjectName(minecraftObject);
|
||||||
addStringLocalization(label, lang, name);
|
addStringLocalization(label, lang, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raise an exception
|
* Raise an exception
|
||||||
*
|
*
|
||||||
* @param exception
|
* @param exception
|
||||||
* @param message
|
* @param message
|
||||||
* @param stopGame
|
* @param stopGame
|
||||||
|
@ -411,10 +426,10 @@ public class FMLCommonHandler
|
||||||
throw new RuntimeException(exception);
|
throw new RuntimeException(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Class<?> forge;
|
private Class<?> forge;
|
||||||
private boolean noForge;
|
private boolean noForge;
|
||||||
|
|
||||||
private Class<?> findMinecraftForge()
|
private Class<?> findMinecraftForge()
|
||||||
{
|
{
|
||||||
if (forge==null && !noForge)
|
if (forge==null && !noForge)
|
||||||
|
@ -432,7 +447,7 @@ public class FMLCommonHandler
|
||||||
}
|
}
|
||||||
return forge;
|
return forge;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object callForgeMethod(String method)
|
private Object callForgeMethod(String method)
|
||||||
{
|
{
|
||||||
if (noForge)
|
if (noForge)
|
||||||
|
@ -551,12 +566,12 @@ public class FMLCommonHandler
|
||||||
generator.generate(fmlRandom, chunkX, chunkZ, data);
|
generator.generate(fmlRandom, chunkX, chunkZ, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerTickHandler(ITickHandler handler)
|
public void registerTickHandler(ITickHandler handler)
|
||||||
{
|
{
|
||||||
tickHandlers.add(handler);
|
tickHandlers.add(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerWorldGenerator(IWorldGenerator generator)
|
public void registerWorldGenerator(IWorldGenerator generator)
|
||||||
{
|
{
|
||||||
worldGenerators.add(generator);
|
worldGenerators.add(generator);
|
||||||
|
|
|
@ -40,10 +40,10 @@ import cpw.mods.fml.common.toposort.TopologicalSort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The loader class performs the actual loading of the mod code from disk.
|
* The loader class performs the actual loading of the mod code from disk.
|
||||||
*
|
*
|
||||||
* <p>There are several {@link State}s to mod loading, triggered in two different stages from the FML handler code's hooks into the
|
* <p>There are several {@link State}s to mod loading, triggered in two different stages from the FML handler code's hooks into the
|
||||||
* minecraft code.</p>
|
* minecraft code.</p>
|
||||||
*
|
*
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>LOADING. Scanning the filesystem for mod containers to load (zips, jars, directories), adding them to the {@link #modClassLoader}
|
* <li>LOADING. Scanning the filesystem for mod containers to load (zips, jars, directories), adding them to the {@link #modClassLoader}
|
||||||
* Scanning, the loaded containers for mod classes to load and registering them appropriately.</li>
|
* Scanning, the loaded containers for mod classes to load and registering them appropriately.</li>
|
||||||
|
@ -54,11 +54,11 @@ import cpw.mods.fml.common.toposort.TopologicalSort;
|
||||||
* <li>ERRORED. The loader encountered an error during the LOADING phase and dropped to this state instead. It will not complete
|
* <li>ERRORED. The loader encountered an error during the LOADING phase and dropped to this state instead. It will not complete
|
||||||
* loading from this state, but it attempts to continue loading before abandoning and giving a fatal error.</li>
|
* loading from this state, but it attempts to continue loading before abandoning and giving a fatal error.</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* Phase 1 code triggers the LOADING and PREINIT states. Phase 2 code triggers the INIT and POSTINIT states.
|
* Phase 1 code triggers the LOADING and PREINIT states. Phase 2 code triggers the INIT and POSTINIT states.
|
||||||
*
|
*
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Loader
|
public class Loader
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ public class Loader
|
||||||
private File canonicalMinecraftDir;
|
private File canonicalMinecraftDir;
|
||||||
private Exception capturedError;
|
private Exception capturedError;
|
||||||
|
|
||||||
|
|
||||||
public static Loader instance()
|
public static Loader instance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
|
@ -141,7 +141,7 @@ public class Loader
|
||||||
Loader.log.setUseParentHandlers(false);
|
Loader.log.setUseParentHandlers(false);
|
||||||
Loader.log.addHandler(ch);
|
Loader.log.addHandler(ch);
|
||||||
ch.setFormatter(formatter);
|
ch.setFormatter(formatter);
|
||||||
|
|
||||||
}
|
}
|
||||||
Loader.log.setLevel(Level.ALL);
|
Loader.log.setLevel(Level.ALL);
|
||||||
try
|
try
|
||||||
|
@ -163,11 +163,11 @@ public class Loader
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
try {
|
try {
|
||||||
properties.load(stream);
|
properties.load(stream);
|
||||||
major = properties.getProperty("fmlbuild.major.number");
|
major = properties.getProperty("fmlbuild.major.number","none");
|
||||||
minor = properties.getProperty("fmlbuild.minor.number");
|
minor = properties.getProperty("fmlbuild.minor.number","none");
|
||||||
rev = properties.getProperty("fmlbuild.revision.number");
|
rev = properties.getProperty("fmlbuild.revision.number","none");
|
||||||
build = properties.getProperty("fmlbuild.build.number");
|
build = properties.getProperty("fmlbuild.build.number","none");
|
||||||
mcversion = properties.getProperty("fmlbuild.mcversion");
|
mcversion = properties.getProperty("fmlbuild.mcversion","none");
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Loader.log.log(Level.SEVERE,"Could not get FML version information - corrupted installation detected!", ex);
|
Loader.log.log(Level.SEVERE,"Could not get FML version information - corrupted installation detected!", ex);
|
||||||
throw new LoaderException(ex);
|
throw new LoaderException(ex);
|
||||||
|
@ -238,12 +238,12 @@ public class Loader
|
||||||
mod.nextState();
|
mod.nextState();
|
||||||
}
|
}
|
||||||
// Link up mod metadatas
|
// Link up mod metadatas
|
||||||
|
|
||||||
for (ModContainer mod : mods) {
|
for (ModContainer mod : mods) {
|
||||||
if (mod.getMetadata()!=null) {
|
if (mod.getMetadata()!=null) {
|
||||||
mod.getMetadata().associate(namedMods);
|
mod.getMetadata().associate(namedMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
FMLCommonHandler.instance().injectSidedProxyDelegate(mod);
|
FMLCommonHandler.instance().injectSidedProxyDelegate(mod);
|
||||||
}
|
}
|
||||||
log.fine("Mod pre-initialization complete");
|
log.fine("Mod pre-initialization complete");
|
||||||
|
@ -287,18 +287,18 @@ public class Loader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The primary loading code
|
* The primary loading code
|
||||||
*
|
*
|
||||||
* This is visited during first initialization by Minecraft to scan and load the mods
|
* This is visited during first initialization by Minecraft to scan and load the mods
|
||||||
* from all sources
|
* from all sources
|
||||||
* 1. The minecraft jar itself (for loading of in jar mods- I would like to remove this if possible but forge depends on it at present)
|
* 1. The minecraft jar itself (for loading of in jar mods- I would like to remove this if possible but forge depends on it at present)
|
||||||
* 2. The mods directory with expanded subdirs, searching for mods named mod_*.class
|
* 2. The mods directory with expanded subdirs, searching for mods named mod_*.class
|
||||||
* 3. The mods directory for zip and jar files, searching for mod classes named mod_*.class again
|
* 3. The mods directory for zip and jar files, searching for mod classes named mod_*.class again
|
||||||
*
|
*
|
||||||
* The found resources are first loaded into the {@link #modClassLoader} (always) then scanned for class resources matching the specification above.
|
* The found resources are first loaded into the {@link #modClassLoader} (always) then scanned for class resources matching the specification above.
|
||||||
*
|
*
|
||||||
* If they provide the {@link Mod} annotation, they will be loaded as "FML mods", which currently is effectively a NO-OP.
|
* If they provide the {@link Mod} annotation, they will be loaded as "FML mods", which currently is effectively a NO-OP.
|
||||||
* If they are determined to be {@link BaseMod} subclasses they are loaded as such.
|
* If they are determined to be {@link BaseMod} subclasses they are loaded as such.
|
||||||
*
|
*
|
||||||
* Finally, if they are successfully loaded as classes, they are then added to the available mod list.
|
* Finally, if they are successfully loaded as classes, they are then added to the available mod list.
|
||||||
*/
|
*/
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -387,7 +387,7 @@ public class Loader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.fine("Minecraft jar mods loaded successfully");
|
log.fine("Minecraft jar mods loaded successfully");
|
||||||
|
|
||||||
log.info(String.format("Loading mods from %s", canonicalModsPath));
|
log.info(String.format("Loading mods from %s", canonicalModsPath));
|
||||||
File[] modList = modsDir.listFiles();
|
File[] modList = modsDir.listFiles();
|
||||||
// Sort the files into alphabetical order first
|
// Sort the files into alphabetical order first
|
||||||
|
@ -545,9 +545,10 @@ public class Loader
|
||||||
extendClassLoader(modFile);
|
extendClassLoader(modFile);
|
||||||
boolean foundAModClass = false;
|
boolean foundAModClass = false;
|
||||||
|
|
||||||
|
ZipFile jar = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ZipFile jar = new ZipFile(modFile);
|
jar = new ZipFile(modFile);
|
||||||
|
|
||||||
for (ZipEntry ze : Collections.list(jar.entries()))
|
for (ZipEntry ze : Collections.list(jar.entries()))
|
||||||
{
|
{
|
||||||
|
@ -571,6 +572,19 @@ public class Loader
|
||||||
state = State.ERRORED;
|
state = State.ERRORED;
|
||||||
capturedError = e;
|
capturedError = e;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (jar != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
jar.close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return foundAModClass;
|
return foundAModClass;
|
||||||
}
|
}
|
||||||
|
@ -612,7 +626,7 @@ public class Loader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query if we know of a mod named modname
|
* Query if we know of a mod named modname
|
||||||
*
|
*
|
||||||
* @param modname
|
* @param modname
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -628,7 +642,7 @@ public class Loader
|
||||||
{
|
{
|
||||||
return canonicalConfigDir;
|
return canonicalConfigDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCrashInformation()
|
public String getCrashInformation()
|
||||||
{
|
{
|
||||||
StringBuffer ret = new StringBuffer();
|
StringBuffer ret = new StringBuffer();
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ModLoaderHelper
|
||||||
} else {
|
} else {
|
||||||
ticks.remove(TickType.RENDER);
|
ticks.remove(TickType.RENDER);
|
||||||
}
|
}
|
||||||
// If we're enabled but we want clock ticks, or we're server side we get game ticks
|
// If we're enabled but we want clock ticks, or we're server side we get game ticks
|
||||||
if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) {
|
if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) {
|
||||||
ticks.add(TickType.GAME);
|
ticks.add(TickType.GAME);
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,7 +58,7 @@ public class ModLoaderHelper
|
||||||
} else {
|
} else {
|
||||||
ticks.remove(TickType.GUI);
|
ticks.remove(TickType.GUI);
|
||||||
}
|
}
|
||||||
// If we're enabled but we want clock ticks, or we're server side we get world ticks
|
// If we're enabled but we want clock ticks, or we're server side we get world ticks
|
||||||
if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) {
|
if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) {
|
||||||
ticks.add(TickType.WORLDGUI);
|
ticks.add(TickType.WORLDGUI);
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,7 +72,7 @@ public class ModLoaderHelper
|
||||||
*/
|
*/
|
||||||
private static ModLoaderModContainer findOrBuildModContainer(BaseMod mod)
|
private static ModLoaderModContainer findOrBuildModContainer(BaseMod mod)
|
||||||
{
|
{
|
||||||
ModLoaderModContainer mlmc=(ModLoaderModContainer) ModLoaderModContainer.findContainerFor(mod);
|
ModLoaderModContainer mlmc=(ModLoaderModContainer) FMLCommonHandler.instance().findContainerFor(mod);
|
||||||
if (mlmc==null) {
|
if (mlmc==null) {
|
||||||
mlmc=notModCallbacks.get(mod);
|
mlmc=notModCallbacks.get(mod);
|
||||||
if (mlmc==null) {
|
if (mlmc==null) {
|
||||||
|
@ -82,7 +82,7 @@ public class ModLoaderHelper
|
||||||
}
|
}
|
||||||
return mlmc;
|
return mlmc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModLoaderModContainer registerRenderHelper(BaseMod mod) {
|
public static ModLoaderModContainer registerRenderHelper(BaseMod mod) {
|
||||||
ModLoaderModContainer mlmc=findOrBuildModContainer(mod);
|
ModLoaderModContainer mlmc=findOrBuildModContainer(mod);
|
||||||
return mlmc;
|
return mlmc;
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
private ModMetadata metadata;
|
private ModMetadata metadata;
|
||||||
private ProxyInjector sidedProxy;
|
private ProxyInjector sidedProxy;
|
||||||
private BaseModTicker tickHandler;
|
private BaseModTicker tickHandler;
|
||||||
|
|
||||||
public ModLoaderModContainer(Class <? extends BaseMod > modClazz, File modSource)
|
public ModLoaderModContainer(Class <? extends BaseMod > modClazz, File modSource)
|
||||||
{
|
{
|
||||||
this.modClazz = modClazz;
|
this.modClazz = modClazz;
|
||||||
|
@ -83,7 +83,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
this.mod=instance;
|
this.mod=instance;
|
||||||
this.tickHandler = new BaseModTicker(instance);
|
this.tickHandler = new BaseModTicker(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wantsPreInit()
|
public boolean wantsPreInit()
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
|
|
||||||
boolean existingConfigFound = false;
|
boolean existingConfigFound = false;
|
||||||
boolean mlPropFound = false;
|
boolean mlPropFound = false;
|
||||||
|
|
||||||
if (modConfig.exists())
|
if (modConfig.exists())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -241,7 +241,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
Loader.log.fine(String.format("No MLProp configuration for %s found or required. No file written", modConfigName));
|
Loader.log.fine(String.format("No MLProp configuration for %s found or required. No file written", modConfigName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mlPropFound && existingConfigFound)
|
if (!mlPropFound && existingConfigFound)
|
||||||
{
|
{
|
||||||
File mlPropBackup = new File(modConfig.getParent(),modConfig.getName()+".bak");
|
File mlPropBackup = new File(modConfig.getParent(),modConfig.getName()+".bak");
|
||||||
|
@ -255,7 +255,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
{
|
{
|
||||||
Loader.log.fine(String.format("Unused MLProp configuration file for %s renamed UNSUCCESSFULLY to %s", modConfigName, mlPropBackup.getName()));
|
Loader.log.fine(String.format("Unused MLProp configuration file for %s renamed UNSUCCESSFULLY to %s", modConfigName, mlPropBackup.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
@ -363,17 +363,10 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
return mod != null ? mod.getName() : modClazz.getSimpleName();
|
return mod != null ? mod.getName() : modClazz.getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static ModContainer findContainerFor(BaseMod mod)
|
public static ModContainer findContainerFor(BaseMod mod)
|
||||||
{
|
{
|
||||||
for (ModContainer mc : Loader.getModList())
|
return FMLCommonHandler.instance().findContainerFor(mod);
|
||||||
{
|
|
||||||
if (mc.matches(mod))
|
|
||||||
{
|
|
||||||
return mc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -392,7 +385,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all the BaseMods in the system
|
* Find all the BaseMods in the system
|
||||||
* @param <A>
|
* @param <A>
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -498,7 +491,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("required-before".equals(depparts[0]) || "before".equals(depparts[0]))
|
if ("required-before".equals(depparts[0]) || "before".equals(depparts[0]))
|
||||||
{
|
{
|
||||||
postDependencies.add(depparts[1]);
|
postDependencies.add(depparts[1]);
|
||||||
|
@ -509,7 +502,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
parseFailure=true;
|
parseFailure=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseFailure) {
|
if (parseFailure) {
|
||||||
FMLCommonHandler.instance().getFMLLogger().warning(String.format("The mod %s has an incorrect dependency string {%s}", mod.getName(), mod.getPriorities()));
|
FMLCommonHandler.instance().getFMLLogger().warning(String.format("The mod %s has an incorrect dependency string {%s}", mod.getName(), mod.getPriorities()));
|
||||||
}
|
}
|
||||||
|
@ -604,7 +597,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
if (keyHandlers==null) {
|
if (keyHandlers==null) {
|
||||||
keyHandlers=new ArrayList<IKeyHandler>();
|
keyHandlers=new ArrayList<IKeyHandler>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<IKeyHandler> itr = keyHandlers.iterator();
|
Iterator<IKeyHandler> itr = keyHandlers.iterator();
|
||||||
while(itr.hasNext())
|
while(itr.hasNext())
|
||||||
{
|
{
|
||||||
|
@ -614,7 +607,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
itr.remove();
|
itr.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyHandlers.add(handler);
|
keyHandlers.add(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,9 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
*
|
*
|
||||||
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param metadata
|
* @param metadata
|
||||||
* @return
|
* @return
|
||||||
|
@ -134,7 +134,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unimplemented on the server as it does not render textures
|
* Unimplemented on the server as it does not render textures
|
||||||
*
|
*
|
||||||
* @param fileToOverride
|
* @param fileToOverride
|
||||||
* @param fileToAdd
|
* @param fileToAdd
|
||||||
* @return
|
* @return
|
||||||
|
@ -146,7 +146,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unimplemented on the server as it does not render textures
|
* Unimplemented on the server as it does not render textures
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @param overlayPath
|
* @param overlayPath
|
||||||
* @param index
|
* @param index
|
||||||
|
@ -248,7 +248,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLServerHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
|
* {@link FMLServerHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
|
@ -374,7 +374,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Get a value from a field using reflection
|
* Get a value from a field using reflection
|
||||||
* {@link ReflectionHelper#getPrivateValue(Class, Object, String)}
|
* {@link ReflectionHelper#getPrivateValue(Class, Object, String)}
|
||||||
*
|
*
|
||||||
* @param instanceclass
|
* @param instanceclass
|
||||||
* @param instance
|
* @param instance
|
||||||
* @param field
|
* @param field
|
||||||
|
@ -387,7 +387,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stubbed method on the server to return a unique model id
|
* Stubbed method on the server to return a unique model id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
||||||
{
|
{
|
||||||
|
@ -409,11 +409,11 @@ public class ModLoader
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To properly implement packet 250 protocol you should always check your
|
* To properly implement packet 250 protocol you should always check your
|
||||||
* channel is active prior to sending the packet
|
* channel is active prior to sending the packet
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param channel
|
* @param channel
|
||||||
* @return
|
* @return
|
||||||
|
@ -431,7 +431,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Is the named mod loaded?
|
* Is the named mod loaded?
|
||||||
* {@link Loader#isModLoaded(String)}
|
* {@link Loader#isModLoaded(String)}
|
||||||
*
|
*
|
||||||
* @param modname
|
* @param modname
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -483,7 +483,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
|
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -504,7 +504,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new block
|
* Register a new block
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block
|
||||||
*/
|
*/
|
||||||
public static void registerBlock(Block block)
|
public static void registerBlock(Block block)
|
||||||
|
@ -514,7 +514,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new block
|
* Register a new block
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block
|
||||||
* @param itemclass
|
* @param itemclass
|
||||||
*/
|
*/
|
||||||
|
@ -525,7 +525,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new entity ID
|
* Register a new entity ID
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -537,7 +537,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new entity ID
|
* Register a new entity ID
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -559,18 +559,18 @@ public class ModLoader
|
||||||
* channel with Forge Mod Loader, not with clients connecting- use
|
* channel with Forge Mod Loader, not with clients connecting- use
|
||||||
* BaseMod.onClientLogin to tell them about your custom channel
|
* BaseMod.onClientLogin to tell them about your custom channel
|
||||||
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
||||||
*
|
*
|
||||||
* @param mod
|
* @param mod
|
||||||
* @param channel
|
* @param channel
|
||||||
*/
|
*/
|
||||||
public static void registerPacketChannel(BaseMod mod, String channel)
|
public static void registerPacketChannel(BaseMod mod, String channel)
|
||||||
{
|
{
|
||||||
FMLCommonHandler.instance().registerChannel(ModLoaderModContainer.findContainerFor(mod), channel);
|
FMLCommonHandler.instance().registerChannel(FMLCommonHandler.instance().findContainerFor(mod), channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new tile entity class
|
* Register a new tile entity class
|
||||||
*
|
*
|
||||||
* @param tileEntityClass
|
* @param tileEntityClass
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
|
@ -586,7 +586,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a biome from the list of generated biomes
|
* Remove a biome from the list of generated biomes
|
||||||
*
|
*
|
||||||
* @param biome
|
* @param biome
|
||||||
*/
|
*/
|
||||||
public static void removeBiome(BiomeGenBase biome)
|
public static void removeBiome(BiomeGenBase biome)
|
||||||
|
@ -596,7 +596,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
*/
|
*/
|
||||||
|
@ -607,7 +607,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
* @param biomes
|
* @param biomes
|
||||||
|
@ -619,7 +619,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
*/
|
*/
|
||||||
|
@ -630,7 +630,7 @@ public class ModLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a spawn
|
* Remove a spawn
|
||||||
*
|
*
|
||||||
* @param entityName
|
* @param entityName
|
||||||
* @param spawnList
|
* @param spawnList
|
||||||
* @param biomes
|
* @param biomes
|
||||||
|
@ -670,7 +670,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Send a chat message to the server
|
* Send a chat message to the server
|
||||||
* {@link FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
* {@link FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -697,7 +697,7 @@ public class ModLoader
|
||||||
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
||||||
{
|
{
|
||||||
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
||||||
|
@ -706,7 +706,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Set a private field to a value using reflection
|
* Set a private field to a value using reflection
|
||||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
* {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
||||||
*
|
*
|
||||||
* @param instanceclass
|
* @param instanceclass
|
||||||
* @param instance
|
* @param instance
|
||||||
* @param fieldindex
|
* @param fieldindex
|
||||||
|
@ -720,7 +720,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* Set a private field to a value using reflection
|
* Set a private field to a value using reflection
|
||||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
* {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
||||||
*
|
*
|
||||||
* @param instanceclass
|
* @param instanceclass
|
||||||
* @param instance
|
* @param instance
|
||||||
* @param field
|
* @param field
|
||||||
|
@ -734,7 +734,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLServerHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
|
* {@link FMLServerHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param item
|
* @param item
|
||||||
* @param matrix
|
* @param matrix
|
||||||
|
@ -747,7 +747,7 @@ public class ModLoader
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLServerHandler#onItemSmelted(EntityPlayer, ItemStack)}
|
* {@link FMLServerHandler#onItemSmelted(EntityPlayer, ItemStack)}
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
|
@ -766,7 +766,7 @@ public class ModLoader
|
||||||
{
|
{
|
||||||
FMLCommonHandler.instance().raiseException(e, message, true);
|
FMLCommonHandler.instance().raiseException(e, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void throwException(Throwable e)
|
public static void throwException(Throwable e)
|
||||||
{
|
{
|
||||||
throwException("Exception in ModLoader", e);
|
throwException("Exception in ModLoader", e);
|
||||||
|
|
Loading…
Reference in New Issue