diff --git a/src/main/scala/resonantinduction/core/debug/FrameDebug.java b/src/main/scala/resonantinduction/core/debug/FrameDebug.java index 083e4774d..1b5613e55 100644 --- a/src/main/scala/resonantinduction/core/debug/FrameDebug.java +++ b/src/main/scala/resonantinduction/core/debug/FrameDebug.java @@ -3,19 +3,24 @@ package resonantinduction.core.debug; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; import java.awt.Panel; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import resonantinduction.mechanical.energy.grid.MechanicalNodeFrame; +import universalelectricity.api.vector.IVectorWorld; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; /** @author Darkguardsman */ @SuppressWarnings("serial") -public class FrameDebug extends Frame +public class FrameDebug extends Frame implements IVectorWorld { /** Linked tile */ TileEntity tile = null; - + boolean debugNode = false; protected long tick = 0; @@ -25,7 +30,6 @@ public class FrameDebug extends Frame this.tile = tile; } - protected FrameDebug() { buildGUI(); @@ -66,24 +70,111 @@ public class FrameDebug extends Frame /** Top are of the Frame */ public void buildTop(Panel panel) { - + panel.setLayout(new GridLayout(1, 2, 0, 0)); + UpdatedLabel tickLabel = new UpdatedLabel("Tile: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + tile; + } + }; + panel.add(tickLabel); } /** Bottom are of the Frame */ public void buildBottom(Panel panel) { + panel.setLayout(new GridLayout(1, 4, 0, 0)); + UpdatedLabel tickLabel = new UpdatedLabel("Tick: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + tick; + } + }; + panel.add(tickLabel); + UpdatedLabel xLabel = new UpdatedLabel("X: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + x(); + } + }; + panel.add(xLabel); + + UpdatedLabel yLabel = new UpdatedLabel("Y: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + y(); + } + }; + panel.add(yLabel); + + UpdatedLabel zLabel = new UpdatedLabel("Z: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + z(); + } + }; + panel.add(zLabel); } /** Left are of the Frame */ - public void buildLeft(Panel panel) + public void buildRight(Panel panel) { - + panel.setLayout(new GridLayout(1, 2, 0, 0)); + UpdatedLabel tickLabel = new UpdatedLabel("Valid: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + (tile != null ? tile.isInvalid() : "null"); + } + }; + panel.add(tickLabel); } /** Right are of the Frame */ - public void buildRight(Panel panel) + public void buildLeft(Panel panel) { + panel.setLayout(new GridLayout(4, 1, 0, 0)); + UpdatedLabel block_label = new UpdatedLabel("BLOCK: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + (tile != null ? tile.getBlockType() : "null"); + } + }; + panel.add(block_label); + + UpdatedLabel meta_label = new UpdatedLabel("META: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + (tile != null && tile.getBlockType() != null ? tile.getBlockType().blockID : "-"); + } + }; + panel.add(meta_label); + + UpdatedLabel id_label = new UpdatedLabel("ID: ") + { + @Override + public String buildLabel() + { + return super.buildLabel() + (tile != null && tile.getBlockType() != null ? tile.getBlockType().blockID : "-"); + } + }; + panel.add(id_label); } @@ -103,7 +194,7 @@ public class FrameDebug extends Frame ((IUpdate) component).update(); } } - } + } /** Shows the frame */ public void showDebugFrame() @@ -118,4 +209,28 @@ public class FrameDebug extends Frame { dispose(); } + + @Override + public double z() + { + return tile != null ? tile.zCoord : 0; + } + + @Override + public double x() + { + return tile != null ? tile.xCoord : 0; + } + + @Override + public double y() + { + return tile != null ? tile.yCoord : 0; + } + + @Override + public World world() + { + return tile != null ? tile.getWorldObj() : null; + } } diff --git a/src/main/scala/resonantinduction/core/debug/FrameNodeDebug.java b/src/main/scala/resonantinduction/core/debug/FrameNodeDebug.java index b9c65c658..5c2880c48 100644 --- a/src/main/scala/resonantinduction/core/debug/FrameNodeDebug.java +++ b/src/main/scala/resonantinduction/core/debug/FrameNodeDebug.java @@ -1,6 +1,8 @@ package resonantinduction.core.debug; +import codechicken.multipart.TMultiPart; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import resonant.api.grid.INode; import resonant.api.grid.INodeProvider; @@ -48,4 +50,60 @@ public class FrameNodeDebug extends FrameDebug } return node; } + + @Override + public double z() + { + if (nodeProvider instanceof TileEntity) + { + return ((TileEntity) nodeProvider).zCoord; + } + else if (nodeProvider instanceof TMultiPart) + { + return ((TMultiPart) nodeProvider).z(); + } + return super.z(); + } + + @Override + public double x() + { + if (nodeProvider instanceof TileEntity) + { + return ((TileEntity) nodeProvider).xCoord; + } + else if (nodeProvider instanceof TMultiPart) + { + return ((TMultiPart) nodeProvider).x(); + } + return super.x(); + } + + @Override + public double y() + { + if (nodeProvider instanceof TileEntity) + { + return ((TileEntity) nodeProvider).yCoord; + } + else if (nodeProvider instanceof TMultiPart) + { + return ((TMultiPart) nodeProvider).y(); + } + return super.y(); + } + + @Override + public World world() + { + if (nodeProvider instanceof TileEntity) + { + return ((TileEntity) nodeProvider).getWorldObj(); + } + else if (nodeProvider instanceof TMultiPart) + { + return ((TMultiPart) nodeProvider).world(); + } + return super.world(); + } }