1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package miscutil.core.gui;
import miscutil.MiscUtils;
import miscutil.core.tileentities.TileEntityHeliumGenerator;
import miscutil.core.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
public class ModGUI {
public static void init(){
Utils.LOG_INFO("Registering GUIs.");
NetworkRegistry.INSTANCE.registerGuiHandler(MiscUtils.instance, new GUI_HANDLER());
//Register GuiHandler
//NetworkRegistry.INSTANCE.registerGuiHandler(MiscUtils.instance, new GuiHandler());
}
}
class GUI_HANDLER implements IGuiHandler {
@Override
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z){
if(ID == 0)
return false;
else if(ID == 1)
return false;
else if(ID == 2)
return new GUIHeliumGenerator(player.inventory, (TileEntityHeliumGenerator)world.getTileEntity(x, y, z));
else if(ID == 3)
return false;
return null;
}
@Override
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z){
if(ID == 0)
return false;
else if(ID == 1)
return false;
else if(ID == 2)
return new ContainerHeliumGenerator(player.inventory, (TileEntityHeliumGenerator)world.getTileEntity(x, y, z));
else if(ID == 3)
return false;
return null;
}
}
|