package com.yolp900.itsjustacharm.client.guis;
import com.yolp900.itsjustacharm.common.inventory.ContainerConstructionTable;
import com.yolp900.itsjustacharm.common.tileEntities.TileEntityConstructionTable;
import com.yolp900.itsjustacharm.reference.LibGuis;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
public class ModGuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (player != null) {
if (ID == LibGuis.ConstructionTable.getID() && tile instanceof TileEntityConstructionTable) {
return new ContainerConstructionTable(player.inventory, (TileEntityConstructionTable)tile);
}
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (player != null) {
if (ID == LibGuis.ConstructionTable.getID() && tile instanceof TileEntityConstructionTable) {
return new GuiConstructionTable(player.inventory, (TileEntityConstructionTable)tile);
}
}
return null;
}
}