API is restored for client side. Implementation starting.

This commit is contained in:
Christian Weeks 2012-05-05 14:42:46 -04:00
parent 50a3543de0
commit e0e77a6bb5
10 changed files with 392 additions and 106 deletions

View file

@ -196,7 +196,7 @@
</zip> </zip>
</target> </target>
<target name="build" depends="init,clean,merge-server,patch,build-server,build-source-pack" /> <target name="build" depends="init,clean,merge-server,merge-client,patch,build-server,build-client,build-source-pack" />
<target name="patch" depends="init"> <target name="patch" depends="init">
<exec executable="${python.exe}" dir="${basedir}"> <exec executable="${python.exe}" dir="${basedir}">

View file

@ -13,6 +13,7 @@ package net.minecraft.src;
*/ */
import java.util.Map;
import java.util.Random; import java.util.Random;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -127,6 +128,9 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
return 0; return 0;
} }
public void addRenderer(Map<Class<? extends Entity>, Render> 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
@ -192,6 +196,9 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
/** /**
* Load your mod * Load your mod
*/ */
public void keyboardEvent(KeyBinding event) {
}
public abstract void load(); public abstract void load();
/** /**
@ -220,26 +227,38 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
return false; return false;
} }
public boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui)
{
return false;
}
/** /**
* Not implemented because on the server you don't know who it's from
* {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)} * {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)}
* @param text * @param text
*/ */
@Deprecated
public void receiveChatPacket(String text) public void receiveChatPacket(String text)
{ {
//TODO
} }
/** /**
* Not implemented because on the server you don't know who it's from
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)} * {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)}
* @param packet * @param packet
*/ */
@Deprecated
public void receiveCustomPacket(Packet250CustomPayload packet) public void receiveCustomPacket(Packet250CustomPayload packet)
{ {
//TODO
} }
public void registerAnimation(Minecraft game) {
}
public void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID) {
}
public boolean renderWorldBlock(RenderBlocks 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
@ -319,12 +338,4 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
{ {
} }
// Spare client junk
// -------
// void addRenderer(Map<Class<? extends Entity>, Render> renderers);
// void registerAnimation(Minecraft game);
// void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID);
// boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID);
// boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui);
// void keyboardEvent(KeyBinding event);
} }

View file

