Tidy up a lot of code- ModLoader and BaseMod are now almost identical client and server side

This commit is contained in:
Christian Weeks 2012-05-10 18:54:25 -04:00
parent bb2af1d883
commit 813ad71f13
22 changed files with 701 additions and 273 deletions

View file

@ -20,6 +20,7 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Properties;
import java.util.Random; import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -37,6 +38,7 @@ import net.minecraft.src.GuiScreen;
import net.minecraft.src.IBlockAccess; import net.minecraft.src.IBlockAccess;
import net.minecraft.src.IChunkProvider; import net.minecraft.src.IChunkProvider;
import net.minecraft.src.IInventory; import net.minecraft.src.IInventory;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.KeyBinding; import net.minecraft.src.KeyBinding;
import net.minecraft.src.NetworkManager; import net.minecraft.src.NetworkManager;
@ -96,8 +98,10 @@ public class FMLClientHandler implements IFMLSidedHandler
private int nextRenderId = 30; private int nextRenderId = 30;
// Cached lookups
private static HashMap<String, ArrayList<OverrideInfo>> overrideInfo = new HashMap<String, ArrayList<OverrideInfo>>(); private static HashMap<String, ArrayList<OverrideInfo>> overrideInfo = new HashMap<String, ArrayList<OverrideInfo>>();
private static HashMap<Integer, ModLoaderModContainer> blockModelIds = new HashMap<Integer, ModLoaderModContainer>(); private static HashMap<Integer, ModContainer> blockModelIds = new HashMap<Integer, ModContainer>();
private static HashMap<KeyBinding, ModContainer> keyBindings = new HashMap<KeyBinding, ModContainer>();
/** /**
* Called to start the whole game off from * Called to start the whole game off from
@ -158,6 +162,7 @@ public class FMLClientHandler implements IFMLSidedHandler
int i=0; int i=0;
for (IKeyHandler key : allKeys) { for (IKeyHandler key : allKeys) {
keys[i++]=(KeyBinding)key.getKeyBinding(); keys[i++]=(KeyBinding)key.getKeyBinding();
keyBindings.put((KeyBinding) key.getKeyBinding(), key.getOwningContainer());
} }
return keys; 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 * Is the offered class and instance of BaseMod and therefore a ModLoader
* mod? * 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 * Attempt to dispense the item as an entity other than just as a the item
* itself * itself
@ -556,6 +529,9 @@ public class FMLClientHandler implements IFMLSidedHandler
return StringTranslate.func_20162_a().func_44024_c(); return StringTranslate.func_20162_a().func_44024_c();
} }
public Properties getCurrentLanguageTable() {
return StringTranslate.func_20162_a().getTranslationTable();
}
/** /**
* @param armor * @param armor
* @return * @return
@ -629,7 +605,7 @@ public class FMLClientHandler implements IFMLSidedHandler
public void registerKeyHandler(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat) public void registerKeyHandler(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
{ {
ModLoaderModContainer mlmc=ModLoaderHelper.registerKeyHelper(mod); 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 * @param modelID
* @return * @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) if (mod == null)
{ {
return false; return false;
} }
mod.renderWorldBlock(world, x, y, z, block, modelID, renderer);
return ((BaseMod)mod.getMod()).renderWorldBlock(renderer, world, x, y, z, block, modelID); return ((BaseMod)mod.getMod()).renderWorldBlock(renderer, world, x, y, z, block, modelID);
} }
@ -658,12 +635,36 @@ public class FMLClientHandler implements IFMLSidedHandler
* @param metadata * @param metadata
* @param modelID * @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) 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;
}
} }

View file

@ -16,6 +16,8 @@ package cpw.mods.fml.client;
import net.minecraft.src.KeyBinding; import net.minecraft.src.KeyBinding;
import cpw.mods.fml.common.IKeyHandler; import cpw.mods.fml.common.IKeyHandler;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
/** /**
* @author cpw * @author cpw
@ -26,15 +28,18 @@ public class KeyBindingHandler implements IKeyHandler
private boolean shouldRepeat; private boolean shouldRepeat;
private KeyBinding keyBinding; private KeyBinding keyBinding;
private ModContainer modContainer;
/** /**
* @param keyHandler * @param keyHandler
* @param allowRepeat * @param allowRepeat
* @param modContainer
*/ */
public KeyBindingHandler(KeyBinding keyHandler, boolean allowRepeat) public KeyBindingHandler(KeyBinding keyHandler, boolean allowRepeat, ModContainer modContainer)
{ {
this.keyBinding=keyHandler; this.keyBinding=keyHandler;
this.shouldRepeat=allowRepeat; this.shouldRepeat=allowRepeat;
this.modContainer=modContainer;
} }
@Override @Override
@ -43,4 +48,11 @@ public class KeyBindingHandler implements IKeyHandler
return this.keyBinding; return this.keyBinding;
} }
/**
* @return the modContainer
*/
public ModContainer getOwningContainer()
{
return modContainer;
}
} }

View file

@ -18,6 +18,7 @@ import java.util.BitSet;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.src.ModLoader; import net.minecraft.src.ModLoader;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader; 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)); Exception ex = new Exception(String.format("Invalid getUniqueSpriteIndex call for texture: %s", path));
Loader.log.throwing("ModLoader", "getUniqueSpriteIndex", ex); Loader.log.throwing("ModLoader", "getUniqueSpriteIndex", ex);
ModLoader.throwException(ex); FMLCommonHandler.instance().raiseException(ex,"Invalid request to getUniqueSpriteIndex",true);
return 0;
} }
} }
int ret = SpriteHelper.getFreeSlot(slots); 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)); Exception ex = new Exception(String.format("No more sprite indicies left for: %s", path));
Loader.log.throwing("ModLoader", "getUniqueSpriteIndex", ex); Loader.log.throwing("ModLoader", "getUniqueSpriteIndex", ex);
ModLoader.throwException(ex); FMLCommonHandler.instance().raiseException(ex,"No more sprite indicies left", true);
} }
return ret; return ret;
} }

View file

@ -1,5 +1,3 @@
package net.minecraft.src;
/* /*
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw * 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 * 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 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraft.src;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -56,25 +55,25 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
@Override @Override
public final void onCrafting(Object... craftingParameters) 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 @Override
public final void onSmelting(Object... smeltingParameters) public final void onSmelting(Object... smeltingParameters)
{ {
takenFromFurnace((EntityPlayer) smeltingParameters[0], (ItemStack) smeltingParameters[1]); takenFromFurnace((EntityPlayer)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)
{ {
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 @Override
public final boolean onChat(Object... data) public final boolean onChat(Object... data)
{ {
return onChatMessageReceived((EntityPlayer) data[1], (Packet3Chat) data[0]); return onChatMessageReceived((EntityPlayer)data[1], (Packet3Chat)data[0]);
} }
@Override @Override
@ -86,19 +85,19 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
@Override @Override
public final void onPlayerLogout(Object player) public final void onPlayerLogout(Object player)
{ {
onClientLogout((EntityPlayer) player); onClientLogout((EntityPlayer)player);
} }
@Override @Override
public final void onPlayerChangedDimension(Object player) public final void onPlayerChangedDimension(Object player)
{ {
onClientDimensionChanged((EntityPlayer) player); onClientDimensionChanged((EntityPlayer)player);
} }
@Override @Override
public final void onPacket250Packet(Object... data) public final void onPacket250Packet(Object... data)
{ {
onPacket250Received((EntityPlayer) data[1], (Packet250CustomPayload) data[0]); onPacket250Received((EntityPlayer)data[1], (Packet250CustomPayload)data[0]);
} }
@Override @Override
@ -134,10 +133,33 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
return false; 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 // BASEMOD API
/** /**
* Override if you wish to provide a fuel item for the furnace and return * Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
* the fuel value of the item
* *
* @param id * @param id
* @param metadata * @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 * Override if you wish to perform some action other than just dispensing the item from the dispenser
* the item from the dispenser
* *
* @param world * @param world
* @param x * @param x
@ -222,14 +243,14 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
*/ */
public abstract String getVersion(); public abstract String getVersion();
/**
* Load your mod
*/
public void keyboardEvent(KeyBinding event) public void keyboardEvent(KeyBinding event)
{ {
} }
/**
* Load your mod
*/
public abstract void load(); 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 * Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
* {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
* *
* @param minecraftServer * @param time the rendering subtick time (0.0-1.0)
* the server * @param minecraftInstance the client
* @return true to continue receiving ticks * @return true to continue receiving ticks
*/ */
public boolean onTickInGame(float time, Minecraft minecraftInstance) 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)} * {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)}
* *
* @param text * @param text
@ -278,6 +299,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
} }
/** /**
* Only called on the client side
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)} * {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)}
* *
* @param packet * @param packet
@ -316,7 +338,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* Called when someone takes a smelted item from a furnace * Called when someone takes a smelted item from a furnace
* *
* @param player * @param player
* @param item * @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 * Called when a 250 packet is received on a channel registered to this mod
* *
* @param source * @param source
* @param payload * @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 * Called when a chat message is received. Return true to stop further processing
* processing
* *
* @param source * @param source
* @param chat * @param chat
* @return true if you want to consume the message so it is not available * @return true if you want to consume the message so it is not available for further processing
* for further processing
*/ */
public boolean onChatMessageReceived(EntityPlayer source, Packet3Chat chat) public boolean onChatMessageReceived(EntityPlayer source, Packet3Chat chat)
{ {
return false; 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. * Called when a new client logs in.
@ -386,4 +415,5 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
{ {
} }
} }

View file

