Package logisticspipes.network.guis.logic

Source Code of logisticspipes.network.guis.logic.LogicControllerGuiProvider

package logisticspipes.network.guis.logic;

import logisticspipes.logic.LogicController;
import logisticspipes.logic.gui.LogicLayoutGui;
import logisticspipes.logic.interfaces.ILogicControllerTile;
import logisticspipes.network.abstractguis.CoordinatesGuiProvider;
import logisticspipes.network.abstractguis.GuiProvider;
import logisticspipes.utils.gui.DummyContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.tileentity.TileEntity;

public class LogicControllerGuiProvider extends CoordinatesGuiProvider {
 
  public LogicControllerGuiProvider(int id) {
    super(id);
  }

  @Override
  public Object getClientGui(EntityPlayer player) {
    TileEntity pipe = this.getTile(player.getEntityWorld(), TileEntity.class);
    if(pipe instanceof ILogicControllerTile) {
      return new LogicLayoutGui(((ILogicControllerTile)pipe).getLogicController(), player);
    }
    return null;
  }
 
  @Override
  public Container getContainer(EntityPlayer player) {
    TileEntity pipe = this.getTile(player.getEntityWorld(), TileEntity.class);
    if(pipe instanceof ILogicControllerTile) {
      LogicController controller = ((ILogicControllerTile)pipe).getLogicController();
      DummyContainer dummy = new DummyContainer(player.inventory, null);
      dummy.addNormalSlotsForPlayerInventory(50, 190);
      return dummy;
    }
    return null;
  }
 
  @Override
  public GuiProvider template() {
    return new LogicControllerGuiProvider(getId());
  }
}
TOP

Related Classes of logisticspipes.network.guis.logic.LogicControllerGuiProvider

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.