@ -6,6 +6,9 @@ import java.util.List;
public class ClientRegistry implements IMinecraftRegistry public class ClientRegistry implements IMinecraftRegistry
{ {
public static ClientRegistry instance() {
return (ClientRegistry) CommonRegistry.instance();
}
@Override @Override
public void addRecipe(ItemStack output, Object... params) public void addRecipe(ItemStack output, Object... params)
{ {
@ -64,6 +67,12 @@ public class ClientRegistry implements IMinecraftRegistry
TileEntity.addNewTileEntityMapping(tileEntityClass, id); TileEntity.addNewTileEntityMapping(tileEntityClass, id);
} }
public void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id, TileEntitySpecialRenderer specialRenderer)
{
registerTileEntity(tileEntityClass, id);
TileEntityRenderer.setTileEntityRenderer(tileEntityClass, specialRenderer);
}
@Override @Override
public void addBiome(BiomeGenBase biome) public void addBiome(BiomeGenBase biome)
{ {

View file

@ -1,4 +1,5 @@
package net.minecraft.src; 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,8 +13,9 @@ package net.minecraft.src;
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
import java.awt.image.BufferedImage;
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.client.Minecraft; import net.minecraft.client.Minecraft;
@ -39,9 +41,11 @@ 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 FMLClientHandler#fuelLookup(int, int)}
*
* @param id * @param id
* @param metadata * @param metadata
* @return * @return
@ -52,20 +56,29 @@ public class ModLoader
return 0; return 0;
} }
static void addAllRenderers(Map<Class<? extends Entity>, Render> renderers)
{
}
static void addAnimation(TextureFX 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)
{ {
// TODO
return 0; return 0;
} }
/** /**
* 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 * @param biome
*/ */
@ -76,71 +89,78 @@ public class ModLoader
/** /**
* Unimplemented on the server as it does not generate names * Unimplemented on the server as it does not generate names
*
* @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)
{ {
// TODO
} }
/** /**
* Unimplemented on the server as it does not generate names * Unimplemented on the server as it does not generate names
*
* @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)
{ {
// TODO
} }
/** /**
* 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 name * @param name
*/ */
@Deprecated
public static void addName(Object instance, String name) public static void addName(Object instance, String name)
{ {
// TODO
} }
/** /**
* 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)
{ {
// TODO
} }
/** /**
* 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)
{ {
// TODO
return 0; return 0;
} }
/** /**
* 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)
{ {
// TODO
} }
/** /**
* Add a Shaped Recipe * Add a Shaped Recipe
*
* @param output * @param output
* @param params * @param params
*/ */
@ -151,6 +171,7 @@ public class ModLoader
/** /**
* Add a shapeless recipe * Add a shapeless recipe
*
* @param output * @param output
* @param params * @param params
*/ */
@ -161,6 +182,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
*/ */
@ -171,19 +193,21 @@ 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
* @param max * @param max
* @param spawnList * @param spawnList
*/ */
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)
{ {
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes()); CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
} }
/** /**
* 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
@ -191,13 +215,15 @@ 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
@ -211,6 +237,7 @@ public class ModLoader
/** /**
* Add a mob to the spawn list * Add a mob to the spawn list
*
* @param entityName * @param entityName
* @param weightedProb * @param weightedProb
* @param min * @param min
@ -224,8 +251,10 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented
* elsewhere.
* {@link FMLClientHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} * {@link FMLClientHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
*
* @param world * @param world
* @param x * @param x
* @param y * @param y
@ -243,6 +272,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
@ -257,7 +287,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++)
{ {
@ -278,19 +308,20 @@ public class ModLoader
if (i1 > itemstack.field_1615_a) if (i1 > itemstack.field_1615_a)
{ {
i1 = itemstack.field_1615_a ; i1 = itemstack.field_1615_a;
} }
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, 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; 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;
entityitem.field_606_ap = (float)world.field_1037_n.nextGaussian() * f3; entityitem.field_606_ap = (float) world.field_1037_n.nextGaussian() * f3;
if (itemstack.func_40710_n()) if (itemstack.func_40710_n())
{ {
entityitem.field_801_a.func_40706_d((NBTTagCompound)itemstack.func_40709_o().func_40195_b()); entityitem.field_801_a.func_40706_d((NBTTagCompound) itemstack.func_40709_o().func_40195_b());
} }
world.func_674_a(entityitem); world.func_674_a(entityitem);
@ -301,6 +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()
@ -309,8 +341,8 @@ public class ModLoader
} }
/** /**
* Get a logger instance * Get a logger instance {@link FMLClientHandler#getFMLLogger()}
* {@link FMLClientHandler#getFMLLogger()} *
* @return * @return
*/ */
public static Logger getLogger() public static Logger getLogger()
@ -318,15 +350,32 @@ public class ModLoader
return FMLCommonHandler.instance().getFMLLogger(); return FMLCommonHandler.instance().getFMLLogger();
} }
static Minecraft getMinecraftInstance()
{
return FMLClientHandler.instance().getClient();
}
/**
* This is not the server {@link FMLClientHandler#getServer()}
*
* @return
*/
@Deprecated
public static Minecraft getMinecraftServerInstance()
{
return null;
}
/** /**
* 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);
} }
@ -334,19 +383,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);
} }
/** /**
* Get a new unique entity id * Stubbed method on the server to return a unique model id
* {@link Entity#getNextId()} *
*/
public static int getUniqueBlockModelID(BaseMod mod, boolean flag)
{
// TODO
return 0;
}
/**
* Get a new unique entity id {@link Entity#getNextId()}
*
* @return * @return
*/ */
public static int getUniqueEntityId() public static int getUniqueEntityId()
@ -354,9 +414,34 @@ public class ModLoader
return FMLCommonHandler.instance().nextUniqueEntityListId(); return FMLCommonHandler.instance().nextUniqueEntityListId();
} }
static int getUniqueSpriteIndex(String path)
{
// TODO
return 0;
}
/** /**
* Is the named mod loaded? * To properly implement packet 250 protocol you should always check your
* {@link Loader#isModLoaded(String)} * 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);
}
static boolean isGUIOpen(Class<? extends GuiScreen> gui)
{
//TODO
return false;
}
/**
* Is the named mod loaded? {@link Loader#isModLoaded(String)}
*
* @param modname * @param modname
* @return * @return
*/ */
@ -366,8 +451,49 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * Implemented elsewhere
*/
@Deprecated
static void loadConfig()
{
}
static BufferedImage loadImage(RenderEngine texCache, String path)
{
//TODO
return null;
}
/**
* Call in from elsewhere. Unimplemented here.
* @param player
* @param item
*/
@Deprecated
static void onItemPickup(EntityPlayer player, ItemStack item)
{
}
static void onTick(float tick, Minecraft game)
{
//TODO
}
static void openGUI(EntityPlayer player, GuiScreen gui)
{
//TODO
}
@Deprecated
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 FMLClientHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} * {@link FMLClientHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
*
* @param packet * @param packet
*/ */
@Deprecated @Deprecated
@ -375,8 +501,20 @@ public class ModLoader
{ {
} }
static KeyBinding[] registerAllKeys(KeyBinding[] keys)
{
//TODO
return keys;
}
static void registerAllTextureOverrides(RenderEngine cache)
{
//TODO
}
/** /**
* Register a new block * Register a new block
*
* @param block * @param block
*/ */
public static void registerBlock(Block block) public static void registerBlock(Block block)
@ -386,42 +524,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);
} }
static void registerKey(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
{
//TODO
}
/** /**
* 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
*/ */
@ -432,19 +580,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);
} }
static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, TileEntitySpecialRenderer renderer)
{
ClientRegistry.instance().registerTileEntity(tileEntityClass, id, renderer);
}
/** /**
* 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);
@ -452,27 +606,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, FMLClientHandler.instance().getDefaultOverworldBiomes()); CommonRegistry.removeSpawn(entityClass, spawnList, FMLClientHandler.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
*/ */
@ -483,6 +640,7 @@ public class ModLoader
/** /**
* Remove a spawn * Remove a spawn
*
* @param entityName * @param entityName
* @param spawnList * @param spawnList
* @param biomes * @param biomes
@ -492,9 +650,25 @@ public class ModLoader
CommonRegistry.removeSpawn(entityName, spawnList, biomes); CommonRegistry.removeSpawn(entityName, spawnList, biomes);
} }
static boolean renderBlockIsItemFull3D(int modelID)
{
//TODO
return false;
}
static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
{
//TODO
}
static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
{
//TODO
return false;
}
/** /**
* Configuration is handled elsewhere * Configuration is handled elsewhere {@link ModLoaderModContainer}
* {@link ModLoaderModContainer}
*/ */
@Deprecated @Deprecated
public static void saveConfig() public static void saveConfig()
@ -502,24 +676,32 @@ 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 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
}
static void serverLogin(NetClientHandler 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 * @param enable
* indicates whether you want to recieve them or not * indicates whether you want to recieve them or not
* @param useClock * @param useClock
* Not used in server side: all ticks are sent on the server side (no render subticks) * 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)
{ {
@ -527,15 +709,22 @@ public class ModLoader
mlmc.setTicking(enable); mlmc.setTicking(enable);
} }
static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
{
//TODO
}
/** /**
* 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,19 +732,22 @@ 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);
} }
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented
* elsewhere.
* {@link FMLClientHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)} * {@link FMLClientHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)}
*
* @param player * @param player
* @param item * @param item
* @param matrix * @param matrix
@ -566,8 +758,10 @@ public class ModLoader
} }
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented
* elsewhere.
* {@link FMLClientHandler#onItemSmelted(EntityPlayer, ItemStack)} * {@link FMLClientHandler#onItemSmelted(EntityPlayer, ItemStack)}
*
* @param player * @param player
* @param item * @param item
*/ */
@ -579,6 +773,7 @@ public class ModLoader
/** /**
* Throw the offered exception. Likely will stop the game. * Throw the offered exception. Likely will stop the game.
* {@link FMLClientHandler#raiseException(Throwable, String, boolean)} * {@link FMLClientHandler#raiseException(Throwable, String, boolean)}
*
* @param message * @param message
* @param e * @param e
*/ */
@ -586,36 +781,4 @@ public class ModLoader
{ {
FMLClientHandler.instance().raiseException(e, message, true); FMLClientHandler.instance().raiseException(e, message, true);
} }
/**
* Get the minecraft server instance
* {@link FMLClientHandler#getServer()}
* @return
*/
public static Minecraft getMinecraftServerInstance()
{
return FMLClientHandler.instance().getClient();
}
/**
* 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);
}
/**
* Stubbed method on the server to return a unique model id
*
*/
@Deprecated
public static int getUniqueBlockModelID(BaseMod mod, boolean flag) {
return 0;
}
} }

