2016-01-01 12:08:17 -05:00
|
|
|
package WayofTime.bloodmagic.client.gui;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2016-06-07 18:50:41 -04:00
|
|
|
import WayofTime.bloodmagic.item.inventory.ContainerHolding;
|
|
|
|
import WayofTime.bloodmagic.item.inventory.InventoryHolding;
|
2016-05-02 08:27:38 -04:00
|
|
|
import WayofTime.bloodmagic.tile.TileAlchemyTable;
|
2016-01-07 18:05:23 -05:00
|
|
|
import WayofTime.bloodmagic.tile.TileSoulForge;
|
|
|
|
import WayofTime.bloodmagic.tile.TileTeleposer;
|
2017-08-15 21:30:48 -07:00
|
|
|
import WayofTime.bloodmagic.tile.container.*;
|
2016-01-14 11:06:50 -05:00
|
|
|
import WayofTime.bloodmagic.tile.routing.TileFilteredRoutingNode;
|
2016-01-17 21:00:48 -05:00
|
|
|
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
2017-08-15 21:30:48 -07:00
|
|
|
import net.minecraft.client.multiplayer.WorldClient;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
2016-01-01 12:08:17 -05:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class GuiHandler implements IGuiHandler {
|
2016-01-01 12:08:17 -05:00
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
2016-01-01 12:08:17 -05:00
|
|
|
BlockPos pos = new BlockPos(x, y, z);
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
switch (id) {
|
|
|
|
case Constants.Gui.TELEPOSER_GUI:
|
|
|
|
return new ContainerTeleposer(player.inventory, (TileTeleposer) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.SOUL_FORGE_GUI:
|
|
|
|
return new ContainerSoulForge(player.inventory, (TileSoulForge) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.ROUTING_NODE_GUI:
|
|
|
|
return new ContainerItemRoutingNode(player.inventory, (TileFilteredRoutingNode) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.MASTER_ROUTING_NODE_GUI:
|
|
|
|
return new ContainerMasterRoutingNode(player.inventory, (TileMasterRoutingNode) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.ALCHEMY_TABLE_GUI:
|
|
|
|
return new ContainerAlchemyTable(player.inventory, (TileAlchemyTable) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.SIGIL_HOLDING_GUI:
|
|
|
|
return new ContainerHolding(player, new InventoryHolding(player.getHeldItemMainhand()));
|
2016-01-01 12:08:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
|
|
|
if (world instanceof WorldClient) {
|
2016-01-01 12:08:17 -05:00
|
|
|
BlockPos pos = new BlockPos(x, y, z);
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
switch (id) {
|
|
|
|
case Constants.Gui.TELEPOSER_GUI:
|
|
|
|
return new GuiTeleposer(player.inventory, (TileTeleposer) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.SOUL_FORGE_GUI:
|
|
|
|
return new GuiSoulForge(player.inventory, (TileSoulForge) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.ROUTING_NODE_GUI:
|
|
|
|
return new GuiItemRoutingNode(player.inventory, (TileFilteredRoutingNode) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.MASTER_ROUTING_NODE_GUI:
|
|
|
|
return new GuiMasterRoutingNode(player.inventory, (TileMasterRoutingNode) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.ALCHEMY_TABLE_GUI:
|
|
|
|
return new GuiAlchemyTable(player.inventory, (TileAlchemyTable) world.getTileEntity(pos));
|
|
|
|
case Constants.Gui.SIGIL_HOLDING_GUI:
|
|
|
|
return new GuiHolding(player, new InventoryHolding(player.getHeldItemMainhand()));
|
2016-01-01 12:08:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|