-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuiHandler.java
More file actions
113 lines (108 loc) · 3.86 KB
/
GuiHandler.java
File metadata and controls
113 lines (108 loc) · 3.86 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package LiquidMetals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import LiquidMetals.Blocks.TileCrafting;
import LiquidMetals.Blocks.TileFurnace;
import LiquidMetals.Blocks.TileGrinder1;
import LiquidMetals.Blocks.TileGrinder2;
import LiquidMetals.Blocks.TileGrinder3;
import LiquidMetals.Blocks.TileIngotFormer;
import LiquidMetals.GUI.ContainerCrafting;
import LiquidMetals.GUI.ContainerFurnace;
import LiquidMetals.GUI.ContainerGrinder1;
import LiquidMetals.GUI.ContainerGrinder2;
import LiquidMetals.GUI.ContainerGrinder3;
import LiquidMetals.GUI.ContainerIngotFormer;
import LiquidMetals.GUI.GuiCrafting;
import LiquidMetals.GUI.GuiFurnace;
import LiquidMetals.GUI.GuiGrinder1;
import LiquidMetals.GUI.GuiGrinder2;
import LiquidMetals.GUI.GuiGrinder3;
import LiquidMetals.GUI.GuiIngotFormer;
import cpw.mods.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler {
public static final int Grinder1 = 0;
public static final int Grinder2 = 1;
public static final int Grinder3 = 2;
public static final int Furnace = 3;
public static final int IngotFormer = 4;
public static final int Crafting = 5;
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
System.out.println("opens now.");
if(!world.blockExists(x, y, z))
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
if(ID == Grinder1) {
if(!(tile instanceof TileGrinder1)) {
return null;
}
return new GuiGrinder1(new ContainerGrinder1(player.inventory, (TileGrinder1) tile), (TileGrinder1) tile);
} else if(ID == Grinder2) {
if(!(tile instanceof TileGrinder2)) {
return null;
}
return new GuiGrinder2(new ContainerGrinder2(player.inventory, (TileGrinder2) tile), (TileGrinder2) tile);
} else if(ID == Grinder3) {
if(!(tile instanceof TileGrinder3)) {
return null;
}
return new GuiGrinder3(new ContainerGrinder3(player.inventory, (TileGrinder3) tile), (TileGrinder3) tile);
} else if(ID == Furnace) {
if(!(tile instanceof TileFurnace)) {
return null;
}
return new GuiFurnace(new ContainerFurnace(player.inventory, (TileFurnace) tile), (TileFurnace) tile);
} else if(ID == IngotFormer) {
if(!(tile instanceof TileIngotFormer)) {
return null;
}
return new GuiIngotFormer(new ContainerIngotFormer(player.inventory, (TileIngotFormer) tile), (TileIngotFormer) tile);
} else if(ID == Crafting) {
if(!(tile instanceof TileCrafting)) {
return null;
}
return new GuiCrafting(new ContainerCrafting(player.inventory, (TileCrafting) tile), (TileCrafting) tile);
}
return null;
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(!world.blockExists(x, y, z))
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
if(ID == Grinder1) {
if(!(tile instanceof TileGrinder1)) {
return null;
}
return new ContainerGrinder1(player.inventory, (TileGrinder1) tile);
} else if(ID == Grinder2) {
if(!(tile instanceof TileGrinder2)) {
return null;
}
return new ContainerGrinder2(player.inventory, (TileGrinder2) tile);
} else if(ID == Grinder3) {
if(!(tile instanceof TileGrinder3)) {
return null;
}
return new ContainerGrinder3(player.inventory, (TileGrinder3) tile);
} else if(ID == Furnace) {
if(!(tile instanceof TileFurnace)) {
return null;
}
return new ContainerFurnace(player.inventory, (TileFurnace) tile);
} else if(ID == IngotFormer) {
if(!(tile instanceof TileIngotFormer)) {
return null;
}
return new ContainerIngotFormer(player.inventory, (TileIngotFormer) tile);
} else if(ID == Crafting) {
if(!(tile instanceof TileCrafting)) {
return null;
}
return new ContainerCrafting(player.inventory, (TileCrafting) tile);
}
return null;
}
}