Added a GUI to the master routing node to get a feel for what the routing system will be like. It's... WIP.

This commit is contained in:
WayofTime 2016-01-17 21:00:48 -05:00
parent 34d24c85dc
commit 01fcec9a8c
7 changed files with 97 additions and 1 deletions

View file

@ -111,6 +111,7 @@ public class Constants
public static final int TELEPOSER_GUI = 0;
public static final int SOUL_FORGE_GUI = 1;
public static final int ROUTING_NODE_GUI = 2;
public static final int MASTER_ROUTING_NODE_GUI = 3;
}
public static class Compat

View file

@ -2,7 +2,11 @@ package WayofTime.bloodmagic.block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
@ -32,4 +36,15 @@ public class BlockMasterRoutingNode extends BlockContainer
{
return new TileMasterRoutingNode();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (world.getTileEntity(pos) instanceof TileMasterRoutingNode)
{
player.openGui(BloodMagic.instance, Constants.Gui.MASTER_ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
}

View file

@ -9,9 +9,11 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.TileSoulForge;
import WayofTime.bloodmagic.tile.TileTeleposer;
import WayofTime.bloodmagic.tile.container.ContainerItemRoutingNode;
import WayofTime.bloodmagic.tile.container.ContainerMasterRoutingNode;
import WayofTime.bloodmagic.tile.container.ContainerSoulForge;
import WayofTime.bloodmagic.tile.container.ContainerTeleposer;
import WayofTime.bloodmagic.tile.routing.TileFilteredRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
public class GuiHandler implements IGuiHandler
{
@ -28,6 +30,8 @@ public class GuiHandler implements IGuiHandler
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));
}
return null;
@ -48,6 +52,8 @@ public class GuiHandler implements IGuiHandler
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));
}
}

View file

@ -0,0 +1,44 @@
package WayofTime.bloodmagic.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.container.ContainerMasterRoutingNode;
@SideOnly(Side.CLIENT)
public class GuiMasterRoutingNode extends GuiContainer
{
private TileEntity inventory;
public GuiMasterRoutingNode(InventoryPlayer playerInventory, IInventory tileRoutingNode)
{
super(new ContainerMasterRoutingNode(playerInventory, tileRoutingNode));
this.xSize = 216;
this.ySize = 216;
inventory = (TileEntity) tileRoutingNode;
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
// this.fontRendererObj.drawString(TextHelper.localize("tile.BloodMagic.soulForge.name"), 8, 5, 4210752);
// this.fontRendererObj.drawString(TextHelper.localize("container.inventory"), 8, 111, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
ResourceLocation soulForgeGuiTextures = new ResourceLocation(Constants.Mod.MODID + ":textures/gui/masterRoutingNode.png");
this.mc.getTextureManager().bindTexture(soulForgeGuiTextures);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -0,0 +1,23 @@
package WayofTime.bloodmagic.tile.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
public class ContainerMasterRoutingNode extends Container
{
private final IInventory tileMasterRoutingNode;
public ContainerMasterRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileMasterRoutingNode)
{
this.tileMasterRoutingNode = tileMasterRoutingNode;
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileMasterRoutingNode.isUseableByPlayer(playerIn);
}
}

View file

@ -20,9 +20,16 @@ import WayofTime.bloodmagic.routing.IMasterRoutingNode;
import WayofTime.bloodmagic.routing.IOutputItemRoutingNode;
import WayofTime.bloodmagic.routing.IRoutingNode;
import WayofTime.bloodmagic.routing.NodeHelper;
import WayofTime.bloodmagic.tile.TileInventory;
public class TileMasterRoutingNode extends TileEntity implements IMasterRoutingNode, ITickable
public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable
{
public TileMasterRoutingNode()
{
super(0, "masterRoutingNode");
// TODO Auto-generated constructor stub
}
// A list of connections
private HashMap<BlockPos, List<BlockPos>> connectionMap = new HashMap<BlockPos, List<BlockPos>>();
private List<BlockPos> generalNodeList = new LinkedList<BlockPos>();

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB