aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kekztech/GuiHandler.java
blob: 439baff31ff1ac008baa8fca50f3f4412803d76c (plain)
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
package kekztech;

import container.Container_ItemProxyEndpoint;
import container.Container_ItemProxySource;
import container.Gui_ItemProxyEndpoint;
import container.Gui_ItemProxySource;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class GuiHandler implements IGuiHandler {
	
	public static final int ITEM_PROXY_SOURCE = 0;
	public static final int ITEM_PROXY_ENDPOINT = 1;
	
	@Override
	public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
		final TileEntity te = world.getTileEntity(x, y, z);
		if(te != null) {
			switch(ID) {
			case ITEM_PROXY_SOURCE: return new Container_ItemProxySource(te, player);
			case ITEM_PROXY_ENDPOINT: return new Container_ItemProxyEndpoint(te, player);
			}
		}
		return null;
	}

	@Override
	public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
		final TileEntity te = world.getTileEntity(x, y, z);
		if(te != null) {
			switch(ID) {
			case ITEM_PROXY_SOURCE: return new Gui_ItemProxySource(te, player);
			case ITEM_PROXY_ENDPOINT: return new Gui_ItemProxyEndpoint(te, player);
			}
		}
		return null;
	}

}