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

40 lines
1.4 KiB
Java
Raw Normal View History

2015-01-30 20:16:32 +01:00
package ellpeck.someprettyrandomstuff.inventory;
2014-12-18 19:24:06 +01:00
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.someprettyrandomstuff.SPRS;
2015-01-30 20:16:32 +01:00
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.util.Util;
2014-12-18 19:24:06 +01:00
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler{
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 FEEDER_ID:
return new ContainerFeeder(entityPlayer.inventory, tile);
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 FEEDER_ID:
return new GuiFeeder(entityPlayer.inventory, tile);
2014-12-18 19:24:06 +01:00
default:
return null;
}
}
public static final int FEEDER_ID = 0;
2014-12-18 19:24:06 +01:00
public static void init(){
Util.logInfo("Initializing GuiHandler...");
NetworkRegistry.INSTANCE.registerGuiHandler(SPRS.instance, new GuiHandler());
2014-12-18 19:24:06 +01:00
}
}