Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.jolteffect.justsolars.handler;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.common.network.IGuiHandler;
- import com.jolteffect.justsolars.block.SolarPanel.ContainerSolarPanel;
- import com.jolteffect.justsolars.block.SolarPanel.GuiSolarPanel;
- import com.jolteffect.justsolars.block.SolarPanel.TileEntitySolarPanel;
- import com.jolteffect.justsolars.block.powercube.ContainerPowerCube;
- import com.jolteffect.justsolars.block.powercube.GuiPowerCube;
- import com.jolteffect.justsolars.block.powercube.TileEntityPowerCube;
- public class GuiHandler implements IGuiHandler{
- public static final int POWERCUBE = 1;
- public static final int SOLARPANEL = 2;
- //SERVER SIDE
- @Override
- public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- BlockPos pos = new BlockPos(x, y, z);
- TileEntity te = world.getTileEntity(pos);
- if (te != null)
- {
- if (ID == POWERCUBE)
- {
- return new ContainerPowerCube(player.inventory, (TileEntityPowerCube)te);
- }
- if (ID == SOLARPANEL)
- {
- return new ContainerSolarPanel(player.inventory, (TileEntitySolarPanel)te);
- }
- }
- return null;
- }
- //CLIENT SIDE
- @Override
- public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- BlockPos pos = new BlockPos(x, y, z);
- TileEntity te = world.getTileEntity(pos);
- if (te != null)
- {
- if (ID == POWERCUBE)
- {
- TileEntityPowerCube containerTileEntity = (TileEntityPowerCube) te;
- return new GuiPowerCube(containerTileEntity, new ContainerPowerCube(player.inventory, containerTileEntity));
- }
- if (ID == SOLARPANEL)
- {
- TileEntitySolarPanel containerTileEntity = (TileEntitySolarPanel) te;
- return new GuiSolarPanel(containerTileEntity, new ContainerSolarPanel(player.inventory, containerTileEntity));
- }
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement