From 813ad71f13024578ccf70e0d76071b3608ec55a6 Mon Sep 17 00:00:00 2001 From: Christian Weeks Date: Thu, 10 May 2012 18:54:25 -0400 Subject: [PATCH] Tidy up a lot of code- ModLoader and BaseMod are now almost identical client and server side --- .../cpw/mods/fml/client/FMLClientHandler.java | 79 ++--- .../mods/fml/client/KeyBindingHandler.java | 14 +- .../cpw/mods/fml/client/SpriteHelper.java | 6 +- fml/client/net/minecraft/src/BaseMod.java | 82 +++-- fml/client/net/minecraft/src/ModLoader.java | 128 ++++---- .../minecraft/src/ModTextureAnimation.java | 4 +- .../net/minecraft/src/ModTextureStatic.java | 4 +- .../cpw/mods/fml/common/FMLCommonHandler.java | 56 +++- .../cpw/mods/fml/common/FMLModContainer.java | 21 ++ .../cpw/mods/fml/common/IFMLSidedHandler.java | 3 + .../cpw/mods/fml/common/IKeyHandler.java | 5 + .../cpw/mods/fml/common/ModContainer.java | 21 ++ .../modloader/ModLoaderModContainer.java | 22 +- .../.settings/org.eclipse.jdt.ui.prefs | 1 + .../net/minecraft/src/RenderBlocks.java.patch | 57 ++-- .../minecraft/src/StringTranslate.java.patch | 9 + .../net/minecraft/src/StatBase.java.patch | 11 + .../minecraft/src/StringTranslate.java.patch | 7 +- .../src/TileEntityFurnace.java.patch | 4 +- .../cpw/mods/fml/server/FMLServerHandler.java | 32 +- fml/server/net/minecraft/src/BaseMod.java | 119 ++++++-- fml/server/net/minecraft/src/ModLoader.java | 289 +++++++++++++----- 22 files changed, 701 insertions(+), 273 deletions(-) create mode 100644 fml/patches/minecraft_server/net/minecraft/src/StatBase.java.patch diff --git a/fml/client/cpw/mods/fml/client/FMLClientHandler.java b/fml/client/cpw/mods/fml/client/FMLClientHandler.java index 4b6b32161..95b830afd 100644 --- a/fml/client/cpw/mods/fml/client/FMLClientHandler.java +++ b/fml/client/cpw/mods/fml/client/FMLClientHandler.java @@ -20,6 +20,7 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Properties; import java.util.Random; import java.util.logging.Logger; @@ -37,6 +38,7 @@ import net.minecraft.src.GuiScreen; import net.minecraft.src.IBlockAccess; import net.minecraft.src.IChunkProvider; import net.minecraft.src.IInventory; +import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.KeyBinding; import net.minecraft.src.NetworkManager; @@ -96,8 +98,10 @@ public class FMLClientHandler implements IFMLSidedHandler private int nextRenderId = 30; + // Cached lookups private static HashMap> overrideInfo = new HashMap>(); - private static HashMap blockModelIds = new HashMap(); + private static HashMap blockModelIds = new HashMap(); + private static HashMap keyBindings = new HashMap(); /** * Called to start the whole game off from @@ -158,6 +162,7 @@ public class FMLClientHandler implements IFMLSidedHandler int i=0; for (IKeyHandler key : allKeys) { keys[i++]=(KeyBinding)key.getKeyBinding(); + keyBindings.put((KeyBinding) key.getKeyBinding(), key.getOwningContainer()); } return keys; } @@ -233,25 +238,6 @@ public class FMLClientHandler implements IFMLSidedHandler } } - /** - * Called from the furnace to lookup fuel values - * - * @param itemId - * @param itemDamage - * @return - */ - public int fuelLookup(int itemId, int itemDamage) - { - int fv = 0; - - for (ModContainer mod : Loader.getModList()) - { - fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage)); - } - - return fv; - } - /** * Is the offered class and instance of BaseMod and therefore a ModLoader * mod? @@ -288,19 +274,6 @@ public class FMLClientHandler implements IFMLSidedHandler } } - /** - * Raise an exception - * - * @param exception - * @param message - * @param stopGame - */ - public void raiseException(Throwable exception, String message, boolean stopGame) - { - FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception); - throw new RuntimeException(exception); - } - /** * Attempt to dispense the item as an entity other than just as a the item * itself @@ -556,6 +529,9 @@ public class FMLClientHandler implements IFMLSidedHandler return StringTranslate.func_20162_a().func_44024_c(); } + public Properties getCurrentLanguageTable() { + return StringTranslate.func_20162_a().getTranslationTable(); + } /** * @param armor * @return @@ -629,7 +605,7 @@ public class FMLClientHandler implements IFMLSidedHandler public void registerKeyHandler(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat) { ModLoaderModContainer mlmc=ModLoaderHelper.registerKeyHelper(mod); - mlmc.addKeyHandler(new KeyBindingHandler(keyHandler, allowRepeat)); + mlmc.addKeyHandler(new KeyBindingHandler(keyHandler, allowRepeat, mlmc)); } /** @@ -642,13 +618,14 @@ public class FMLClientHandler implements IFMLSidedHandler * @param modelID * @return */ - public boolean onRenderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID) + public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID) { - ModLoaderModContainer mod = blockModelIds.get(modelID); + ModContainer mod = blockModelIds.get(modelID); if (mod == null) { return false; } + mod.renderWorldBlock(world, x, y, z, block, modelID, renderer); return ((BaseMod)mod.getMod()).renderWorldBlock(renderer, world, x, y, z, block, modelID); } @@ -658,12 +635,36 @@ public class FMLClientHandler implements IFMLSidedHandler * @param metadata * @param modelID */ - public void onRenderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID) + public void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID) { - ModLoaderModContainer mod = blockModelIds.get(modelID); + ModContainer mod = blockModelIds.get(modelID); if (mod != null) { - ((BaseMod)mod.getMod()).renderInvBlock(renderer, block, metadata, modelID); + mod.renderInventoryBlock(block, metadata, modelID, renderer); } } + + /** + * @param p_1219_0_ + * @return + */ + public boolean renderItemAsFull3DBlock(int modelId) + { + return false; + } + + public String getObjectName(Object instance) { + String objectName; + if (instance instanceof Item) { + objectName=((Item)instance).func_20009_a(); + } else if (instance instanceof Block) { + objectName=((Block)instance).func_20013_i(); + } else if (instance instanceof ItemStack) { + objectName=Item.field_233_c[((ItemStack)instance).field_1617_c].func_21011_b((ItemStack)instance); + } else { + throw new IllegalArgumentException(String.format("Illegal object for naming %s",instance)); + } + objectName+=".name"; + return objectName; + } } diff --git a/fml/client/cpw/mods/fml/client/KeyBindingHandler.java b/fml/client/cpw/mods/fml/client/KeyBindingHandler.java index c836de4e8..9ef7a5393 100644 --- a/fml/client/cpw/mods/fml/client/KeyBindingHandler.java +++ b/fml/client/cpw/mods/fml/client/KeyBindingHandler.java @@ -16,6 +16,8 @@ package cpw.mods.fml.client; import net.minecraft.src.KeyBinding; import cpw.mods.fml.common.IKeyHandler; +import cpw.mods.fml.common.ModContainer; +import cpw.mods.fml.common.modloader.ModLoaderModContainer; /** * @author cpw @@ -26,15 +28,18 @@ public class KeyBindingHandler implements IKeyHandler private boolean shouldRepeat; private KeyBinding keyBinding; + private ModContainer modContainer; /** * @param keyHandler * @param allowRepeat + * @param modContainer */ - public KeyBindingHandler(KeyBinding keyHandler, boolean allowRepeat) + public KeyBindingHandler(KeyBinding keyHandler, boolean allowRepeat, ModContainer modContainer) { this.keyBinding=keyHandler; this.shouldRepeat=allowRepeat; + this.modContainer=modContainer; } @Override @@ -43,4 +48,11 @@ public class KeyBindingHandler implements IKeyHandler return this.keyBinding; } + /** + * @return the modContainer + */ + public ModContainer getOwningContainer() + { + return modContainer; + } } diff --git a/fml/client/cpw/mods/fml/client/SpriteHelper.java b/fml/client/cpw/mods/fml/client/SpriteHelper.java index 423d98ca1..7e86fcab7 100644 --- a/fml/client/cpw/mods/fml/client/SpriteHelper.java +++ b/fml/client/cpw/mods/fml/client/SpriteHelper.java @@ -18,6 +18,7 @@ import java.util.BitSet; import java.util.HashMap; import net.minecraft.src.ModLoader; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; /** @@ -79,8 +80,7 @@ public class SpriteHelper { Exception ex = new Exception(String.format("Invalid getUniqueSpriteIndex call for texture: %s", path)); Loader.log.throwing("ModLoader", "getUniqueSpriteIndex", ex); - ModLoader.throwException(ex); - return 0; + FMLCommonHandler.instance().raiseException(ex,"Invalid request to getUniqueSpriteIndex",true); } } int ret = SpriteHelper.getFreeSlot(slots); @@ -88,7 +88,7 @@ public class SpriteHelper { Exception ex = new Exception(String.format("No more sprite indicies left for: %s", path)); Loader.log.throwing("ModLoader", "getUniqueSpriteIndex", ex); - ModLoader.throwException(ex); + FMLCommonHandler.instance().raiseException(ex,"No more sprite indicies left", true); } return ret; } diff --git a/fml/client/net/minecraft/src/BaseMod.java b/fml/client/net/minecraft/src/BaseMod.java index e21b2b465..d5cbd89a8 100644 --- a/fml/client/net/minecraft/src/BaseMod.java +++ b/fml/client/net/minecraft/src/BaseMod.java @@ -1,5 +1,3 @@ -package net.minecraft.src; - /* * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw * @@ -12,6 +10,7 @@ package net.minecraft.src; * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +package net.minecraft.src; import java.util.Map; import java.util.Random; @@ -56,25 +55,25 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp @Override public final void onCrafting(Object... craftingParameters) { - takenFromCrafting((EntityPlayer) craftingParameters[0], (ItemStack) craftingParameters[1], (IInventory) craftingParameters[2]); + takenFromCrafting((EntityPlayer)craftingParameters[0], (ItemStack)craftingParameters[1], (IInventory)craftingParameters[2]); } @Override public final void onSmelting(Object... smeltingParameters) { - takenFromFurnace((EntityPlayer) smeltingParameters[0], (ItemStack) smeltingParameters[1]); + takenFromFurnace((EntityPlayer)smeltingParameters[0], (ItemStack)smeltingParameters[1]); } @Override public final boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data) { - return dispenseEntity((World) data[0], x, y, z, xVelocity, zVelocity, (ItemStack) data[1]); + return dispenseEntity((World)data[0], x, y, z, xVelocity, zVelocity, (ItemStack)data[1]); } @Override public final boolean onChat(Object... data) { - return onChatMessageReceived((EntityPlayer) data[1], (Packet3Chat) data[0]); + return onChatMessageReceived((EntityPlayer)data[1], (Packet3Chat)data[0]); } @Override @@ -86,19 +85,19 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp @Override public final void onPlayerLogout(Object player) { - onClientLogout((EntityPlayer) player); + onClientLogout((EntityPlayer)player); } @Override public final void onPlayerChangedDimension(Object player) { - onClientDimensionChanged((EntityPlayer) player); + onClientDimensionChanged((EntityPlayer)player); } @Override public final void onPacket250Packet(Object... data) { - onPacket250Received((EntityPlayer) data[1], (Packet250CustomPayload) data[0]); + onPacket250Received((EntityPlayer)data[1], (Packet250CustomPayload)data[0]); } @Override @@ -134,10 +133,33 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp return false; } + /** + * @param renderer + * @param block + * @param metadata + * @param modelID + */ + public final void onRenderInventoryBlock(Object renderer, Block block, int metadata, int modelID) + { + renderInvBlock((RenderBlocks)renderer, block, metadata, modelID); + } + + /** + * @param world + * @param x + * @param y + * @param z + * @param block + * @param modelID + * @param renderer + */ + public final boolean onRenderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) + { + return renderWorldBlock((RenderBlocks)renderer, world, x, y, z, block, modelID); + } // 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 metadata @@ -154,8 +176,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } /** - * 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 x @@ -222,14 +243,14 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp */ public abstract String getVersion(); - /** - * Load your mod - */ public void keyboardEvent(KeyBinding event) { } + /** + * Load your mod + */ public abstract void load(); /** @@ -250,11 +271,10 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } /** - * 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 time the rendering subtick time (0.0-1.0) + * @param minecraftInstance the client * @return true to continue receiving ticks */ public boolean onTickInGame(float time, Minecraft minecraftInstance) @@ -268,6 +288,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } /** + * Only implemented on the client side * {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)} * * @param text @@ -278,6 +299,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } /** + * Only called on the client side * {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)} * * @param packet @@ -316,7 +338,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Called when someone takes a smelted item from a furnace - * + * * @param player * @param item */ @@ -335,7 +357,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Called when a 250 packet is received on a channel registered to this mod - * + * * @param source * @param payload */ @@ -344,18 +366,25 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } /** - * 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 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 */ public boolean onChatMessageReceived(EntityPlayer source, Packet3Chat chat) { return false; } + /** + * Called when a server command is received + * @param command + * @return true if you want to consume the message so it is not available for further processing + */ + public boolean onServerCommand(String command, String sender, Object listener) + { + return false; + } /** * Called when a new client logs in. @@ -386,4 +415,5 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp { } + } diff --git a/fml/client/net/minecraft/src/ModLoader.java b/fml/client/net/minecraft/src/ModLoader.java index 1deaecfd5..739afe5f7 100644 --- a/fml/client/net/minecraft/src/ModLoader.java +++ b/fml/client/net/minecraft/src/ModLoader.java @@ -1,5 +1,3 @@ -package net.minecraft.src; - /* * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw * @@ -12,6 +10,7 @@ package net.minecraft.src; * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +package net.minecraft.src; import java.awt.image.BufferedImage; import java.util.EnumSet; @@ -47,10 +46,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 FMLClientHandler#fuelLookup(int, int)} + * {@link FMLCommonHandler#fuelLookup(int, int)} * * @param id * @param metadata @@ -72,7 +70,7 @@ public class ModLoader /** * This method is unimplemented in server versions to date. - * + * * @param armor * @return */ @@ -82,9 +80,8 @@ public class ModLoader } /** - * This method adds the supplied biome to the set of candidate biomes for - * the default world generator type. - * + * This method adds the supplied biome to the set of candidate biomes for the default world generator type. + * * @param biome */ public static void addBiome(BiomeGenBase biome) @@ -93,8 +90,8 @@ public class ModLoader } /** - * Unimplemented on the server as it does not generate names - * + * Add localization for the specified string + * * @param key * @param value */ @@ -104,8 +101,8 @@ public class ModLoader } /** - * Unimplemented on the server as it does not generate names - * + * Add localization for the specified string + * * @param key * @param lang * @param value @@ -116,8 +113,8 @@ public class ModLoader } /** - * Unimplemented on the server as it does not generate names - * + * Name the specified minecraft object with the supplied name + * * @param instance * @param name */ @@ -128,25 +125,14 @@ public class ModLoader /** * Unimplemented on the server as it does not generate names - * + * * @param instance * @param lang * @param name */ public static void addName(Object instance, String lang, String name) { - String objectName; - if (instance instanceof Item) { - objectName=((Item)instance).func_20009_a(); - } else if (instance instanceof Block) { - objectName=((Block)instance).func_20013_i(); - } else if (instance instanceof ItemStack) { - objectName=Item.field_233_c[((ItemStack)instance).field_1617_c].func_21011_b((ItemStack)instance); - } else { - throw new IllegalArgumentException(String.format("Illegal object for naming %s",instance)); - } - objectName+=".name"; - addLocalization(objectName, lang, name); + FMLCommonHandler.instance().addNameForObject(instance, lang, name); } /** @@ -177,7 +163,7 @@ public class ModLoader /** * Add a Shaped Recipe - * + * * @param output * @param params */ @@ -188,7 +174,7 @@ public class ModLoader /** * Add a shapeless recipe - * + * * @param output * @param params */ @@ -199,7 +185,7 @@ public class ModLoader /** * Add a new product to be smelted - * + * * @param input * @param output */ @@ -210,7 +196,7 @@ public class ModLoader /** * Add a mob to the spawn list - * + * * @param entityClass * @param weightedProb * @param min @@ -232,15 +218,14 @@ public class ModLoader * @param spawnList * @param biomes */ - public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, - BiomeGenBase... biomes) + public static void addSpawn(Class 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 @@ -268,8 +253,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)} * * @param world @@ -289,7 +273,7 @@ public class ModLoader /** * Remove a container and drop all the items in it on the ground around - * + * * @param world * @param x * @param y @@ -304,7 +288,7 @@ public class ModLoader return; } - IInventory inv = (IInventory) te; + IInventory inv = (IInventory)te; for (int l = 0; l < inv.func_469_c(); l++) { @@ -329,8 +313,7 @@ public class ModLoader } itemstack.field_1615_a -= i1; - EntityItem entityitem = new EntityItem(world, (float) te.field_823_f + f, (float) te.field_822_g + f1, (float) te.field_821_h + f2, - new ItemStack(itemstack.field_1617_c, i1, itemstack.func_21181_i())); + EntityItem entityitem = new EntityItem(world, (float)te.field_823_f + f, (float)te.field_822_g + f1, (float)te.field_821_h + f2, new ItemStack(itemstack.field_1617_c, i1, itemstack.func_21181_i())); float f3 = 0.05F; entityitem.field_608_an = (float) world.field_1037_n.nextGaussian() * f3; entityitem.field_607_ao = (float) world.field_1037_n.nextGaussian() * f3 + 0.2F; @@ -349,7 +332,7 @@ public class ModLoader /** * Get a list of all BaseMod loaded into the system * {@link ModLoaderModContainer#findAll} - * + * * @return */ public static List getLoadedMods() @@ -358,8 +341,8 @@ public class ModLoader } /** - * Get a logger instance {@link FMLClientHandler#getFMLLogger()} - * + * Get a logger instance {@link FMLCommonHandler#getFMLLogger()} + * * @return */ public static Logger getLogger() @@ -373,20 +356,20 @@ public class ModLoader } /** - * This is not the server {@link FMLClientHandler#getServer()} + * This is not the server + * {@link FMLClientHandler#getServer()} * * @return */ - @Deprecated - public static Minecraft getMinecraftServerInstance() + public static Object getMinecraftServerInstance() { - return null; + return getMinecraftInstance(); } /** * Get a value from a field using reflection * {@link ReflectionHelper#getPrivateValue(Class, Object, int)} - * + * * @param instanceclass * @param instance * @param fieldindex @@ -421,8 +404,9 @@ public class ModLoader } /** - * Get a new unique entity id {@link Entity#getNextId()} - * + * Get a new unique entity id + * {@link Entity#getNextId()} + * * @return */ public static int getUniqueEntityId() @@ -454,7 +438,8 @@ public class ModLoader } /** - * Is the named mod loaded? {@link Loader#isModLoaded(String)} + * Is the named mod loaded? + * {@link Loader#isModLoaded(String)} * * @param modname * @return @@ -505,9 +490,8 @@ public class ModLoader } /** - * This method is a call in hook from modified external code. Implemented - * elsewhere. - * {@link FMLClientHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} + * This method is a call in hook from modified external code. Implemented elsewhere. + * {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} * * @param packet */ @@ -665,24 +649,27 @@ public class ModLoader CommonRegistry.removeSpawn(entityName, spawnList, biomes); } + @Deprecated public static boolean renderBlockIsItemFull3D(int modelID) { - //TODO return false; } + @Deprecated public static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID) { - FMLClientHandler.instance().onRenderInvBlock(renderer, block, metadata, modelID); + FMLClientHandler.instance().renderInventoryBlock(renderer, block, metadata, modelID); } + @Deprecated public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID) { - return FMLClientHandler.instance().onRenderWorldBlock(renderer, world, x, y, z, block, modelID); + return FMLClientHandler.instance().renderWorldBlock(renderer, world, x, y, z, block, modelID); } /** - * Configuration is handled elsewhere {@link ModLoaderModContainer} + * Configuration is handled elsewhere + * {@link ModLoaderModContainer} */ @Deprecated public static void saveConfig() @@ -691,16 +678,17 @@ public class ModLoader /** * Send a chat message to the server - * * {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)} * * @param text */ + @Deprecated public static void serverChat(String text) { //TODO } + @Deprecated public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket) { //TODO @@ -708,14 +696,10 @@ public class ModLoader /** * Indicate that you want to receive ticks - * - * @param mod - * receiving the events - * @param enable - * 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) + * + * @param mod receiving the events + * @param enable indicates whether you want to recieve them or not + * @param useClock don't receive render subticks, just world ticks */ public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock) { @@ -757,8 +741,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)} * * @param player @@ -771,8 +754,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)} * * @param player @@ -792,7 +774,7 @@ public class ModLoader */ public static void throwException(String message, Throwable e) { - FMLClientHandler.instance().raiseException(e, message, true); + FMLCommonHandler.instance().raiseException(e, message, true); } public static void throwException(Throwable e) diff --git a/fml/client/net/minecraft/src/ModTextureAnimation.java b/fml/client/net/minecraft/src/ModTextureAnimation.java index 77a9f202c..85c704194 100644 --- a/fml/client/net/minecraft/src/ModTextureAnimation.java +++ b/fml/client/net/minecraft/src/ModTextureAnimation.java @@ -19,6 +19,8 @@ import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; import static org.lwjgl.opengl.GL11.*; /** @@ -47,7 +49,7 @@ public class ModTextureAnimation extends TextureFX public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount) { super(icon); - RenderEngine re = ModLoader.getMinecraftInstance().field_6315_n; + RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n; targetTex = target; field_1129_e = size; diff --git a/fml/client/net/minecraft/src/ModTextureStatic.java b/fml/client/net/minecraft/src/ModTextureStatic.java index f1dd576ec..086499677 100644 --- a/fml/client/net/minecraft/src/ModTextureStatic.java +++ b/fml/client/net/minecraft/src/ModTextureStatic.java @@ -19,6 +19,8 @@ import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; import static org.lwjgl.opengl.GL11.*; public class ModTextureStatic extends TextureFX @@ -41,7 +43,7 @@ public class ModTextureStatic extends TextureFX public ModTextureStatic(int icon, int size, String target, BufferedImage image) { super(icon); - RenderEngine re = ModLoader.getMinecraftInstance().field_6315_n; + RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n; targetTex = target; field_1129_e = size; diff --git a/fml/common/cpw/mods/fml/common/FMLCommonHandler.java b/fml/common/cpw/mods/fml/common/FMLCommonHandler.java index 9dac2dfff..cd2eac444 100644 --- a/fml/common/cpw/mods/fml/common/FMLCommonHandler.java +++ b/fml/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -66,8 +66,9 @@ public class FMLCommonHandler private int uniqueEntityListId = 220; - private List extraTickers = new ArrayList(); + private List auxilliaryContainers = new ArrayList(); + private Map modLanguageData=new HashMap(); /** * We register our delegate here * @param handler @@ -99,7 +100,7 @@ public class FMLCommonHandler { mod.tickStart(type, data); } - for (ModContainer mod : extraTickers) + for (ModContainer mod : auxilliaryContainers) { mod.tickStart(type, data); } @@ -111,7 +112,7 @@ public class FMLCommonHandler { mod.tickEnd(type, data); } - for (ModContainer mod : extraTickers) + for (ModContainer mod : auxilliaryContainers) { mod.tickEnd(type, data); } @@ -123,7 +124,7 @@ public class FMLCommonHandler { allKeys.addAll(mod.getKeys()); } - for (ModContainer mod : extraTickers) + for (ModContainer mod : auxilliaryContainers) { allKeys.addAll(mod.getKeys()); } @@ -310,7 +311,6 @@ public class FMLCommonHandler return uniqueEntityListId++; } - private Map modLanguageData=new HashMap(); /** * @param key * @param lang @@ -326,7 +326,8 @@ public class FMLCommonHandler langPack.put(key,value); if (sidedDelegate.getCurrentLanguage().equals(lang)) { - handleLanguageLoad(langPack, lang); + // Inject new translations into current language table + handleLanguageLoad(sidedDelegate.getCurrentLanguageTable(), lang); } } @@ -359,8 +360,47 @@ public class FMLCommonHandler return sidedDelegate.isClient(); } - public void registerTicker(ModContainer ticker) + public void addAuxilliaryModContainer(ModContainer ticker) { - extraTickers.add(ticker); + auxilliaryContainers.add(ticker); } + + /** + * Called from the furnace to lookup fuel values + * + * @param itemId + * @param itemDamage + * @return + */ + public int fuelLookup(int itemId, int itemDamage) + { + int fv = 0; + + for (ModContainer mod : Loader.getModList()) + { + fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage)); + } + + return fv; + } + + public void addNameForObject(Object minecraftObject, String lang, String name) { + String label=sidedDelegate.getObjectName(minecraftObject); + addStringLocalization(label, lang, name); + } + + + /** + * Raise an exception + * + * @param exception + * @param message + * @param stopGame + */ + public void raiseException(Throwable exception, String message, boolean stopGame) + { + FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception); + throw new RuntimeException(exception); + } + } diff --git a/fml/common/cpw/mods/fml/common/FMLModContainer.java b/fml/common/cpw/mods/fml/common/FMLModContainer.java index c3ae2304c..52cc10b1c 100644 --- a/fml/common/cpw/mods/fml/common/FMLModContainer.java +++ b/fml/common/cpw/mods/fml/common/FMLModContainer.java @@ -16,6 +16,9 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import net.minecraft.src.Block; +import net.minecraft.src.IBlockAccess; + public class FMLModContainer implements ModContainer { private Mod modDescriptor; @@ -334,4 +337,22 @@ public class FMLModContainer implements ModContainer // TODO Auto-generated method stub return null; } + /* (non-Javadoc) + * @see cpw.mods.fml.common.ModContainer#renderInventoryBlock(net.minecraft.src.Block, int, int, java.lang.Object) + */ + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, Object renderer) + { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see cpw.mods.fml.common.ModContainer#renderWorldBlock(net.minecraft.src.IBlockAccess, int, int, int, net.minecraft.src.Block, int, java.lang.Object) + */ + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) + { + // TODO Auto-generated method stub + return false; + } } diff --git a/fml/common/cpw/mods/fml/common/IFMLSidedHandler.java b/fml/common/cpw/mods/fml/common/IFMLSidedHandler.java index 910c717cf..32df5cf7a 100644 --- a/fml/common/cpw/mods/fml/common/IFMLSidedHandler.java +++ b/fml/common/cpw/mods/fml/common/IFMLSidedHandler.java @@ -1,6 +1,7 @@ package cpw.mods.fml.common; import java.io.File; +import java.util.Properties; import java.util.logging.Logger; public interface IFMLSidedHandler @@ -13,4 +14,6 @@ public interface IFMLSidedHandler boolean isClient(); Object getMinecraftInstance(); String getCurrentLanguage(); + Properties getCurrentLanguageTable(); + String getObjectName(Object minecraftObject); } diff --git a/fml/common/cpw/mods/fml/common/IKeyHandler.java b/fml/common/cpw/mods/fml/common/IKeyHandler.java index e53696328..301388183 100644 --- a/fml/common/cpw/mods/fml/common/IKeyHandler.java +++ b/fml/common/cpw/mods/fml/common/IKeyHandler.java @@ -23,4 +23,9 @@ public interface IKeyHandler Object getKeyBinding(); + /** + * @return + */ + ModContainer getOwningContainer(); + } diff --git a/fml/common/cpw/mods/fml/common/ModContainer.java b/fml/common/cpw/mods/fml/common/ModContainer.java index 81e9f616c..a4884139d 100644 --- a/fml/common/cpw/mods/fml/common/ModContainer.java +++ b/fml/common/cpw/mods/fml/common/ModContainer.java @@ -16,6 +16,9 @@ package cpw.mods.fml.common; import java.io.File; import java.util.List; +import net.minecraft.src.Block; +import net.minecraft.src.IBlockAccess; + /** * The container that wraps around mods in the system. *

