001/*
002 * Forge Mod Loader
003 * Copyright (c) 2012-2013 cpw.
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser Public License v2.1
006 * which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
008 * 
009 * Contributors:
010 *     cpw - implementation
011 */
012
013package cpw.mods.fml.common.modloader;
014
015import java.util.Set;
016
017import net.minecraft.entity.player.EntityPlayer;
018import net.minecraft.inventory.Container;
019import net.minecraft.world.World;
020
021import com.google.common.collect.Sets;
022
023import cpw.mods.fml.common.network.IGuiHandler;
024
025public class ModLoaderGuiHelper implements IGuiHandler
026{
027
028    private BaseModProxy mod;
029    private Set<Integer> ids;
030    private Container container;
031    private int currentID;
032
033    ModLoaderGuiHelper(BaseModProxy mod)
034    {
035        this.mod = mod;
036        this.ids = Sets.newHashSet();
037    }
038
039    @Override
040    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
041    {
042        return container;
043    }
044
045    @Override
046    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
047    {
048        return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
049    }
050
051    public void injectContainerAndID(Container container, int ID)
052    {
053        this.container = container;
054        this.currentID = ID;
055    }
056
057    public Object getMod()
058    {
059        return mod;
060    }
061
062    public void associateId(int additionalID)
063    {
064        this.ids.add(additionalID);
065    }
066
067}