@ -1,5 +1,3 @@
package net.minecraft.src;
/* /*
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw * 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 * 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 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraft.src;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.EnumSet; import java.util.EnumSet;
@ -47,10 +46,9 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented * This method is a call in hook from modified external code. Implemented elsewhere.
* elsewhere.
* *
* {@link FMLClientHandler#fuelLookup(int, int)} * {@link FMLCommonHandler#fuelLookup(int, int)}
* *
* @param id * @param id
* @param metadata * @param metadata
@ -72,7 +70,7 @@ public class ModLoader
/** /**
* This method is unimplemented in server versions to date. * This method is unimplemented in server versions to date.
* *
* @param armor * @param armor
* @return * @return
*/ */
@ -82,9 +80,8 @@ public class ModLoader
} }
/** /**
* This method adds the supplied biome to the set of candidate biomes for * This method adds the supplied biome to the set of candidate biomes for the default world generator type.
* the default world generator type. *
*
* @param biome * @param biome
*/ */
public static void addBiome(BiomeGenBase 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 key
* @param value * @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 key
* @param lang * @param lang
* @param value * @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 instance
* @param name * @param name
*/ */
@ -128,25 +125,14 @@ public class ModLoader
/** /**
* 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
*/ */
public static void addName(Object instance, String lang, String name) public static void addName(Object instance, String lang, String name)
{ {
String objectName; FMLCommonHandler.instance().addNameForObject(instance, lang, name);
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);
} }
/** /**
@ -177,7 +163,7 @@ public class ModLoader
/** /**
* Add a Shaped Recipe * Add a Shaped Recipe
* *
* @param output * @param output
* @param params * @param params
*/ */
@ -188,7 +174,7 @@ public class ModLoader
/** /**
* Add a shapeless recipe * Add a shapeless recipe
* *
* @param output * @param output
* @param params * @param params
*/ */
@ -199,7 +185,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
*/ */
@ -210,7 +196,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
@ -232,15 +218,14 @@ public class ModLoader
* @param spawnList * @param spawnList
* @param biomes * @param biomes
*/ */
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
BiomeGenBase... biomes)
{ {
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes); CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
} }
/** /**
* 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
@ -268,8 +253,7 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented * This method is a call in hook from modified external code. Implemented elsewhere.
* elsewhere.
* {@link FMLClientHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} * {@link FMLClientHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
* *
* @param world * @param world
@ -289,7 +273,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
@ -304,7 +288,7 @@ public class ModLoader
return; return;
} }
IInventory inv = (IInventory) te; IInventory inv = (IInventory)te;
for (int l = 0; l < inv.func_469_c(); l++) for (int l = 0; l < inv.func_469_c(); l++)
{ {
@ -329,8 +313,7 @@ public class ModLoader
} }
itemstack.field_1615_a -= i1; 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, 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()));
new ItemStack(itemstack.field_1617_c, i1, itemstack.func_21181_i()));
float f3 = 0.05F; float f3 = 0.05F;
entityitem.field_608_an = (float) world.field_1037_n.nextGaussian() * f3; entityitem.field_608_an = (float) world.field_1037_n.nextGaussian() * f3;
entityitem.field_607_ao = (float) world.field_1037_n.nextGaussian() * f3 + 0.2F; 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 * 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()
@ -358,8 +341,8 @@ public class ModLoader
} }
/** /**
* Get a logger instance {@link FMLClientHandler#getFMLLogger()} * Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
* *
* @return * @return
*/ */
public static Logger getLogger() 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 * @return
*/ */
@Deprecated public static Object getMinecraftServerInstance()
public static Minecraft getMinecraftServerInstance()
{ {
return null; return getMinecraftInstance();
} }
/** /**
* 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
@ -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 * @return
*/ */
public static int getUniqueEntityId() 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 * @param modname
* @return * @return
@ -505,9 +490,8 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented * This method is a call in hook from modified external code. Implemented elsewhere.
* elsewhere. * {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
* {@link FMLClientHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
* *
* @param packet * @param packet
*/ */
@ -665,24 +649,27 @@ public class ModLoader
CommonRegistry.removeSpawn(entityName, spawnList, biomes); CommonRegistry.removeSpawn(entityName, spawnList, biomes);
} }
@Deprecated
public static boolean renderBlockIsItemFull3D(int modelID) public static boolean renderBlockIsItemFull3D(int modelID)
{ {
//TODO
return false; return false;
} }
@Deprecated
public static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID) 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) 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 @Deprecated
public static void saveConfig() public static void saveConfig()
@ -691,16 +678,17 @@ public class ModLoader
/** /**
* Send a chat message to the server * Send a chat message to the server
*
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)} * {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
* *
* @param text * @param text
*/ */
@Deprecated
public static void serverChat(String text) public static void serverChat(String text)
{ {
//TODO //TODO
} }
@Deprecated
public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket) public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
{ {
//TODO //TODO
@ -708,14 +696,10 @@ public class ModLoader
/** /**
* 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 don't receive render subticks, just world ticks
* 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)
{ {
@ -757,8 +741,7 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented * This method is a call in hook from modified external code. Implemented elsewhere.
* elsewhere.
* {@link FMLClientHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)} * {@link FMLClientHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
* *
* @param player * @param player
@ -771,8 +754,7 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented * This method is a call in hook from modified external code. Implemented elsewhere.
* elsewhere.
* {@link FMLClientHandler#onItemSmelted(EntityPlayer, ItemStack)} * {@link FMLClientHandler#onItemSmelted(EntityPlayer, ItemStack)}
* *
* @param player * @param player
@ -792,7 +774,7 @@ public class ModLoader
*/ */
public static void throwException(String message, Throwable e) 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) public static void throwException(Throwable e)

View file

@ -19,6 +19,8 @@ import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import static org.lwjgl.opengl.GL11.*; 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) public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
{ {
super(icon); super(icon);
RenderEngine re = ModLoader.getMinecraftInstance().field_6315_n; RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n;
targetTex = target; targetTex = target;
field_1129_e = size; field_1129_e = size;

View file

@ -19,6 +19,8 @@ import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
public class ModTextureStatic extends TextureFX public class ModTextureStatic extends TextureFX
@ -41,7 +43,7 @@ public class ModTextureStatic extends TextureFX
public ModTextureStatic(int icon, int size, String target, BufferedImage image) public ModTextureStatic(int icon, int size, String target, BufferedImage image)
{ {
super(icon); super(icon);
RenderEngine re = ModLoader.getMinecraftInstance().field_6315_n; RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n;
targetTex = target; targetTex = target;
field_1129_e = size; field_1129_e = size;

View file

@ -66,8 +66,9 @@ public class FMLCommonHandler
private int uniqueEntityListId = 220; private int uniqueEntityListId = 220;
private List<ModContainer> extraTickers = new ArrayList<ModContainer>(); private List<ModContainer> auxilliaryContainers = new ArrayList<ModContainer>();
private Map<String,Properties> modLanguageData=new HashMap<String,Properties>();
/** /**
* We register our delegate here * We register our delegate here
* @param handler * @param handler
@ -99,7 +100,7 @@ public class FMLCommonHandler
{ {
mod.tickStart(type, data); mod.tickStart(type, data);
} }
for (ModContainer mod : extraTickers) for (ModContainer mod : auxilliaryContainers)
{ {
mod.tickStart(type, data); mod.tickStart(type, data);
} }
@ -111,7 +112,7 @@ public class FMLCommonHandler
{ {
mod.tickEnd(type, data); mod.tickEnd(type, data);
} }
for (ModContainer mod : extraTickers) for (ModContainer mod : auxilliaryContainers)
{ {
mod.tickEnd(type, data); mod.tickEnd(type, data);
} }
@ -123,7 +124,7 @@ public class FMLCommonHandler
{ {
allKeys.addAll(mod.getKeys()); allKeys.addAll(mod.getKeys());
} }
for (ModContainer mod : extraTickers) for (ModContainer mod : auxilliaryContainers)
{ {
allKeys.addAll(mod.getKeys()); allKeys.addAll(mod.getKeys());
} }
@ -310,7 +311,6 @@ public class FMLCommonHandler
return uniqueEntityListId++; return uniqueEntityListId++;
} }
private Map<String,Properties> modLanguageData=new HashMap<String,Properties>();
/** /**
* @param key * @param key
* @param lang * @param lang
@ -326,7 +326,8 @@ public class FMLCommonHandler
langPack.put(key,value); langPack.put(key,value);
if (sidedDelegate.getCurrentLanguage().equals(lang)) { 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(); 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);
}
} }

View file

@ -16,6 +16,9 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
public class FMLModContainer implements ModContainer public class FMLModContainer implements ModContainer
{ {
private Mod modDescriptor; private Mod modDescriptor;
@ -334,4 +337,22 @@ public class FMLModContainer implements ModContainer
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; 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;
}
} }

View file

@ -1,6 +1,7 @@
package cpw.mods.fml.common; package cpw.mods.fml.common;
import java.io.File; import java.io.File;
import java.util.Properties;
import java.util.logging.Logger; import java.util.logging.Logger;
public interface IFMLSidedHandler public interface IFMLSidedHandler
@ -13,4 +14,6 @@ public interface IFMLSidedHandler
boolean isClient(); boolean isClient();
Object getMinecraftInstance(); Object getMinecraftInstance();
String getCurrentLanguage(); String getCurrentLanguage();
Properties getCurrentLanguageTable();
String getObjectName(Object minecraftObject);
} }

View file

@ -23,4 +23,9 @@ public interface IKeyHandler
Object getKeyBinding(); Object getKeyBinding();
/**
* @return
*/
ModContainer getOwningContainer();
} }

View file

@ -16,6 +16,9 @@ package cpw.mods.fml.common;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
/** /**
* The container that wraps around mods in the system. * The container that wraps around mods in the system.
* <p>The philosophy is that individual mod implementation technologies should not impact the actual loading and management * <p>The philosophy is that individual mod implementation technologies should not impact the actual loading and management
@ -200,4 +203,22 @@ public interface ModContainer
} }
List<IKeyHandler> getKeys(); List<IKeyHandler> 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);
} }

View file

@ -77,7 +77,7 @@ public class ModLoaderModContainer implements ModContainer
* @param instance * @param instance
*/ */
ModLoaderModContainer(BaseMod instance) { ModLoaderModContainer(BaseMod instance) {
FMLCommonHandler.instance().registerTicker(this); FMLCommonHandler.instance().addAuxilliaryModContainer(this);
this.mod=instance; this.mod=instance;
this.ticks = EnumSet.noneOf(TickType.class); this.ticks = EnumSet.noneOf(TickType.class);
} }
@ -624,4 +624,24 @@ public class ModLoaderModContainer implements ModContainer
} }
return keyHandlers; 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);
}
} }

