Package erogenousbeef.bigreactors.gui

Source Code of erogenousbeef.bigreactors.gui.BigReactorsGUIHandler

package erogenousbeef.bigreactors.gui;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import erogenousbeef.bigreactors.common.multiblock.interfaces.IMultiblockGuiHandler;

public class BigReactorsGUIHandler implements IGuiHandler {

  @Override
  public Object getServerGuiElement(int ID, EntityPlayer player, World world,
      int x, int y, int z) {
   
    TileEntity te = world.getTileEntity(x, y, z);
    if(te == null) {
      return null;
    }
    else if(te instanceof IMultiblockGuiHandler) {
      return ((IMultiblockGuiHandler)te).getContainer(player.inventory);
    }
    else if(te instanceof IBeefGuiEntity) {
      return ((IBeefGuiEntity)te).getContainer(player);
    }
   
    return null;
  }

  @Override
  public Object getClientGuiElement(int ID, EntityPlayer player, World world,
      int x, int y, int z) {
    TileEntity te = world.getTileEntity(x, y, z);
    if(te == null) {
      return null;
    }
   
    if(te instanceof IMultiblockGuiHandler) {
      IMultiblockGuiHandler part = (IMultiblockGuiHandler)te;
      return part.getGuiElement(player.inventory);
    }
    else if(te instanceof IBeefGuiEntity) {
      return ((IBeefGuiEntity)te).getGUI(player);
    }
   
    return null;
  }

}
TOP

Related Classes of erogenousbeef.bigreactors.gui.BigReactorsGUIHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.