Bukkitside fixup

This commit is contained in:
Christian Weeks 2012-06-01 00:27:46 -04:00
parent 51701d09fd
commit 4085617ca2
5 changed files with 360 additions and 83 deletions

View file

@ -23,7 +23,7 @@
</condition> </condition>
</sequential> </sequential>
</macrodef> </macrodef>
<target name="writeversion"> <target name="writeversion" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}" failonerror="true"> <exec executable="${python.exe}" dir="${basedir}" failonerror="true">
<arg value="${basedir}/getversion.py" /> <arg value="${basedir}/getversion.py" />
</exec> </exec>
@ -32,7 +32,7 @@
</propertyfile> </propertyfile>
</target> </target>
<target name="init"> <target name="buildenvsetup">
<tstamp> <tstamp>
<format pattern="yyMMddHHmmss" property="timestamp" /> <format pattern="yyMMddHHmmss" property="timestamp" />
</tstamp> </tstamp>
@ -61,6 +61,9 @@
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1"> <condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
<isset property="env.BUILD_NUMBER" /> <isset property="env.BUILD_NUMBER" />
</condition> </condition>
</target>
<target name="init" depends="buildenvsetup">
<antcall target="writeversion" /> <antcall target="writeversion" />
<property file="fmlversion.properties" /> <property file="fmlversion.properties" />
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" /> <property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />

View file

@ -22,6 +22,10 @@ import java.util.Properties;
import java.util.Random; import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.server.Block;
import net.minecraft.server.Item;
import net.minecraft.server.LocaleLanguage;
import net.minecraft.server.MLProp;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.BaseMod; import net.minecraft.server.BaseMod;
import net.minecraft.server.BiomeBase; import net.minecraft.server.BiomeBase;
@ -37,6 +41,7 @@ import net.minecraft.server.Packet250CustomPayload;
import net.minecraft.server.Packet3Chat; import net.minecraft.server.Packet3Chat;
import net.minecraft.server.BukkitRegistry; import net.minecraft.server.BukkitRegistry;
import net.minecraft.server.World; import net.minecraft.server.World;
import net.minecraft.server.WorldType;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFMLSidedHandler; import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
@ -145,6 +150,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Get the server instance * Get the server instance
*
* @return * @return
*/ */
public MinecraftServer getServer() public MinecraftServer getServer()
@ -227,6 +233,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Called to notify that an item was picked up from the world * Called to notify that an item was picked up from the world
*
* @param entityItem * @param entityItem
* @param entityPlayer * @param entityPlayer
*/ */
@ -243,6 +250,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Raise an exception * Raise an exception
*
* @param exception * @param exception
* @param message * @param message
* @param stopGame * @param stopGame
@ -288,6 +296,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Build a list of default overworld biomes * Build a list of default overworld biomes
*
* @return * @return
*/ */
public BiomeBase[] getDefaultOverworldBiomes() public BiomeBase[] getDefaultOverworldBiomes()
@ -315,6 +324,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Called when an item is crafted * Called when an item is crafted
*
* @param player * @param player
* @param craftedItem * @param craftedItem
* @param craftingGrid * @param craftingGrid
@ -369,6 +379,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Called when a packet 250 packet is received from the player * Called when a packet 250 packet is received from the player
*
* @param packet * @param packet
* @param player * @param player
*/ */
@ -390,6 +401,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Handle register requests for packet 250 channels * Handle register requests for packet 250 channels
*
* @param packet * @param packet
*/ */
private void handleClientRegistration(Packet250CustomPayload packet, EntityHuman player) private void handleClientRegistration(Packet250CustomPayload packet, EntityHuman player)
@ -425,6 +437,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
/** /**
* Handle a login * Handle a login
*
* @param loginPacket * @param loginPacket
* @param networkManager * @param networkManager
*/ */
@ -448,6 +461,7 @@ public class FMLBukkitHandler implements IFMLSidedHandler
} }
} }
} }
/** /**
* Are we a server? * Are we a server?
*/ */
@ -518,28 +532,46 @@ public class FMLBukkitHandler implements IFMLSidedHandler
} }
} }
/**
* @param biome
*/
public void addBiomeToDefaultWorldGenerator(BiomeBase biome)
{
WorldType.NORMAL.addNewBiome(biome);
}
@Override @Override
public Object getMinecraftInstance() { public Object getMinecraftInstance() {
// TODO Auto-generated method stub return server;
return null;
} }
@Override @Override
public String getCurrentLanguage() { public String getCurrentLanguage()
// TODO Auto-generated method stub {
return null; return LocaleLanguage.a().getCurrentLanguage();
} }
@Override @Override
public Properties getCurrentLanguageTable() { public Properties getCurrentLanguageTable()
// TODO Auto-generated method stub {
return null; return LocaleLanguage.a().getCurrentLanguageTable();
} }
@Override @Override
public String getObjectName(Object minecraftObject) { public String getObjectName(Object instance)
// TODO Auto-generated method stub {
return null; String objectName;
if (instance instanceof Item) {
objectName=((Item)instance).getName();
} else if (instance instanceof Block) {
objectName=((Block)instance).getName();
} else if (instance instanceof ItemStack) {
objectName=Item.byId[((ItemStack)instance).id].a((ItemStack)instance);
} else {
throw new IllegalArgumentException(String.format("Illegal object for naming %s",instance));
}
objectName+=".name";
return objectName;
} }
@Override @Override
@ -562,7 +594,10 @@ public class FMLBukkitHandler implements IFMLSidedHandler
@Override @Override
public ModProperty getModLoaderPropertyFor(Field f) { public ModProperty getModLoaderPropertyFor(Field f) {
// TODO Auto-generated method stub if (f.isAnnotationPresent(MLProp.class)) {
MLProp prop = f.getAnnotation(MLProp.class);
return new ModProperty(prop.info(), prop.min(), prop.max(), prop.name());
}
return null; return null;
} }
} }

