Toyed with debug frame adding location data and setup debug GUI content
This commit is contained in:
parent
b3feb7c104
commit
6af3bb2d50
2 changed files with 181 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue