ActuallyAdditions/src/main/java/ellpeck/gemification/inventory/GuiHandler.java

58 lines
2.3 KiB
Java
Raw Normal View History

2014-12-18 19:24:06 +01:00
package ellpeck.gemification.inventory;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.gemification.Gemification;
2014-12-20 21:34:07 +01:00
import ellpeck.gemification.booklet.ContainerInfoBook;
import ellpeck.gemification.booklet.GuiInfoBook;
2014-12-18 19:24:06 +01:00
import ellpeck.gemification.inventory.container.ContainerCrucible;
import ellpeck.gemification.inventory.container.ContainerCrucibleFire;
import ellpeck.gemification.inventory.gui.GuiCrucible;
import ellpeck.gemification.inventory.gui.GuiCrucibleFire;
import ellpeck.gemification.tile.TileEntityBase;
import ellpeck.gemification.tile.TileEntityCrucible;
import ellpeck.gemification.tile.TileEntityCrucibleFire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler {
public static final int guiCrucible = 0;
public static final int guiCrucibleFire = 1;
2014-12-20 21:34:07 +01:00
public static final int guiInfoBook = 2;
2014-12-18 19:24:06 +01:00
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z) {
TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z);
switch (id) {
case guiCrucible:
return new ContainerCrucible(entityPlayer.inventory, (TileEntityCrucible)tile);
case guiCrucibleFire:
return new ContainerCrucibleFire(entityPlayer.inventory, (TileEntityCrucibleFire)tile);
2014-12-20 21:34:07 +01:00
case guiInfoBook:
return new ContainerInfoBook(entityPlayer);
2014-12-18 19:24:06 +01:00
default:
return null;
}
}
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z) {
TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z);
switch (id) {
case guiCrucible:
return new GuiCrucible(entityPlayer.inventory, (TileEntityCrucible)tile);
case guiCrucibleFire:
return new GuiCrucibleFire(entityPlayer.inventory, (TileEntityCrucibleFire)tile);
2014-12-20 21:34:07 +01:00
case guiInfoBook:
return new GuiInfoBook(entityPlayer);
2014-12-18 19:24:06 +01:00
default:
return null;
}
}
public static void init(){
NetworkRegistry.INSTANCE.registerGuiHandler(Gemification.instance, new GuiHandler());
}
}