View file

@ -0,0 +1,66 @@
package cpw.mods.fml.common;
/**
* Copied from ConsoleLogFormatter for shared use on the client
*
*/
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
final class FMLLogFormatter extends Formatter
{
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public String format(LogRecord record)
{
StringBuilder msg = new StringBuilder();
msg.append(this.dateFormat.format(Long.valueOf(record.getMillis())));
Level lvl = record.getLevel();
if (lvl == Level.FINEST)
{
msg.append(" [FINEST] ");
}
else if (lvl == Level.FINER)
{
msg.append(" [FINER] ");
}
else if (lvl == Level.FINE)
{
msg.append(" [FINE] ");
}
else if (lvl == Level.INFO)
{
msg.append(" [INFO] ");
}
else if (lvl == Level.WARNING)
{
msg.append(" [WARNING] ");
}
else if (lvl == Level.SEVERE)
{
msg.append(" [SEVERE] ");
}
else if (lvl == Level.SEVERE)
{
msg.append(" [" + lvl.getLocalizedName() + "] ");
}
msg.append(record.getMessage());
msg.append('\n');
Throwable thr = record.getThrown();
if (thr != null)
{
StringWriter thrDump = new StringWriter();
thr.printStackTrace(new PrintWriter(thrDump));
msg.append(thrDump.toString());
}
return msg.toString();
}
}

