Changed IGuiHandler's signature to be compatible with both sides. Took out ModLoaderMp reference in README.

This commit is contained in:
LexManos 2012-04-07 08:08:14 -07:00
parent ea41a93de3
commit 6e31fc0185
6 changed files with 26 additions and 46 deletions

View file

@ -1,21 +0,0 @@
package net.minecraft.src.forge;
import net.minecraft.src.EntityPlayerSP;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.World;
public interface IGuiHandler
{
/**
* Returns a GuiScreen to be displayed to the user. This is client side
*
* @param ID The Gui ID Number
* @param player The player viewing the Gui
* @param world The current world
* @param X X Position
* @param Y Y Position
* @param Z Z Position
* @return A GuiScreen to be displayed to the user, null if none.
*/
public GuiScreen getGuiScreen(int ID, EntityPlayerSP player, World world, int X, int Y, int Z);
}

View file

@ -0,0 +1,22 @@
package net.minecraft.src.forge;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World;
public interface IGuiHandler
{
/**
* Returns a Container to be displayed to the user.
* On the client side, this needs to return a instance of GuiScreen
* On the server side, this needs to return a instance of Container
*
* @param ID The Gui ID Number
* @param player The player viewing the Gui
* @param world The current world
* @param x X Position
* @param y Y Position
* @param z Z Position
* @return A GuiScreen/Container to be displayed to the user, null if none.
*/
public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
}

View file

@ -1,21 +0,0 @@
package net.minecraft.src.forge;
import net.minecraft.src.Container;
import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.World;
public interface IGuiHandler
{
/**
* Returns a Container to be displayed to the user. This is server side
*
* @param ID The Gui ID Number
* @param player The player viewing the Gui
* @param world The current world
* @param X X Position
* @param Y Y Position
* @param Z Z Position
* @return A GuiScreen to be displayed to the user, null if none.
*/
public Container getGuiContainer(int ID, EntityPlayerMP player, World world, int X, int Y, int Z);
}

View file

@ -4,8 +4,8 @@ Extract the download archive directly into your MCP-directiory.
It should create a folder "forge" within that directory, containing all
extracted files.
You should use freshly downloaded jars, solely including ModLoader &
ModLoaderMP. Anything else can eventually cause conflicts.
You should use freshly downloaded jars, solely including ModLoader in the
client jar. Anything else can eventually cause conflicts.
You also need to install the FernFlower decompiler, you can download it at
http://goo.gl/PnJHp. Extract fernflower.jar into your MCP's runtime/bin folder.

View file

@ -153,7 +153,7 @@
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
+ if (handler != null)
+ {
+ GuiScreen screen = handler.getGuiScreen(ID, (EntityPlayerSP)this, world, x, y, z);
+ GuiScreen screen = (GuiScreen)handler.getGuiElement(ID, this, world, x, y, z);
+ if (screen != null)
+ {
+ ModLoader.getMinecraftInstance().displayGuiScreen(screen);

View file

@ -168,7 +168,7 @@
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
+ if (handler != null)
+ {
+ Container container = handler.getGuiContainer(ID, player, world, x, y, z);
+ Container container = (Container)handler.getGuiElement(ID, player, world, x, y, z);
+ if (container != null)
+ {
+ player.realGetNextWidowId();