-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathGuiHandler.java
More file actions
38 lines (29 loc) · 1.14 KB
/
GuiHandler.java
File metadata and controls
38 lines (29 loc) · 1.14 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
package vswe.stevesfactory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import vswe.stevesfactory.blocks.ITileEntityInterface;
public class GuiHandler implements IGuiHandler {
public GuiHandler() {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
if (te != null && te instanceof ITileEntityInterface) {
return ((ITileEntityInterface)te).getContainer(te, player.inventory);
}else{
return null;
}
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
if (te != null && te instanceof ITileEntityInterface) {
return ((ITileEntityInterface)te).getGui(te, player.inventory);
}else{
return null;
}
}
}