View file

@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler; import java.util.logging.FileHandler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -128,17 +129,22 @@ public class Loader
private Loader() private Loader()
{ {
FMLLogFormatter formatter=new FMLLogFormatter();
if (FMLCommonHandler.instance().getMinecraftLogger()!=null) { if (FMLCommonHandler.instance().getMinecraftLogger()!=null) {
Loader.log.setParent(FMLCommonHandler.instance().getMinecraftLogger()); Loader.log.setParent(FMLCommonHandler.instance().getMinecraftLogger());
} else {
ConsoleHandler ch=new ConsoleHandler();
Loader.log.setUseParentHandlers(false);
Loader.log.addHandler(ch);
ch.setFormatter(formatter);
} }
Loader.log.setLevel(Level.ALL); Loader.log.setLevel(Level.ALL);
FileHandler fileHandler;
try try
{ {
fileHandler = new FileHandler("ForgeModLoader-%g.log", 0, 3); FileHandler fileHandler = new FileHandler("ForgeModLoader-%g.log", 0, 3);
// We're stealing minecraft's log formatter // We're stealing minecraft's log formatter
fileHandler.setFormatter(FMLCommonHandler.instance().getMinecraftLogger().getHandlers()[0].getFormatter()); fileHandler.setFormatter(new FMLLogFormatter());
fileHandler.setLevel(Level.ALL); fileHandler.setLevel(Level.ALL);
Loader.log.addHandler(fileHandler); Loader.log.addHandler(fileHandler);
} }

View file

@ -98,5 +98,12 @@ public class CommonRegistry
{ {
instance.removeSpawn(entityName, spawnList, biomes); instance.removeSpawn(entityName, spawnList, biomes);
} }
/**
* @return
*/
public static IMinecraftRegistry instance()
{
return instance;
}
} }

View file

@ -15,6 +15,11 @@
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
</natures> </natures>
<linkedResources> <linkedResources>
<link>
<name>build.xml</name>
<type>1</type>
<location>/home/cpw/projects/mcworkspace/fmltestbed/FML/build.xml</location>
</link>
<link> <link>
<name>common</name> <name>common</name>
<type>2</type> <type>2</type>

View file

@ -17,3 +17,11 @@
this.field_22008_V = new AnvilSaveConverter(new File(this.field_6297_D, "saves")); this.field_22008_V = new AnvilSaveConverter(new File(this.field_6297_D, "saves"));
this.field_6304_y = new GameSettings(this, this.field_6297_D); this.field_6304_y = new GameSettings(this, this.field_6297_D);
this.field_6298_C = new TexturePackList(this, this.field_6297_D); this.field_6298_C = new TexturePackList(this, this.field_6297_D);
@@ -330,6 +333,7 @@
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ FMLClientHandler.instance().onLoadComplete();
this.func_6250_c("Startup");
this.field_6286_O = new OpenGlCapsChecker();
this.field_6301_A.func_340_a(this.field_6304_y);

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/src/TileEntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/TileEntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -124,4 +124,8 @@
{
return this.field_1541_n;
}
+
+ public static void setTileEntityRenderer(Class<? extends TileEntity> tileEntityClass, TileEntitySpecialRenderer renderer) {
+ field_1554_a.field_6517_m.put(tileEntityClass,renderer);
+ }
}