The philosophy is that individual mod implementation technologies should not impact the actual loading and management @@ -200,4 +203,22 @@ public interface ModContainer } List getKeys(); + /** + * @param block + * @param metadata + * @param modelID + * @param renderer + */ + void renderInventoryBlock(Block block, int metadata, int modelID, Object renderer); + /** + * @param world + * @param x + * @param y + * @param z + * @param block + * @param modelID + * @param renderer + * @return + */ + boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer); } diff --git a/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java b/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java index a14c42b40..11a24c70b 100644 --- a/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java +++ b/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java @@ -77,7 +77,7 @@ public class ModLoaderModContainer implements ModContainer * @param instance */ ModLoaderModContainer(BaseMod instance) { - FMLCommonHandler.instance().registerTicker(this); + FMLCommonHandler.instance().addAuxilliaryModContainer(this); this.mod=instance; this.ticks = EnumSet.noneOf(TickType.class); } @@ -624,4 +624,24 @@ public class ModLoaderModContainer implements ModContainer } return keyHandlers; } + + /** + * @param block + * @param metadata + * @param modelID + * @param renderer + */ + public void renderInventoryBlock(Block block, int metadata, int modelID, Object renderer) + { + mod.onRenderInventoryBlock(renderer, block, metadata, modelID); + } + + /* (non-Javadoc) + * @see cpw.mods.fml.common.ModContainer#renderWorldBlock(net.minecraft.src.IBlockAccess, int, int, int, net.minecraft.src.Block, int, java.lang.Object) + */ + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) + { + return mod.onRenderWorldBlock(world, x, y, z, block, modelID, renderer); + } } diff --git a/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs index c3f07c424..38dc83585 100644 --- a/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs +++ b/fml/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,4 @@ +LexicalSortingAction.isChecked=true content_assist_favorite_static_members= content_assist_lru_history= content_assist_number_of_computers=13 diff --git a/fml/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch b/fml/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch index 4443d1292..01ae632d3 100644 --- a/fml/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch +++ b/fml/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch @@ -1,6 +1,11 @@ --- ../src-base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src-work/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000 -@@ -7,94 +7,95 @@ +@@ -4,97 +4,100 @@ + import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GL12; + ++import cpw.mods.fml.client.FMLClientHandler; ++ public class RenderBlocks { public IBlockAccess field_1772_a; @@ -182,7 +187,7 @@ public RenderBlocks(IBlockAccess p_i647_1_) { -@@ -126,10 +127,40 @@ +@@ -126,10 +129,40 @@ { int var5 = p_1234_1_.func_210_f(); p_1234_1_.func_238_a(this.field_1772_a, p_1234_2_, p_1234_3_, p_1234_4_); @@ -216,7 +221,7 @@ + case 24: return func_40728_a((BlockCauldron)p_1234_1_, p_1234_2_, p_1234_3_, p_1234_4_); + case 25: return func_40730_a((BlockBrewingStand)p_1234_1_, p_1234_2_, p_1234_3_, p_1234_4_); + case 26: return func_40729_s(p_1234_1_, p_1234_2_, p_1234_3_, p_1234_4_); -+ default: return ModLoader.renderWorldBlock(this, field_1772_a, p_1234_2_, p_1234_3_, p_1234_4_, p_1234_1_, var5); ++ default: return FMLClientHandler.instance().renderWorldBlock(this, field_1772_a, p_1234_2_, p_1234_3_, p_1234_4_, p_1234_1_, var5); + } } @@ -225,7 +230,7 @@ { int var5 = this.field_1772_a.func_602_e(p_40729_2_, p_40729_3_, p_40729_4_); int var6 = var5 & 3; -@@ -169,7 +200,7 @@ +@@ -169,7 +202,7 @@ } } @@ -234,7 +239,7 @@ { Tessellator var5 = Tessellator.field_1512_a; int var6 = this.field_1772_a.func_602_e(p_22331_2_, p_22331_3_, p_22331_4_); -@@ -310,7 +341,7 @@ +@@ -310,7 +343,7 @@ return true; } @@ -243,7 +248,7 @@ { p_40730_1_.func_213_a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); this.func_1228_k(p_40730_1_, p_40730_2_, p_40730_3_, p_40730_4_); -@@ -384,7 +415,7 @@ +@@ -384,7 +417,7 @@ return true; } @@ -252,7 +257,7 @@ { this.func_1228_k(p_40728_1_, p_40728_2_, p_40728_3_, p_40728_4_); Tessellator var5 = Tessellator.field_1512_a; -@@ -467,7 +498,7 @@ +@@ -467,7 +500,7 @@ return true; } @@ -261,7 +266,7 @@ { int var5 = this.field_1772_a.func_602_e(p_22332_2_, p_22332_3_, p_22332_4_); int var6 = var5 & 3; -@@ -557,7 +588,7 @@ +@@ -557,7 +590,7 @@ this.field_1773_d = false; } @@ -270,7 +275,7 @@ { int var6 = this.field_1772_a.func_602_e(p_31074_2_, p_31074_3_, p_31074_4_); boolean var7 = p_31074_5_ || (var6 & 8) != 0; -@@ -660,7 +691,7 @@ +@@ -660,7 +693,7 @@ return true; } @@ -279,7 +284,7 @@ { int var16 = 108; -@@ -683,7 +714,7 @@ +@@ -683,7 +716,7 @@ var19.func_983_a(p_31076_3_, p_31076_7_, p_31076_11_, var24, var26); } @@ -288,7 +293,7 @@ { int var16 = 108; -@@ -706,7 +737,7 @@ +@@ -706,7 +739,7 @@ var19.func_983_a(p_31081_3_, p_31081_7_, p_31081_11_, var24, var26); } @@ -297,7 +302,7 @@ { int var16 = 108; -@@ -736,7 +767,7 @@ +@@ -736,7 +769,7 @@ this.field_1773_d = false; } @@ -306,7 +311,7 @@ { int var6 = this.field_1772_a.func_602_e(p_31080_2_, p_31080_3_, p_31080_4_); int var7 = BlockPistonExtension.func_31050_c(var6); -@@ -2707,7 +2738,7 @@ +@@ -2707,7 +2740,7 @@ } } @@ -315,7 +320,7 @@ { int var5 = 0; float var6 = 0.0F; -@@ -3239,7 +3270,7 @@ +@@ -3239,7 +3272,7 @@ var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 2); this.func_1220_c(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, var27); @@ -324,7 +329,7 @@ { this.field_22351_H *= p_22330_5_; this.field_22350_I *= p_22330_5_; -@@ -3362,7 +3393,7 @@ +@@ -3362,7 +3395,7 @@ var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 3); this.func_1225_d(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 3)); @@ -333,7 +338,7 @@ { this.field_22351_H *= p_22330_5_; this.field_22350_I *= p_22330_5_; -@@ -3485,7 +3516,7 @@ +@@ -3485,7 +3518,7 @@ var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 4); this.func_1231_e(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, var27); @@ -342,7 +347,7 @@ { this.field_22351_H *= p_22330_5_; this.field_22350_I *= p_22330_5_; -@@ -3608,7 +3639,7 @@ +@@ -3608,7 +3641,7 @@ var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 5); this.func_1236_f(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, var27); @@ -351,7 +356,7 @@ { this.field_22351_H *= p_22330_5_; this.field_22350_I *= p_22330_5_; -@@ -3632,7 +3663,7 @@ +@@ -3632,7 +3665,7 @@ return var8; } @@ -360,7 +365,7 @@ { if (p_35924_1_ == 0) { -@@ -3714,7 +3745,7 @@ +@@ -3714,7 +3747,7 @@ var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 2); this.func_1220_c(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28); @@ -369,7 +374,7 @@ { var8.func_987_a(var18 * p_4152_5_, var21 * p_4152_6_, var24 * p_4152_7_); this.func_1220_c(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38); -@@ -3730,7 +3761,7 @@ +@@ -3730,7 +3763,7 @@ var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 3); this.func_1225_d(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28); @@ -378,7 +383,7 @@ { var8.func_987_a(var18 * p_4152_5_, var21 * p_4152_6_, var24 * p_4152_7_); this.func_1225_d(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38); -@@ -3746,7 +3777,7 @@ +@@ -3746,7 +3779,7 @@ var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 4); this.func_1231_e(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28); @@ -387,7 +392,7 @@ { var8.func_987_a(var19 * p_4152_5_, var22 * p_4152_6_, var25 * p_4152_7_); this.func_1231_e(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38); -@@ -3762,7 +3793,7 @@ +@@ -3762,7 +3795,7 @@ var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 5); this.func_1236_f(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28); @@ -396,18 +401,18 @@ { var8.func_987_a(var19 * p_4152_5_, var22 * p_4152_6_, var25 * p_4152_7_); this.func_1236_f(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38); -@@ -5270,6 +5301,10 @@ +@@ -5270,6 +5303,10 @@ p_1227_1_.func_213_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } + else + { -+ ModLoader.renderInvBlock(this, p_1227_1_, p_1227_2_, var6); ++ FMLClientHandler.instance().renderInventoryBlock(this, p_1227_1_, p_1227_2_, var6); + } } else { -@@ -5326,6 +5361,17 @@ +@@ -5326,6 +5363,17 @@ public static boolean func_1219_a(int p_1219_0_) { @@ -422,7 +427,7 @@ + case 22: + case 21: + case 16: return true; -+ default: return ModLoader.renderBlockIsItemFull3D(p_1219_0_); ++ default: return FMLClientHandler.instance().renderItemAsFull3DBlock(p_1219_0_); + } } } diff --git a/fml/patches/minecraft/net/minecraft/src/StringTranslate.java.patch b/fml/patches/minecraft/net/minecraft/src/StringTranslate.java.patch index 502c7e266..da18b0683 100644 --- a/fml/patches/minecraft/net/minecraft/src/StringTranslate.java.patch +++ b/fml/patches/minecraft/net/minecraft/src/StringTranslate.java.patch @@ -18,3 +18,12 @@ } public void func_44023_a(String p_44023_1_) +@@ -164,4 +168,8 @@ + { + return "ar_SA".equals(p_46109_0_) || "he_IL".equals(p_46109_0_); + } ++ ++ public Properties getTranslationTable() { ++ return field_20164_b; ++ } + } diff --git a/fml/patches/minecraft_server/net/minecraft/src/StatBase.java.patch b/fml/patches/minecraft_server/net/minecraft/src/StatBase.java.patch new file mode 100644 index 000000000..75ecbe1a2 --- /dev/null +++ b/fml/patches/minecraft_server/net/minecraft/src/StatBase.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft_server/net/minecraft/src/StatBase.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src-work/minecraft_server/net/minecraft/src/StatBase.java 0000-00-00 00:00:00.000000000 -0000 +@@ -55,4 +55,8 @@ + { + return StatCollector.func_25136_a(this.field_25062_e); + } ++ ++ public String getName() { ++ return field_25062_e; ++ } + } diff --git a/fml/patches/minecraft_server/net/minecraft/src/StringTranslate.java.patch b/fml/patches/minecraft_server/net/minecraft/src/StringTranslate.java.patch index baa6abef5..d553150e3 100644 --- a/fml/patches/minecraft_server/net/minecraft/src/StringTranslate.java.patch +++ b/fml/patches/minecraft_server/net/minecraft/src/StringTranslate.java.patch @@ -1,11 +1,16 @@ --- ../src-base/minecraft_server/net/minecraft/src/StringTranslate.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src-work/minecraft_server/net/minecraft/src/StringTranslate.java 0000-00-00 00:00:00.000000000 -0000 -@@ -139,4 +139,8 @@ +@@ -139,4 +139,13 @@ String var3 = this.field_25081_b.getProperty(p_25078_1_, p_25078_1_); return String.format(var3, p_25078_2_); } + + public String getCurrentLanguage() { + return this.field_44012_d; ++ } ++ ++ public Properties getCurrentLanguageTable() ++ { ++ return this.field_25081_b; + } } diff --git a/fml/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch b/fml/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch index 5b974ab12..9099235b5 100644 --- a/fml/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch +++ b/fml/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch @@ -3,7 +3,7 @@ @@ -1,5 +1,7 @@ package net.minecraft.src; -+import cpw.mods.fml.server.FMLServerHandler; ++import cpw.mods.fml.common.FMLCommonHandler; + public class TileEntityFurnace extends TileEntity implements IInventory { @@ -13,7 +13,7 @@ { int var1 = p_194_1_.func_569_a().field_234_aS; - return var1 < 256 && Block.field_542_n[var1].field_553_bn == Material.field_524_c ? 300 : (var1 == Item.field_209_B.field_234_aS ? 100 : (var1 == Item.field_168_k.field_234_aS ? 1600 : (var1 == Item.field_201_aw.field_234_aS ? 20000 : (var1 == Block.field_6047_y.field_573_bc ? 100 : (var1 == Item.field_40239_bm.field_234_aS ? 2400 : 0))))); -+ return var1 < 256 && Block.field_542_n[var1].field_553_bn == Material.field_524_c ? 300 : (var1 == Item.field_209_B.field_234_aS ? 100 : (var1 == Item.field_168_k.field_234_aS ? 1600 : (var1 == Item.field_201_aw.field_234_aS ? 20000 : (var1 == Block.field_6047_y.field_573_bc ? 100 : (var1 == Item.field_40239_bm.field_234_aS ? 2400 : FMLServerHandler.instance().fuelLookup(var1, p_194_1_.func_21125_h())))))); ++ return var1 < 256 && Block.field_542_n[var1].field_553_bn == Material.field_524_c ? 300 : (var1 == Item.field_209_B.field_234_aS ? 100 : (var1 == Item.field_168_k.field_234_aS ? 1600 : (var1 == Item.field_201_aw.field_234_aS ? 20000 : (var1 == Block.field_6047_y.field_573_bc ? 100 : (var1 == Item.field_40239_bm.field_234_aS ? 2400 : FMLCommonHandler.instance().fuelLookup(var1, p_194_1_.func_21125_h())))))); } } diff --git a/fml/server/cpw/mods/fml/server/FMLServerHandler.java b/fml/server/cpw/mods/fml/server/FMLServerHandler.java index b8ab57914..463e408e3 100644 --- a/fml/server/cpw/mods/fml/server/FMLServerHandler.java +++ b/fml/server/cpw/mods/fml/server/FMLServerHandler.java @@ -16,12 +16,14 @@ import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; +import java.util.Properties; import java.util.Random; import java.util.logging.Logger; import net.minecraft.server.MinecraftServer; import net.minecraft.src.BaseMod; import net.minecraft.src.BiomeGenBase; +import net.minecraft.src.Block; import net.minecraft.src.CommonRegistry; import net.minecraft.src.EntityItem; import net.minecraft.src.EntityPlayer; @@ -29,6 +31,7 @@ import net.minecraft.src.EntityPlayerMP; import net.minecraft.src.IChunkProvider; import net.minecraft.src.ICommandListener; import net.minecraft.src.IInventory; +import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.NetworkManager; import net.minecraft.src.Packet1Login; @@ -549,21 +552,38 @@ public class FMLServerHandler implements IFMLSidedHandler WorldType.field_48457_b.addNewBiome(biome); } - /* (non-Javadoc) - * @see cpw.mods.fml.common.IFMLSidedHandler#getMinecraftInstance() - */ @Override public Object getMinecraftInstance() { return server; } - /* (non-Javadoc) - * @see cpw.mods.fml.common.IFMLSidedHandler#getCurrentLanguage() - */ @Override public String getCurrentLanguage() { return StringTranslate.func_25079_a().getCurrentLanguage(); } + + @Override + public Properties getCurrentLanguageTable() + { + return StringTranslate.func_25079_a().getCurrentLanguageTable(); + } + + @Override + public String getObjectName(Object instance) + { + String objectName; + if (instance instanceof Item) { + objectName=((Item)instance).func_20106_a(); + } else if (instance instanceof Block) { + objectName=((Block)instance).func_20036_e(); + } else if (instance instanceof ItemStack) { + objectName=Item.field_176_c[((ItemStack)instance).field_855_c].func_35407_a((ItemStack)instance); + } else { + throw new IllegalArgumentException(String.format("Illegal object for naming %s",instance)); + } + objectName+=".name"; + return objectName; + } } diff --git a/fml/server/net/minecraft/src/BaseMod.java b/fml/server/net/minecraft/src/BaseMod.java index 313fd6c43..27de52d26 100644 --- a/fml/server/net/minecraft/src/BaseMod.java +++ b/fml/server/net/minecraft/src/BaseMod.java @@ -12,6 +12,7 @@ */ package net.minecraft.src; +import java.util.Map; import java.util.Random; import net.minecraft.server.MinecraftServer; @@ -26,11 +27,21 @@ import cpw.mods.fml.common.IWorldGenerator; public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDispenseHandler, ICraftingHandler, INetworkHandler, IConsoleHandler, IPlayerTracker { // CALLBACK MECHANISMS - public boolean doTickInGame(Object minecraftInstance, Object ... data) + + /** + * @param minecraftInstance + * @return + */ + public final boolean doTickInGame(Object minecraftInstance, Object... data) { return onTickInGame((MinecraftServer)minecraftInstance); } + public final boolean doTickInGui(Object minecraftInstance, Object... data) + { + return true; + } + @Override public final void onCrafting(Object... craftingParameters) { @@ -42,6 +53,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp { takenFromFurnace((EntityPlayer)smeltingParameters[0], (ItemStack)smeltingParameters[1]); } + @Override public final boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data) { @@ -53,6 +65,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp { return onChatMessageReceived((EntityPlayer)data[1], (Packet3Chat)data[0]); } + @Override public final void onPlayerLogin(Object player) { @@ -60,13 +73,13 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } @Override - public void onPlayerLogout(Object player) + public final void onPlayerLogout(Object player) { onClientLogout((EntityPlayer)player); } - + @Override - public void onPlayerChangedDimension(Object player) + public final void onPlayerChangedDimension(Object player) { onClientDimensionChanged((EntityPlayer)player); } @@ -101,14 +114,43 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp } } + /** + * NO-OP on client side + */ @Override public final boolean handleCommand(String command, Object... data) { return onServerCommand(command, (String)data[0], (ICommandListener)data[1]); } + + /** + * @param renderer + * @param block + * @param metadata + * @param modelID + */ + public final void onRenderInventoryBlock(Object renderer, Block block, int metadata, int modelID) + { + // NOOP + } + + /** + * @param world + * @param x + * @param y + * @param z + * @param block + * @param modelID + * @param renderer + */ + public final boolean onRenderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, Object renderer) + { + return false; + } // BASEMOD API /** * Override if you wish to provide a fuel item for the furnace and return the fuel value of the item + * * @param id * @param metadata * @return @@ -118,8 +160,14 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp return 0; } + public void addRenderer(Map, Object> renderers) + { + + } + /** * Override if you wish to perform some action other than just dispensing the item from the dispenser + * * @param world * @param x * @param y @@ -136,6 +184,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Override if you wish to generate Nether (Hell biome) blocks + * * @param world * @param random * @param chunkX @@ -147,6 +196,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Override if you wish to generate Overworld (not hell or the end) blocks + * * @param world * @param random * @param chunkX @@ -158,6 +208,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Return the name of your mod. Defaults to the class name + * * @return */ public String getName() @@ -167,19 +218,26 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Get your mod priorities + * * @return */ public String getPriorities() { - return null; + return ""; } /** * Return the version of your mod + * * @return */ public abstract String getVersion(); + public void keyboardEvent(Object event) + { + + } + /** * Load your mod */ @@ -194,6 +252,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Handle item pickup + * * @param player * @param item */ @@ -203,6 +262,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)} + * * @param minecraftServer the server * @return true to continue receiving ticks */ @@ -211,28 +271,52 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp return false; } - /** - * Not implemented because on the server you don't know who it's from - * {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)} - * @param text - */ - @Deprecated - public void receiveChatPacket(String text) + public boolean onTickInGUI(float tick, Object game, Object gui) { + return false; } /** - * Not implemented because on the server you don't know who it's from + * Only implemented on the client side + * {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)} + * + * @param text + */ + public void receiveChatPacket(String text) + { + + } + + /** + * Only called on the client side * {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)} + * * @param packet */ - @Deprecated 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 + * * @param player * @param item * @param matrix @@ -272,6 +356,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Called when a chat message is received. Return true to stop further processing + * * @param source * @param chat * @return true if you want to consume the message so it is not available for further processing @@ -293,7 +378,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp /** * Called when a new client logs in. * - * @param player + * @param player */ public void onClientLogin(EntityPlayer player) { @@ -306,7 +391,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp */ public void onClientLogout(EntityPlayer player) { - + } /** @@ -317,7 +402,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp */ public void onClientDimensionChanged(EntityPlayer player) { - + } // Spare client junk diff --git a/fml/server/net/minecraft/src/ModLoader.java b/fml/server/net/minecraft/src/ModLoader.java index 526136db4..be5126230 100644 --- a/fml/server/net/minecraft/src/ModLoader.java +++ b/fml/server/net/minecraft/src/ModLoader.java @@ -14,6 +14,7 @@ package net.minecraft.src; import java.util.EnumSet; import java.util.List; +import java.util.Map; import java.util.logging.Logger; import net.minecraft.server.MinecraftServer; @@ -36,13 +37,16 @@ public class ModLoader */ 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. - * - * {@link FMLServerHandler#fuelLookup(int, int)} + * + * {@link FMLCommonHandler#fuelLookup(int, int)} + * * @param id * @param metadata * @return @@ -53,13 +57,20 @@ public class ModLoader return 0; } + public static void addAllRenderers(Map, Object> renderers) + { + } + + public static void addAnimation(Object anim) + { + } + /** * This method is unimplemented in server versions to date. * * @param armor * @return */ - @Deprecated public static int addArmor(String armor) { return 0; @@ -76,54 +87,58 @@ public class ModLoader } /** - * Unimplemented on the server as it does not generate names + * Add localization for the specified string + * * @param key * @param value */ - @Deprecated 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 lang * @param value */ - @Deprecated 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 name */ - @Deprecated public static void addName(Object instance, String name) { + addName(instance,"en_US",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) { + FMLCommonHandler.instance().addNameForObject(instance, lang, 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; @@ -131,17 +146,19 @@ public class ModLoader /** * 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) { + // NOOP } /** * Add a Shaped Recipe + * * @param output * @param params */ @@ -152,6 +169,7 @@ public class ModLoader /** * Add a shapeless recipe + * * @param output * @param params */ @@ -162,6 +180,7 @@ public class ModLoader /** * Add a new product to be smelted + * * @param input * @param output */ @@ -172,6 +191,7 @@ public class ModLoader /** * Add a mob to the spawn list + * * @param entityClass * @param weightedProb * @param min @@ -192,13 +212,14 @@ public class ModLoader * @param spawnList * @param biomes */ - public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes) + public static void addSpawn(Class 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 @@ -227,6 +248,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. * {@link FMLServerHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} + * * @param world * @param x * @param y @@ -244,6 +266,7 @@ public class ModLoader /** * Remove a container and drop all the items in it on the ground around + * * @param world * @param x * @param y @@ -302,6 +325,7 @@ public class ModLoader /** * Get a list of all BaseMod loaded into the system * {@link ModLoaderModContainer#findAll} + * * @return */ public static List getLoadedMods() @@ -310,8 +334,8 @@ public class ModLoader } /** - * Get a logger instance - * {@link FMLServerHandler#getFMLLogger()} + * Get a logger instance {@link FMLCommonHandler#getFMLLogger()} + * * @return */ public static Logger getLogger() @@ -319,15 +343,30 @@ public class ModLoader return FMLCommonHandler.instance().getFMLLogger(); } + public static Object getMinecraftInstance() + { + return getMinecraftServerInstance(); + } + + /** + * Get the minecraft server instance + * {@link FMLServerHandler#getServer()} + * @return + */ + public static MinecraftServer getMinecraftServerInstance() + { + return FMLServerHandler.instance().getServer(); + } /** * Get a value from a field using reflection * {@link ReflectionHelper#getPrivateValue(Class, Object, int)} + * * @param instanceclass * @param instance * @param fieldindex * @return */ - public static T getPrivateValue(Class instanceclass, E instance, int fieldindex) + public static T getPrivateValue(Class instanceclass, E instance, int fieldindex) { return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex); } @@ -335,19 +374,30 @@ public class ModLoader /** * Get a value from a field using reflection * {@link ReflectionHelper#getPrivateValue(Class, Object, String)} + * * @param instanceclass * @param instance * @param field * @return */ - public static T getPrivateValue(Class instanceclass, E instance, String field) + public static T getPrivateValue(Class instanceclass, E instance, String 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 * {@link Entity#getNextId()} + * * @return */ public static int getUniqueEntityId() @@ -355,9 +405,33 @@ public class ModLoader 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? * {@link Loader#isModLoaded(String)} + * * @param modname * @return */ @@ -366,9 +440,50 @@ public class ModLoader 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. * {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} + * * @param packet */ @Deprecated @@ -376,8 +491,20 @@ public class ModLoader { } + @Deprecated + public static Object[] registerAllKeys(Object[] keys) + { + return keys; + } + + @Deprecated + public static void registerAllTextureOverrides(Object cache) + { + } + /** * Register a new block + * * @param block */ public static void registerBlock(Block block) @@ -387,42 +514,52 @@ public class ModLoader /** * Register a new block + * * @param block * @param itemclass */ - public static void registerBlock(Block block, Class itemclass) + public static void registerBlock(Block block, Class itemclass) { CommonRegistry.registerBlock(block, itemclass); } /** * Register a new entity ID + * * @param entityClass * @param entityName * @param id */ - public static void registerEntityID(Class entityClass, String entityName, int id) + public static void registerEntityID(Class 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 entityClass, String entityName, int id, int background, int foreground) + public static void registerEntityID(Class entityClass, String entityName, int id, int background, int foreground) { CommonRegistry.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 - * with clients connecting- use BaseMod.onClientLogin to tell them about your custom channel + * Register the mod for packets on this channel. This only registers the + * 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)} + * * @param mod * @param channel */ @@ -433,19 +570,25 @@ public class ModLoader /** * Register a new tile entity class + * * @param tileEntityClass * @param id */ - public static void registerTileEntity(Class tileEntityClass, String id) + public static void registerTileEntity(Class tileEntityClass, String id) { CommonRegistry.registerTileEntity(tileEntityClass, id); } + public static void registerTileEntity(Class tileEntityClass, String id, Object renderer) + { + CommonRegistry.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 */ - @Deprecated public static void removeBiome(BiomeGenBase biome) { CommonRegistry.removeBiome(biome); @@ -453,27 +596,30 @@ public class ModLoader /** * Remove a spawn + * * @param entityClass * @param spawnList */ - public static void removeSpawn(Class entityClass, EnumCreatureType spawnList) + public static void removeSpawn(Class entityClass, EnumCreatureType spawnList) { CommonRegistry.removeSpawn(entityClass, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes()); } /** * Remove a spawn + * * @param entityClass * @param spawnList * @param biomes */ - public static void removeSpawn(Class entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes) + public static void removeSpawn(Class entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes) { CommonRegistry.removeSpawn(entityClass, spawnList, biomes); } /** * Remove a spawn + * * @param entityName * @param spawnList */ @@ -484,6 +630,7 @@ public class ModLoader /** * Remove a spawn + * * @param entityName * @param spawnList * @param biomes @@ -493,6 +640,24 @@ public class ModLoader CommonRegistry.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 * {@link ModLoaderModContainer} @@ -503,39 +668,51 @@ 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 FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)} + * * @param text */ @Deprecated public static void serverChat(String text) { + //TODO + } + + @Deprecated + public static void serverLogin(Object handler, Packet1Login loginPacket) + { + //TODO } /** * Indicate that you want to receive ticks * - * @param mod - * receiving the events - * @param enable - * 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) + * @param mod receiving the events + * @param enable 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) { 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 * {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)} + * * @param instanceclass * @param instance * @param fieldindex * @param value */ - public static void setPrivateValue(Class instanceclass, T instance, int fieldindex, E value) + public static void setPrivateValue(Class instanceclass, T instance, int fieldindex, E value) { ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value); } @@ -543,12 +720,13 @@ public class ModLoader /** * Set a private field to a value using reflection * {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)} + * * @param instanceclass * @param instance * @param field * @param value */ - public static void setPrivateValue(Class instanceclass, T instance, String field, E value) + public static void setPrivateValue(Class instanceclass, T instance, String field, E value) { ReflectionHelper.setPrivateValue(instanceclass, instance, field, value); } @@ -556,6 +734,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. * {@link FMLServerHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)} + * * @param player * @param item * @param matrix @@ -568,6 +747,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. * {@link FMLServerHandler#onItemSmelted(EntityPlayer, ItemStack)} + * * @param player * @param item */ @@ -584,38 +764,11 @@ public class ModLoader */ public static void throwException(String message, Throwable e) { - FMLServerHandler.instance().raiseException(e, message, true); - } - - /** - * Get the minecraft server instance - * {@link FMLServerHandler#getServer()} - * @return - */ - public static MinecraftServer getMinecraftServerInstance() - { - return FMLServerHandler.instance().getServer(); - } - - /** - * 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); + FMLCommonHandler.instance().raiseException(e, message, true); } - /** - * Stubbed method on the server to return a unique model id - * - */ - @Deprecated - public static int getUniqueBlockModelID(BaseMod mod, boolean flag) { - return 0; + public static void throwException(Throwable e) + { + throwException("Exception in ModLoader", e); } } \ No newline at end of file