View file

@ -1,3 +1,4 @@
LexicalSortingAction.isChecked=true
content_assist_favorite_static_members= content_assist_favorite_static_members=
content_assist_lru_history=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><history maxLHS\="100" maxRHS\="10"><lhs name\="net.minecraft.src.IMinecraftRegistry"><rhs name\="net.minecraft.src.ServerRegistry"/></lhs><lhs name\="java.lang.ClassLoader"><rhs name\="java.net.URLClassLoader"/></lhs><lhs name\="java.util.logging.Level"><rhs name\="java.util.logging.Level"/></lhs></history> content_assist_lru_history=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><history maxLHS\="100" maxRHS\="10"><lhs name\="net.minecraft.src.IMinecraftRegistry"><rhs name\="net.minecraft.src.ServerRegistry"/></lhs><lhs name\="java.lang.ClassLoader"><rhs name\="java.net.URLClassLoader"/></lhs><lhs name\="java.util.logging.Level"><rhs name\="java.util.logging.Level"/></lhs></history>
content_assist_number_of_computers=13 content_assist_number_of_computers=13

View file

@ -1,6 +1,11 @@
--- ../src-base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000 --- ../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 +++ ../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 class RenderBlocks
{ {
public IBlockAccess field_1772_a; public IBlockAccess field_1772_a;
@ -182,7 +187,7 @@
public RenderBlocks(IBlockAccess p_i647_1_) public RenderBlocks(IBlockAccess p_i647_1_)
{ {
@@ -126,10 +127,40 @@ @@ -126,10 +129,40 @@
{ {
int var5 = p_1234_1_.func_210_f(); 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_); 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 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 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_); + 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 var5 = this.field_1772_a.func_602_e(p_40729_2_, p_40729_3_, p_40729_4_);
int var6 = var5 & 3; int var6 = var5 & 3;
@@ -169,7 +200,7 @@ @@ -169,7 +202,7 @@
} }
} }
@ -234,7 +239,7 @@
{ {
Tessellator var5 = Tessellator.field_1512_a; Tessellator var5 = Tessellator.field_1512_a;
int var6 = this.field_1772_a.func_602_e(p_22331_2_, p_22331_3_, p_22331_4_); 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; return true;
} }
@ -243,7 +248,7 @@
{ {
p_40730_1_.func_213_a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); 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_); 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; return true;
} }
@ -252,7 +257,7 @@
{ {
this.func_1228_k(p_40728_1_, p_40728_2_, p_40728_3_, p_40728_4_); this.func_1228_k(p_40728_1_, p_40728_2_, p_40728_3_, p_40728_4_);
Tessellator var5 = Tessellator.field_1512_a; Tessellator var5 = Tessellator.field_1512_a;
@@ -467,7 +498,7 @@ @@ -467,7 +500,7 @@
return true; 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 var5 = this.field_1772_a.func_602_e(p_22332_2_, p_22332_3_, p_22332_4_);
int var6 = var5 & 3; int var6 = var5 & 3;
@@ -557,7 +588,7 @@ @@ -557,7 +590,7 @@
this.field_1773_d = false; 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_); 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; boolean var7 = p_31074_5_ || (var6 & 8) != 0;
@@ -660,7 +691,7 @@ @@ -660,7 +693,7 @@
return true; return true;
} }
@ -279,7 +284,7 @@
{ {
int var16 = 108; 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); var19.func_983_a(p_31076_3_, p_31076_7_, p_31076_11_, var24, var26);
} }
@ -288,7 +293,7 @@
{ {
int var16 = 108; 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); var19.func_983_a(p_31081_3_, p_31081_7_, p_31081_11_, var24, var26);
} }
@ -297,7 +302,7 @@
{ {
int var16 = 108; int var16 = 108;
@@ -736,7 +767,7 @@ @@ -736,7 +769,7 @@
this.field_1773_d = false; 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 var6 = this.field_1772_a.func_602_e(p_31080_2_, p_31080_3_, p_31080_4_);
int var7 = BlockPistonExtension.func_31050_c(var6); int var7 = BlockPistonExtension.func_31050_c(var6);
@@ -2707,7 +2738,7 @@ @@ -2707,7 +2740,7 @@
} }
} }
@ -315,7 +320,7 @@
{ {
int var5 = 0; int var5 = 0;
float var6 = 0.0F; 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); 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); 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_22351_H *= p_22330_5_;
this.field_22350_I *= 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); 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)); 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_22351_H *= p_22330_5_;
this.field_22350_I *= 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); 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); 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_22351_H *= p_22330_5_;
this.field_22350_I *= 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); 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); 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_22351_H *= p_22330_5_;
this.field_22350_I *= p_22330_5_; this.field_22350_I *= p_22330_5_;
@@ -3632,7 +3663,7 @@ @@ -3632,7 +3665,7 @@
return var8; return var8;
} }
@ -360,7 +365,7 @@
{ {
if (p_35924_1_ == 0) 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); 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); 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_); 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); 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); 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); 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_); 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); 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); 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); 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_); 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); 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); 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); 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_); 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); 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); p_1227_1_.func_213_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
} }
+ else + else
+ { + {
+ ModLoader.renderInvBlock(this, p_1227_1_, p_1227_2_, var6); + FMLClientHandler.instance().renderInventoryBlock(this, p_1227_1_, p_1227_2_, var6);
+ } + }
} }
else else
{ {
@@ -5326,6 +5361,17 @@ @@ -5326,6 +5363,17 @@
public static boolean func_1219_a(int p_1219_0_) public static boolean func_1219_a(int p_1219_0_)
{ {
@ -422,7 +427,7 @@
+ case 22: + case 22:
+ case 21: + case 21:
+ case 16: return true; + case 16: return true;
+ default: return ModLoader.renderBlockIsItemFull3D(p_1219_0_); + default: return FMLClientHandler.instance().renderItemAsFull3DBlock(p_1219_0_);
+ } + }
} }
} }