View file

@ -12,22 +12,31 @@
*/ */
package net.minecraft.server; package net.minecraft.server;
import java.util.Map;
import java.util.Random; import java.util.Random;
import org.bukkit.craftbukkit.generator.NetherChunkGenerator; import org.bukkit.craftbukkit.generator.NetherChunkGenerator;
import org.bukkit.craftbukkit.generator.NormalChunkGenerator; import org.bukkit.craftbukkit.generator.NormalChunkGenerator;
import cpw.mods.fml.common.IConsoleHandler; import cpw.mods.fml.common.ModContainer.TickType;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.IDispenseHandler;
import cpw.mods.fml.common.INetworkHandler;
import cpw.mods.fml.common.IPickupNotifier;
import cpw.mods.fml.common.IPlayerTracker;
import cpw.mods.fml.common.IWorldGenerator;
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
{ {
// CALLBACK MECHANISMS // CALLBACK MECHANISMS
/**
* @param minecraftInstance
* @return
*/
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object minecraftInstance, Object... data)
{
if (tick==TickType.WORLD && tickEnd) {
return onTickInGame((MinecraftServer)minecraftInstance);
} else {
return false;
}
}
@Override @Override
public final void onCrafting(Object... craftingParameters) public final void onCrafting(Object... craftingParameters)
{ {
@ -39,6 +48,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
{ {
takenFromFurnace((EntityHuman)smeltingParameters[0], (ItemStack)smeltingParameters[1]); takenFromFurnace((EntityHuman)smeltingParameters[0], (ItemStack)smeltingParameters[1]);
} }
@Override @Override
public final boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data) public final boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data)
{ {
@ -50,6 +60,15 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
{ {
return onChatMessageReceived((EntityHuman)data[1], (Packet3Chat)data[0]); return onChatMessageReceived((EntityHuman)data[1], (Packet3Chat)data[0]);
} }
@Override
public final void onServerLogin(Object handler) {
// NOOP
}
public final void onServerLogout() {
// NOOP
}
@Override @Override
public final void onPlayerLogin(Object player) public final void onPlayerLogin(Object player)
{ {
@ -57,13 +76,13 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
} }
@Override @Override
public void onPlayerLogout(Object player) public final void onPlayerLogout(Object player)
{ {
onClientLogout((EntityHuman)player); onClientLogout((EntityHuman)player);
} }
@Override @Override
public void onPlayerChangedDimension(Object player) public final void onPlayerChangedDimension(Object player)
{ {
onClientDimensionChanged((EntityHuman)player); onClientDimensionChanged((EntityHuman)player);
} }
@ -98,14 +117,28 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
} }
} }
/**
* NO-OP on client side
*/
@Override @Override
public final boolean handleCommand(String command, Object... data) public final boolean handleCommand(String command, Object... data)
{ {
return onServerCommand(command, (String)data[0], (ICommandListener)data[1]); return onServerCommand(command, (String)data[0], (ICommandListener)data[1]);
} }
@Override
public void onRegisterAnimations() {
// NOOP on servers
}
@Override
public void onRenderHarvest(Map renderers) {
// NOOP on servers
}
// BASEMOD API // BASEMOD API
/** /**
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item * Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
*
* @param id * @param id
* @param metadata * @param metadata
* @return * @return
@ -115,8 +148,14 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
return 0; return 0;
} }
public void addRenderer(Map<Class<? extends Entity>, Object> renderers)
{
}
/** /**
* Override if you wish to perform some action other than just dispensing the item from the dispenser * Override if you wish to perform some action other than just dispensing the item from the dispenser
*
* @param world * @param world
* @param x * @param x
* @param y * @param y
@ -133,6 +172,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Override if you wish to generate Nether (Hell biome) blocks * Override if you wish to generate Nether (Hell biome) blocks
*
* @param world * @param world
* @param random * @param random
* @param chunkX * @param chunkX
@ -144,6 +184,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Override if you wish to generate Overworld (not hell or the end) blocks * Override if you wish to generate Overworld (not hell or the end) blocks
*
* @param world * @param world
* @param random * @param random
* @param chunkX * @param chunkX
@ -155,6 +196,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Return the name of your mod. Defaults to the class name * Return the name of your mod. Defaults to the class name
*
* @return * @return
*/ */
public String getName() public String getName()
@ -164,19 +206,26 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Get your mod priorities * Get your mod priorities
*
* @return * @return
*/ */
public String getPriorities() public String getPriorities()
{ {
return null; return "";
} }
/** /**
* Return the version of your mod * Return the version of your mod
*
* @return * @return
*/ */
public abstract String getVersion(); public abstract String getVersion();
public void keyboardEvent(Object event)
{
}
/** /**
* Load your mod * Load your mod
*/ */
@ -191,6 +240,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Handle item pickup * Handle item pickup
*
* @param player * @param player
* @param item * @param item
*/ */
@ -200,6 +250,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)} * Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
*
* @param minecraftServer the server * @param minecraftServer the server
* @return true to continue receiving ticks * @return true to continue receiving ticks
*/ */
@ -208,28 +259,52 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
return false; return false;
} }
/** public boolean onTickInGUI(float tick, Object game, Object gui)
* Not implemented because on the server you don't know who it's from
* {@link #onChatMessageReceived(EntityHuman, Packet3Chat)}
* @param text
*/
@Deprecated
public void receiveChatPacket(String text)
{ {
return false;
} }
/** /**
* Not implemented because on the server you don't know who it's from * Only implemented on the client side
* {@link #onPacket250Received(EntityHuman, Packet250CustomPayload)} * {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)}
*
* @param text
*/
public void receiveChatPacket(String text)
{
}
/**
* Only called on the client side
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)}
*
* @param packet * @param packet
*/ */
@Deprecated
public void receiveCustomPacket(Packet250CustomPayload packet) public void receiveCustomPacket(Packet250CustomPayload packet)
{ {
}
public void registerAnimation(Object game)
{
}
public void renderInvBlock(Object renderer, Block block, int metadata, int modelID)
{
}
public boolean renderWorldBlock(Object renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
{
return false;
} }
/** /**
* Called when someone crafts an item from a crafting table * Called when someone crafts an item from a crafting table
*
* @param player * @param player
* @param item * @param item
* @param matrix * @param matrix
@ -269,6 +344,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/** /**
* Called when a chat message is received. Return true to stop further processing * Called when a chat message is received. Return true to stop further processing
*
* @param source * @param source
* @param chat * @param chat
* @return true if you want to consume the message so it is not available for further processing * @return true if you want to consume the message so it is not available for further processing

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.minecraft.src.BiomeGenBase; import net.minecraft.src.BiomeGenBase;
import cpw.mods.fml.common.registry.IMinecraftRegistry; import cpw.mods.fml.common.registry.IMinecraftRegistry;
import cpw.mods.fml.server.FMLBukkitHandler;
public class BukkitRegistry implements IMinecraftRegistry public class BukkitRegistry implements IMinecraftRegistry
{ {
@ -71,7 +72,7 @@ public class BukkitRegistry implements IMinecraftRegistry
@Override @Override
public void addBiome(BiomeGenBase biome) public void addBiome(BiomeGenBase biome)
{ {
//TODO FMLBukkitHandler.instance().addBiomeToDefaultWorldGenerator((BiomeBase) biome);
} }
@Override @Override

View file

@ -13,6 +13,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -34,12 +35,16 @@ public class ModLoader
*/ */
public static void addAchievementDesc(Achievement achievement, String name, String description) public static void addAchievementDesc(Achievement achievement, String name, String description)
{ {
String achName=achievement.getName();
addLocalization(achName, name);
addLocalization(achName+".desc", description);
} }
/** /**
* 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 FMLBukkitHandler#fuelLookup(int, int)} * {@link FMLCommonHandler#fuelLookup(int, int)}
*
* @param id * @param id
* @param metadata * @param metadata
* @return * @return
@ -50,77 +55,88 @@ public class ModLoader
return 0; return 0;
} }
public static void addAllRenderers(Map<Class<? extends Entity>, Object> renderers)
{
}
public static void addAnimation(Object anim)
{
}
/** /**
* This method is unimplemented in server versions to date. * This method is unimplemented in server versions to date.
* *
* @param armor * @param armor
* @return * @return
*/ */
@Deprecated
public static int addArmor(String armor) public static int addArmor(String armor)
{ {
return 0; return 0;
} }
/** /**
* This method does not work. Creation of a BiomeGenBase is sufficient to populate this array. Using this method will likely corrupt worlds. * This method adds the supplied biome to the set of candidate biomes for the default world generator type.
* *
* @param biome * @param biome
*/ */
@Deprecated
public static void addBiome(BiomeBase biome) public static void addBiome(BiomeBase biome)
{ {
FMLRegistry.addBiome(biome);
} }
/** /**
* Unimplemented on the server as it does not generate names * Add localization for the specified string
*
* @param key * @param key
* @param value * @param value
*/ */
@Deprecated
public static void addLocalization(String key, String value) public static void addLocalization(String key, String value)
{ {
addLocalization(key, "en_US", value);
} }
/** /**
* Unimplemented on the server as it does not generate names * Add localization for the specified string
*
* @param key * @param key
* @param lang * @param lang
* @param value * @param value
*/ */
@Deprecated
public static void addLocalization(String key, String lang, String value) public static void addLocalization(String key, String lang, String value)
{ {
FMLCommonHandler.instance().addStringLocalization(key, lang, value);
} }
/** /**
* Unimplemented on the server as it does not generate names * Name the specified minecraft object with the supplied name
*
* @param instance * @param instance
* @param name * @param name
*/ */
@Deprecated
public static void addName(Object instance, String name) public static void addName(Object instance, String name)
{ {
addName(instance,"en_US",name);
} }
/** /**
* Unimplemented on the server as it does not generate names * Unimplemented on the server as it does not generate names
*
* @param instance * @param instance
* @param lang * @param lang
* @param name * @param name
*/ */
@Deprecated
public static void addName(Object instance, String lang, String name) public static void addName(Object instance, String lang, String name)
{ {
FMLCommonHandler.instance().addNameForObject(instance, lang, name);
} }
/** /**
* 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
*/ */
@Deprecated
public static int addOverride(String fileToOverride, String fileToAdd) public static int addOverride(String fileToOverride, String fileToAdd)
{ {
return 0; return 0;
@ -128,17 +144,19 @@ 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
*/ */
@Deprecated
public static void addOverride(String path, String overlayPath, int index) public static void addOverride(String path, String overlayPath, int index)
{ {
// NOOP
} }
/** /**
* Add a Shaped Recipe * Add a Shaped Recipe
*
* @param output * @param output
* @param params * @param params
*/ */
@ -149,6 +167,7 @@ public class ModLoader
/** /**
* Add a shapeless recipe * Add a shapeless recipe
*
* @param output * @param output
* @param params * @param params
*/ */
@ -159,6 +178,7 @@ public class ModLoader
/** /**
* Add a new product to be smelted * Add a new product to be smelted
*
* @param input * @param input
* @param output * @param output
*/ */
@ -169,6 +189,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
@ -196,6 +217,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
@ -224,6 +246,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 FMLBukkitHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} * {@link FMLBukkitHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
*
* @param world * @param world
* @param x * @param x
* @param y * @param y
@ -241,6 +264,7 @@ public class ModLoader
/** /**
* Remove a container and drop all the items in it on the ground around * Remove a container and drop all the items in it on the ground around
*
* @param world * @param world
* @param x * @param x
* @param y * @param y
@ -299,6 +323,7 @@ public class ModLoader
/** /**
* Get a list of all BaseMod loaded into the system * Get a list of all BaseMod loaded into the system
* {@link ModLoaderModContainer#findAll} * {@link ModLoaderModContainer#findAll}
*
* @return * @return
*/ */
public static List<BaseMod> getLoadedMods() public static List<BaseMod> getLoadedMods()
@ -307,8 +332,8 @@ public class ModLoader
} }
/** /**
* Get a logger instance * Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
* {@link FMLBukkitHandler#getFMLLogger()} *
* @return * @return
*/ */
public static Logger getLogger() public static Logger getLogger()
@ -316,9 +341,24 @@ public class ModLoader
return FMLCommonHandler.instance().getFMLLogger(); return FMLCommonHandler.instance().getFMLLogger();
} }
public static Object getMinecraftInstance()
{
return getMinecraftServerInstance();
}
/**
* Get the minecraft server instance
* {@link FMLServerHandler#getServer()}
* @return
*/
public static MinecraftServer getMinecraftServerInstance()
{
return FMLBukkitHandler.instance().getServer();
}
/** /**
* Get a value from a field using reflection * Get a value from a field using reflection
* {@link ReflectionHelper#getPrivateValue(Class, Object, int)} * {@link ReflectionHelper#getPrivateValue(Class, Object, int)}
*
* @param instanceclass * @param instanceclass
* @param instance * @param instance
* @param fieldindex * @param fieldindex
@ -332,6 +372,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
@ -342,19 +383,53 @@ public class ModLoader
return ReflectionHelper.getPrivateValue(instanceclass, instance, field); return ReflectionHelper.getPrivateValue(instanceclass, instance, field);
} }
/**
* Stubbed method on the server to return a unique model id
*
*/
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
{
return -1;
}
/** /**
* Get a new unique entity id * Get a new unique entity id
* {@link Entity#getNextId()} * {@link Entity#getNextId()}
*
* @return * @return
*/ */
public static int getUniqueEntityId() public static int getUniqueEntityId()
{ {
return Entity.getNextId(); return FMLCommonHandler.instance().nextUniqueEntityListId();
}
public static int getUniqueSpriteIndex(String path)
{
return -1;
}
/**
* To properly implement packet 250 protocol you should always check your
* channel is active prior to sending the packet
*
* @param player
* @param channel
* @return
*/
public static boolean isChannelActive(EntityPlayer player, String channel)
{
return FMLCommonHandler.instance().isChannelActive(channel, player);
}
public static boolean isGUIOpen(Class<?> gui)
{
return false;
} }
/** /**
* Is the named mod loaded? * Is the named mod loaded?
* {@link Loader#isModLoaded(String)} * {@link Loader#isModLoaded(String)}
*
* @param modname * @param modname
* @return * @return
*/ */
@ -363,9 +438,50 @@ public class ModLoader
return Loader.isModLoaded(modname); return Loader.isModLoaded(modname);
} }
/**
* Implemented elsewhere
*/
@Deprecated
public static void loadConfig()
{
}
public static Object loadImage(Object renderEngine, String path) throws Exception
{
return null;
}
/**
* Call in from elsewhere. Unimplemented here.
* @param player
* @param item
*/
@Deprecated
public static void onItemPickup(EntityPlayer player, ItemStack item)
{
}
/**
* Call in from elsewhere. Unimplemented here.
*/
@Deprecated
public static void onTick(float tick, Object game)
{
}
public static void openGUI(EntityPlayer player, Object gui)
{
// NOOP
}
@Deprecated
public static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
{
}
/** /**
* 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 FMLBukkitHandler#handlePacket250(Packet250CustomPayload, EntityHuman)} * {@link FMLBukkitHandler#handlePacket250(Packet250CustomPayload, EntityHuman)}
*
* @param packet * @param packet
*/ */
@Deprecated @Deprecated
@ -373,8 +489,20 @@ public class ModLoader
{ {
} }
@Deprecated
public static Object[] registerAllKeys(Object[] keys)
{
return keys;
}
@Deprecated
public static void registerAllTextureOverrides(Object cache)
{
}
/** /**
* Register a new block * Register a new block
*
* @param block * @param block
*/ */
public static void registerBlock(Block block) public static void registerBlock(Block block)
@ -384,6 +512,7 @@ public class ModLoader
/** /**
* Register a new block * Register a new block
*
* @param block * @param block
* @param itemclass * @param itemclass
*/ */
@ -394,6 +523,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
@ -405,6 +535,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
@ -416,10 +547,17 @@ public class ModLoader
FMLRegistry.registerEntityID(entityClass, entityName, id, background, foreground); FMLRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
} }
public static void registerKey(BaseMod mod, Object keyHandler, boolean allowRepeat)
{
// NOOP
}
/** /**
* Register the mod for packets on this channel. This only registers the channel with Forge Mod Loader, not * Register the mod for packets on this channel. This only registers the
* with clients connecting- use BaseMod.onClientLogin to tell them about your custom channel * channel with Forge Mod Loader, not with clients connecting- use
* 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
*/ */
@ -430,6 +568,7 @@ public class ModLoader
/** /**
* Register a new tile entity class * Register a new tile entity class
*
* @param tileEntityClass * @param tileEntityClass
* @param id * @param id
*/ */
@ -438,11 +577,16 @@ public class ModLoader
FMLRegistry.registerTileEntity(tileEntityClass, id); FMLRegistry.registerTileEntity(tileEntityClass, id);
} }
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, Object renderer)
{
FMLRegistry.instance().registerTileEntity(tileEntityClass, id);
}
/** /**
* Remove a biome. This code will probably not work correctly and will likely corrupt worlds. * Remove a biome from the list of generated biomes
*
* @param biome * @param biome
*/ */
@Deprecated
public static void removeBiome(BiomeBase biome) public static void removeBiome(BiomeBase biome)
{ {
FMLRegistry.removeBiome(biome); FMLRegistry.removeBiome(biome);
@ -450,6 +594,7 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityClass * @param entityClass
* @param spawnList * @param spawnList
*/ */
@ -460,6 +605,7 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityClass * @param entityClass
* @param spawnList * @param spawnList
* @param biomes * @param biomes
@ -471,6 +617,7 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityName * @param entityName
* @param spawnList * @param spawnList
*/ */
@ -481,6 +628,7 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityName * @param entityName
* @param spawnList * @param spawnList
* @param biomes * @param biomes
@ -490,6 +638,24 @@ public class ModLoader
FMLRegistry.removeSpawn(entityName, spawnList, biomes); FMLRegistry.removeSpawn(entityName, spawnList, biomes);
} }
@Deprecated
public static boolean renderBlockIsItemFull3D(int modelID)
{
return false;
}
@Deprecated
public static void renderInvBlock(Object renderer, Block block, int metadata, int modelID)
{
// NOOP
}
@Deprecated
public static boolean renderWorldBlock(Object renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
{
return false;
}
/** /**
* Configuration is handled elsewhere * Configuration is handled elsewhere
* {@link ModLoaderModContainer} * {@link ModLoaderModContainer}
@ -500,33 +666,45 @@ public class ModLoader
} }
/** /**
* This method is unimplemented on the server: it is meant for clients to send chat to the server * Send a chat message to the server
* {@link FMLBukkitHandler#handleChatPacket(Packet3Chat, EntityHuman)} * {@link FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
*
* @param text * @param text
*/ */
@Deprecated @Deprecated
public static void serverChat(String text) public static void serverChat(String text)
{ {
//TODO
}
@Deprecated
public static void serverLogin(Object handler, Packet1Login loginPacket)
{
//TODO
} }
/** /**
* Indicate that you want to receive ticks * Indicate that you want to receive ticks
* *
* @param mod * @param mod receiving the events
* receiving the events * @param enable indicates whether you want to recieve them or not
* @param enable * @param useClock Not used in server side: all ticks are sent on the server side (no render subticks)
* indicates whether you want to recieve them or not
* @param useClock
* Not used in server side: all ticks are sent on the server side (no render subticks)
*/ */
public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock) public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
{ {
ModLoaderHelper.updateStandardTicks(mod, enable, useClock); ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
} }
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
{
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
}
/** /**
* 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
@ -540,6 +718,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
@ -553,6 +732,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 FMLBukkitHandler#onItemCrafted(EntityHuman, ItemStack, IInventory)} * {@link FMLBukkitHandler#onItemCrafted(EntityHuman, ItemStack, IInventory)}
*
* @param player * @param player
* @param item * @param item
* @param matrix * @param matrix
@ -565,6 +745,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 FMLBukkitHandler#onItemSmelted(EntityHuman, ItemStack)} * {@link FMLBukkitHandler#onItemSmelted(EntityHuman, ItemStack)}
*
* @param player * @param player
* @param item * @param item
*/ */
@ -584,16 +765,6 @@ public class ModLoader
FMLBukkitHandler.instance().raiseException(e, message, true); FMLBukkitHandler.instance().raiseException(e, message, true);
} }
/**
* Get the minecraft server instance
* {@link FMLBukkitHandler#getServer()}
* @return
*/
public static MinecraftServer getMinecraftServerInstance()
{
return FMLBukkitHandler.instance().getServer();
}
/** /**
* To properly implement packet 250 protocol you should always check your channel * To properly implement packet 250 protocol you should always check your channel
* is active prior to sending the packet * is active prior to sending the packet
@ -606,13 +777,4 @@ public class ModLoader
{ {
return FMLCommonHandler.instance().isChannelActive(channel, player); return FMLCommonHandler.instance().isChannelActive(channel, player);
} }
/**
* Stubbed method on the server to return a unique model id
*
*/
@Deprecated
public static int getUniqueBlockModelID(BaseMod mod, boolean flag) {
return 0;
}
} }