/** * Copyright (c) 23/feb/2015 Davide Cossu & Matthew Albrecht. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, see <http://www.gnu.org/licenses>. */ package com.minestellar.core.handler; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import com.minestellar.core.blocks.container.ComputerContainer; import com.minestellar.core.blocks.tile.TileEntityComputer; import com.minestellar.core.gui.ComputerGui; import com.minestellar.core.gui.GUIs; public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == GUIs.COMPUTER_GUI) { TileEntityComputer te = (TileEntityComputer) world.getTileEntity(x, y, z); return new ComputerContainer(te); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == GUIs.COMPUTER_GUI) { PlanetKnowledgeHandler props = (PlanetKnowledgeHandler) player.getExtendedProperties(PlanetKnowledgeHandler.PLANET_KNOWLEDGE); return new ComputerGui(props.getAcknowledgedPlanets()); } return null; } }