View file

@ -18,3 +18,12 @@
} }
public void func_44023_a(String p_44023_1_) 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;
+ }
}

View file

@ -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;
+ }
}

View file

@ -1,11 +1,16 @@
--- ../src-base/minecraft_server/net/minecraft/src/StringTranslate.java 0000-00-00 00:00:00.000000000 -0000 --- ../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 +++ ../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_); String var3 = this.field_25081_b.getProperty(p_25078_1_, p_25078_1_);
return String.format(var3, p_25078_2_); return String.format(var3, p_25078_2_);
} }
+ +
+ public String getCurrentLanguage() { + public String getCurrentLanguage() {
+ return this.field_44012_d; + return this.field_44012_d;
+ }
+
+ public Properties getCurrentLanguageTable()
+ {
+ return this.field_25081_b;
+ } + }
} }

View file

@ -3,7 +3,7 @@
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
package net.minecraft.src; package net.minecraft.src;
+import cpw.mods.fml.server.FMLServerHandler; +import cpw.mods.fml.common.FMLCommonHandler;
+ +
public class TileEntityFurnace extends TileEntity implements IInventory public class TileEntityFurnace extends TileEntity implements IInventory
{ {
@ -13,7 +13,7 @@
{ {
int var1 = p_194_1_.func_569_a().field_234_aS; 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 : 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()))))));
} }
} }

