mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Everything except ordering
This commit is contained in:
1 parent
bc0caee371
commit
ec4750f422
18 files changed
+674
-59
No files matched your search
@@ -16,9 +16,9 @@ import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ReflectionHelper;
|
||||
import cpw.mods.fml.server.FMLHandler;
|
||||
import cpw.mods.fml.server.ModLoaderModContainer;
|
||||
import cpw.mods.fml.server.ReflectionHelper;
|
||||
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -38,147 +38,386 @@ import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public class ModLoader {
|
||||
/**
|
||||
*
|
||||
* @param achievement
|
||||
* @param name
|
||||
* @param description
|
||||
*/
|
||||
public static void addAchievementDesc(Achievement achievement, String name, String description) {
|
||||
// NOOP on the server??
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* @param id
|
||||
* @param metadata
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addAllFuel(int id, int metadata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been unimplemented in server implementations for some time.
|
||||
*
|
||||
* @param armor
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addArmor(String armor) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does not work. Creation of a BiomeGenBase is sufficient to populate this array
|
||||
*
|
||||
* @param biome
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addBiome(BiomeGenBase biome) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addLocalization(String key, String value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
* @param key
|
||||
* @param lang
|
||||
* @param value
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addLocalization(String key, String lang, String value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
* @param instance
|
||||
* @param name
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addName(Object instance, String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
* @param instance
|
||||
* @param lang
|
||||
* @param name
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addName(Object instance, String lang, String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not render textures
|
||||
* @param fileToOverride
|
||||
* @param fileToAdd
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addOverride(String fileToOverride, String fileToAdd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not render textures
|
||||
* @param path
|
||||
* @param overlayPath
|
||||
* @param index
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addOverride(String path, String overlayPath, int index) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Shaped Recipe
|
||||
* @param output
|
||||
* @param params
|
||||
*/
|
||||
public static void addRecipe(ItemStack output, Object... params) {
|
||||
CommonRegistry.addRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a shapeless recipe
|
||||
* @param output
|
||||
* @param params
|
||||
*/
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params) {
|
||||
CommonRegistry.addShapelessRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new product to be smelted
|
||||
* @param input
|
||||
* @param output
|
||||
*/
|
||||
public static void addSmelting(int input, ItemStack output) {
|
||||
CommonRegistry.addSmelting(input, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
* @param entityClass
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList) {
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList);
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
* @param entityClass
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes) {
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
* @param entityName
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList) {
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList);
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
* @param entityName
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes) {
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param xVel
|
||||
* @param zVel
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently unimplemented
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void genericContainerRemoval(World world, int x, int y, int z) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all BaseMod loaded into the system
|
||||
* @return
|
||||
*/
|
||||
public static List<BaseMod> getLoadedMods() {
|
||||
return ModLoaderModContainer.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a logger instance
|
||||
* @return
|
||||
*/
|
||||
public static Logger getLogger() {
|
||||
return FMLHandler.getFMLLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @return
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex) {
|
||||
return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field) {
|
||||
return ReflectionHelper.getPrivateValue(instanceclass, instance, field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new unique entity id
|
||||
* @return
|
||||
*/
|
||||
public static int getUniqueEntityId() {
|
||||
return 0;
|
||||
return Entity.getNextId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the named mod loaded?
|
||||
* @param modname
|
||||
* @return
|
||||
*/
|
||||
public static boolean isModLoaded(String modname) {
|
||||
return Loader.isModLoaded(modname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server. New code that didn't exist prior to this implementation
|
||||
* @param packet
|
||||
*/
|
||||
@Deprecated
|
||||
public static void receivePacket(Packet250CustomPayload packet) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new block
|
||||
* @param block
|
||||
*/
|
||||
public static void registerBlock(Block block) {
|
||||
CommonRegistry.registerBlock(block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new block
|
||||
* @param block
|
||||
* @param itemclass
|
||||
*/
|
||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass) {
|
||||
CommonRegistry.registerBlock(block, itemclass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new entity ID
|
||||
* @param entityClass
|
||||
* @param entityName
|
||||
* @param id
|
||||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id) {
|
||||
CommonRegistry.registerEntityID(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new entity ID
|
||||
* @param entityClass
|
||||
* @param entityName
|
||||
* @param id
|
||||
* @param background
|
||||
* @param foreground
|
||||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground) {
|
||||
CommonRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented at present
|
||||
* @param mod
|
||||
* @param channel
|
||||
*/
|
||||
public static void registerPacketChannel(BaseMod mod, String channel) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new tile entity class
|
||||
* @param tileEntityClass
|
||||
* @param id
|
||||
*/
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id) {
|
||||
CommonRegistry.registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a biome. This code will probably not work correctly.
|
||||
* @param biome
|
||||
*/
|
||||
@Deprecated
|
||||
public static void removeBiome(BiomeGenBase biome) {
|
||||
CommonRegistry.removeBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
* @param entityClass
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList) {
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList);
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList, FMLHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
* @param entityClass
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes) {
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
* @param entityName
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList) {
|
||||
CommonRegistry.removeSpawn(entityName, spawnList);
|
||||
CommonRegistry.removeSpawn(entityName, spawnList, FMLHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
* @param entityName
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes) {
|
||||
CommonRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation of the modloader API does not have "configuration" to save.
|
||||
*/
|
||||
public static void saveConfig() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is unimplemented on the server: it is meant for clients to send chat to the server
|
||||
* @param text
|
||||
*/
|
||||
@Deprecated
|
||||
public static void serverChat(String text) {
|
||||
}
|
||||
|
||||
@@ -197,25 +436,61 @@ public class ModLoader {
|
||||
mlmc.setTicking(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a private field to a value using reflection
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @param value
|
||||
*/
|
||||
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, int fieldindex, E value) {
|
||||
ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a private field to a value using reflection
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @param value
|
||||
*/
|
||||
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, String field, E value) {
|
||||
ReflectionHelper.setPrivateValue(instanceclass, instance, field, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* @param player
|
||||
* @param item
|
||||
* @param matrix
|
||||
*/
|
||||
@Deprecated
|
||||
public static void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
@Deprecated
|
||||
public static void takenFromFurnace(EntityPlayer player, ItemStack item) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw the offered exception. Likely will stop the game.
|
||||
* @param message
|
||||
* @param e
|
||||
*/
|
||||
public static void throwException(String message, Throwable e) {
|
||||
FMLHandler.INSTANCE.raiseException(e, message, true);
|
||||
FMLHandler.instance().raiseException(e, message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minecraft server instance
|
||||
* @return
|
||||
*/
|
||||
public static MinecraftServer getMinecraftServerInstance() {
|
||||
return FMLHandler.INSTANCE.getServer();
|
||||
return FMLHandler.instance().getServer();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user