    001package cpw.mods.fml.common.modloader;
    002
    003import java.util.Set;
    004
    005import net.minecraft.entity.player.EntityPlayer;
    006import net.minecraft.inventory.Container;
    007import net.minecraft.world.World;
    008
    009import com.google.common.collect.Sets;
    010
    011import cpw.mods.fml.common.network.IGuiHandler;
    012
    013public class ModLoaderGuiHelper implements IGuiHandler
    014{
    015
    016    private BaseModProxy mod;
    017    private Set<Integer> ids;
    018    private Container container;
    019    private int currentID;
    020
    021    ModLoaderGuiHelper(BaseModProxy mod)
    022    {
    023        this.mod = mod;
    024        this.ids = Sets.newHashSet();
    025    }
    026
    027    @Override
    028    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
    029    {
    030        return container;
    031    }
    032
    033    @Override
    034    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
    035    {
    036        return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
    037    }
    038
    039    public void injectContainerAndID(Container container, int ID)
    040    {
    041        this.container = container;
    042        this.currentID = ID;
    043    }
    044
    045    public Object getMod()
    046    {
    047        return mod;
    048    }
    049
    050    public void associateId(int additionalID)
    051    {
    052        this.ids.add(additionalID);
    053    }
    054
    055}