View file

@ -16,12 +16,14 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
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.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.src.BaseMod; import net.minecraft.src.BaseMod;
import net.minecraft.src.BiomeGenBase; import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.Block;
import net.minecraft.src.CommonRegistry; import net.minecraft.src.CommonRegistry;
import net.minecraft.src.EntityItem; import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
@ -29,6 +31,7 @@ import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.IChunkProvider; import net.minecraft.src.IChunkProvider;
import net.minecraft.src.ICommandListener; import net.minecraft.src.ICommandListener;
import net.minecraft.src.IInventory; import net.minecraft.src.IInventory;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.NetworkManager; import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet1Login; import net.minecraft.src.Packet1Login;
@ -549,21 +552,38 @@ public class FMLServerHandler implements IFMLSidedHandler
WorldType.field_48457_b.addNewBiome(biome); WorldType.field_48457_b.addNewBiome(biome);
} }
/* (non-Javadoc)
* @see cpw.mods.fml.common.IFMLSidedHandler#getMinecraftInstance()
*/
@Override @Override
public Object getMinecraftInstance() public Object getMinecraftInstance()
{ {
return server; return server;
} }
/* (non-Javadoc)
* @see cpw.mods.fml.common.IFMLSidedHandler#getCurrentLanguage()
*/
@Override @Override
public String getCurrentLanguage() public String getCurrentLanguage()
{ {
return StringTranslate.func_25079_a().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;
}
} }

View file

@ -12,6 +12,7 @@
*/ */
package net.minecraft.src; package net.minecraft.src;
import java.util.Map;
import java.util.Random; import java.util.Random;
import net.minecraft.server.MinecraftServer; 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 public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDispenseHandler, ICraftingHandler, INetworkHandler, IConsoleHandler, IPlayerTracker
{ {
// CALLBACK MECHANISMS // CALLBACK MECHANISMS
public boolean doTickInGame(Object minecraftInstance, Object ... data)
/**
* @param minecraftInstance
* @return
*/
public final boolean doTickInGame(Object minecraftInstance, Object... data)
{ {
return onTickInGame((MinecraftServer)minecraftInstance); return onTickInGame((MinecraftServer)minecraftInstance);
} }
public final boolean doTickInGui(Object minecraftInstance, Object... data)
{
return true;
}
@Override @Override
public final void onCrafting(Object... craftingParameters) 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]); takenFromFurnace((EntityPlayer)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)
{ {
@ -53,6 +65,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
{ {
return onChatMessageReceived((EntityPlayer)data[1], (Packet3Chat)data[0]); return onChatMessageReceived((EntityPlayer)data[1], (Packet3Chat)data[0]);
} }
@Override @Override
public final void onPlayerLogin(Object player) public final void onPlayerLogin(Object player)
{ {
@ -60,13 +73,13 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
} }
@Override @Override
public void onPlayerLogout(Object player) public final void onPlayerLogout(Object player)
{ {
onClientLogout((EntityPlayer)player); onClientLogout((EntityPlayer)player);
} }
@Override @Override
public void onPlayerChangedDimension(Object player) public final void onPlayerChangedDimension(Object player)
{ {
onClientDimensionChanged((EntityPlayer)player); onClientDimensionChanged((EntityPlayer)player);
} }
@ -101,14 +114,43 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
} }
} }
/**
* 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]);
} }
/**
* @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 // 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
@ -118,8 +160,14 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
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
@ -136,6 +184,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* 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
@ -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 * 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
@ -158,6 +208,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* 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()
@ -167,19 +218,26 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* 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
*/ */
@ -194,6 +252,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* Handle item pickup * Handle item pickup
*
* @param player * @param player
* @param item * @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)} * 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
*/ */
@ -211,28 +271,52 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
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(EntityPlayer, 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 #onChatMessageReceived(EntityPlayer, Packet3Chat)}
*
* @param text
*/
public void receiveChatPacket(String text)
{
}
/**
* Only called on the client side
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)} * {@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
@ -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 * 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
@ -293,7 +378,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* Called when a new client logs in. * Called when a new client logs in.
* *
* @param player * @param player
*/ */
public void onClientLogin(EntityPlayer player) public void onClientLogin(EntityPlayer player)
{ {
@ -306,7 +391,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
*/ */
public void onClientLogout(EntityPlayer player) public void onClientLogout(EntityPlayer player)
{ {
} }
/** /**
@ -317,7 +402,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
*/ */
public void onClientDimensionChanged(EntityPlayer player) public void onClientDimensionChanged(EntityPlayer player)
{ {
} }
// Spare client junk // Spare client junk

View file

@ -14,6 +14,7 @@ package net.minecraft.src;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -36,13 +37,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 FMLServerHandler#fuelLookup(int, int)} * {@link FMLCommonHandler#fuelLookup(int, int)}
*
* @param id * @param id
* @param metadata * @param metadata
* @return * @return
@ -53,13 +57,20 @@ 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;
@ -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 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;
@ -131,17 +146,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
*/ */
@ -152,6 +169,7 @@ public class ModLoader
/** /**
* Add a shapeless recipe * Add a shapeless recipe
*
* @param output * @param output
* @param params * @param params
*/ */
@ -162,6 +180,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
*/ */
@ -172,6 +191,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
@ -192,13 +212,14 @@ public class ModLoader
* @param spawnList * @param spawnList
* @param biomes * @param biomes
*/ */
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes) public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
{ {
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes); CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
} }
/** /**
* 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
@ -227,6 +248,7 @@ public class ModLoader
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented elsewhere.
* {@link FMLServerHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} * {@link FMLServerHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
*
* @param world * @param world
* @param x * @param x
* @param y * @param y
@ -244,6 +266,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
@ -302,6 +325,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()
@ -310,8 +334,8 @@ public class ModLoader
} }
/** /**
* Get a logger instance * Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
* {@link FMLServerHandler#getFMLLogger()} *
* @return * @return
*/ */
public static Logger getLogger() public static Logger getLogger()
@ -319,15 +343,30 @@ 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 FMLServerHandler.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
* @return * @return
*/ */
public static <T, E> T getPrivateValue(Class <? super E > instanceclass, E instance, int fieldindex) public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
{ {
return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex); return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
} }
@ -335,19 +374,30 @@ 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
* @return * @return
*/ */
public static <T, E> T getPrivateValue(Class <? super E > instanceclass, E instance, String field) public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field)
{ {
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()
@ -355,9 +405,33 @@ public class ModLoader
return FMLCommonHandler.instance().nextUniqueEntityListId(); 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
*/ */
@ -366,9 +440,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 FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} * {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
*
* @param packet * @param packet
*/ */
@Deprecated @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 * Register a new block
*
* @param block * @param block
*/ */
public static void registerBlock(Block block) public static void registerBlock(Block block)
@ -387,42 +514,52 @@ public class ModLoader
/** /**
* Register a new block * Register a new block
*
* @param block * @param block
* @param itemclass * @param itemclass
*/ */
public static void registerBlock(Block block, Class <? extends ItemBlock > itemclass) public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
{ {
CommonRegistry.registerBlock(block, itemclass); CommonRegistry.registerBlock(block, itemclass);
} }
/** /**
* Register a new entity ID * Register a new entity ID
*
* @param entityClass * @param entityClass
* @param entityName * @param entityName
* @param id * @param id
*/ */
public static void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id) public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
{ {
CommonRegistry.registerEntityID(entityClass, entityName, id); CommonRegistry.registerEntityID(entityClass, entityName, id);
} }
/** /**
* Register a new entity ID * Register a new entity ID
*
* @param entityClass * @param entityClass
* @param entityName * @param entityName
* @param id * @param id
* @param background * @param background
* @param foreground * @param foreground
*/ */
public static void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id, int background, int foreground) public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
{ {
CommonRegistry.registerEntityID(entityClass, entityName, id, background, 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 * 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
*/ */
@ -433,19 +570,25 @@ public class ModLoader
/** /**
* Register a new tile entity class * Register a new tile entity class
*
* @param tileEntityClass * @param tileEntityClass
* @param id * @param id
*/ */
public static void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id) public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
{ {
CommonRegistry.registerTileEntity(tileEntityClass, id); CommonRegistry.registerTileEntity(tileEntityClass, id);
} }
public static void registerTileEntity(Class<? extends TileEntity> 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 * @param biome
*/ */
@Deprecated
public static void removeBiome(BiomeGenBase biome) public static void removeBiome(BiomeGenBase biome)
{ {
CommonRegistry.removeBiome(biome); CommonRegistry.removeBiome(biome);
@ -453,27 +596,30 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityClass * @param entityClass
* @param spawnList * @param spawnList
*/ */
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType spawnList) public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
{ {
CommonRegistry.removeSpawn(entityClass, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes()); CommonRegistry.removeSpawn(entityClass, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
} }
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityClass * @param entityClass
* @param spawnList * @param spawnList
* @param biomes * @param biomes
*/ */
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes) public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
{ {
CommonRegistry.removeSpawn(entityClass, spawnList, biomes); CommonRegistry.removeSpawn(entityClass, spawnList, biomes);
} }
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityName * @param entityName
* @param spawnList * @param spawnList
*/ */
@ -484,6 +630,7 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityName * @param entityName
* @param spawnList * @param spawnList
* @param biomes * @param biomes
@ -493,6 +640,24 @@ public class ModLoader
CommonRegistry.removeSpawn(entityName, spawnList, biomes); 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 * Configuration is handled elsewhere
* {@link ModLoaderModContainer} * {@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)} * {@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
* @param value * @param value
*/ */
public static <T, E> void setPrivateValue(Class <? super T > instanceclass, T instance, int fieldindex, E value) public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, int fieldindex, E value)
{ {
ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value); ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value);
} }
@ -543,12 +720,13 @@ 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
* @param value * @param value
*/ */
public static <T, E> void setPrivateValue(Class <? super T > instanceclass, T instance, String field, E value) public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, String field, E value)
{ {
ReflectionHelper.setPrivateValue(instanceclass, instance, field, 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. * This method is a call in hook from modified external code. Implemented elsewhere.
* {@link FMLServerHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)} * {@link FMLServerHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
*
* @param player * @param player
* @param item * @param item
* @param matrix * @param matrix
@ -568,6 +747,7 @@ public class ModLoader
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented elsewhere.
* {@link FMLServerHandler#onItemSmelted(EntityPlayer, ItemStack)} * {@link FMLServerHandler#onItemSmelted(EntityPlayer, ItemStack)}
*
* @param player * @param player
* @param item * @param item
*/ */
@ -584,38 +764,11 @@ public class ModLoader
*/ */
public static void throwException(String message, Throwable e) public static void throwException(String message, Throwable e)
{ {
FMLServerHandler.instance().raiseException(e, message, true); FMLCommonHandler.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);
} }
/** public static void throwException(Throwable e)
* Stubbed method on the server to return a unique model id {
* throwException("Exception in ModLoader", e);
*/
@Deprecated
public static int getUniqueBlockModelID(BaseMod mod, boolean flag) {
return 0;
} }
} }