Fixed some imports for Mechanical Debug

This commit is contained in:
Calclavia 2014-09-09 17:18:44 +08:00
parent 5d92c562b5
commit fb06356ca2
7 changed files with 376 additions and 380 deletions

View file

@ -1,28 +1,31 @@
package resonantinduction.core.debug;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.LayoutManager;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.core.transform.vector.IVectorWorld;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* @author Darkguardsman
*/
/** @author Darkguardsman */
@SuppressWarnings("serial")
public class FrameDebug extends Frame implements IVectorWorld
{
protected long tick = 0;
/**
* Linked tile
*/
/** Linked tile */
TileEntity tile = null;
boolean debugNode = false;
protected long tick = 0;
public FrameDebug(TileEntity tile)
{
@ -35,9 +38,7 @@ public class FrameDebug extends Frame implements IVectorWorld
buildGUI();
}
/**
* Called to build the base of the GUI
*/
/** Called to build the base of the GUI */
protected void buildGUI()
{
Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
@ -69,9 +70,7 @@ public class FrameDebug extends Frame implements IVectorWorld
});
}
/**
* Top are of the Frame
*/
/** Top are of the Frame */
public void buildTop(UpdatePanel panel)
{
panel.setLayout(new GridLayout(1, 2, 0, 0));
@ -86,9 +85,7 @@ public class FrameDebug extends Frame implements IVectorWorld
panel.add(tickLabel);
}
/**
* Bottom are of the Frame
*/
/** Bottom are of the Frame */
public void buildBottom(UpdatePanel panel)
{
panel.setLayout(new GridLayout(1, 4, 0, 0));
@ -133,9 +130,7 @@ public class FrameDebug extends Frame implements IVectorWorld
panel.add(zLabel);
}
/**
* Left are of the Frame
*/
/** Left are of the Frame */
public void buildCenter(UpdatePanel panel)
{
panel.setLayout(new GridLayout(1, 4, 0, 0));
@ -163,7 +158,7 @@ public class FrameDebug extends Frame implements IVectorWorld
@Override
public String buildLabel()
{
return super.buildLabel() + (tile != null && tile.getBlockType() != null ? tile.getBlockType() : "-");
return super.buildLabel() + (tile != null && tile.getBlockType() != null ? tile.getBlockType().blockID : "-");
}
};
panel.add(meta_label);
@ -173,16 +168,14 @@ public class FrameDebug extends Frame implements IVectorWorld
@Override
public String buildLabel()
{
return super.buildLabel() + (tile != null && tile.getBlockType() != null ? tile.getBlockType() : "-");
return super.buildLabel() + (tile != null && tile.getBlockType() != null ? tile.getBlockType().blockID : "-");
}
};
panel.add(id_label);
}
/**
* Called each tick by the host of this GUI
*/
/** Called each tick by the host of this GUI */
public void update()
{
tick++;
@ -200,9 +193,7 @@ public class FrameDebug extends Frame implements IVectorWorld
}
}
/**
* Shows the frame
*/
/** Shows the frame */
public void showDebugFrame()
{
setTitle("Resonant Engine Debug Window");
@ -210,9 +201,7 @@ public class FrameDebug extends Frame implements IVectorWorld
setVisible(true);
}
/**
* Hides the frame and tells it to die off
*/
/** Hides the frame and tells it to die off */
public void closeDebugFrame()
{
dispose();

View file

@ -1,28 +1,22 @@
package resonantinduction.core.debug;
import codechicken.multipart.TMultiPart;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import codechicken.multipart.TMultiPart;
import universalelectricity.api.core.grid.INode;
import universalelectricity.api.core.grid.INodeProvider;
/**
* @author Darkguardsman
*/
/** @author Darkguardsman */
@SuppressWarnings("serial")
public class FrameNodeDebug extends FrameDebug
{
protected INodeProvider nodeProvider = null;
/**
* Linked node
*/
/** Linked node */
protected INode node = null;
protected Class<? extends INode> nodeClazz = null;
/**
* Are we debugging a node
*/
/** Are we debugging a node */
public FrameNodeDebug(TileEntity tile, Class<? extends INode> nodeClazz)
{
@ -43,9 +37,7 @@ public class FrameNodeDebug extends FrameDebug
this.node = node;
}
/**
* Gets the node used for debug
*/
/** Gets the node used for debug */
public INode getNode()
{
if (tile instanceof INodeProvider && nodeClazz != null)

View file

@ -0,0 +1,9 @@
package resonantinduction.core.debug;
/** Used to pass info to the debug GUI
*
* @author Darkguardsman */
public interface IDebug
{
}

View file

@ -1,10 +1,8 @@
package resonantinduction.core.debug;
/**
* Used by objects can update each tick
/** Used by objects can update each tick
*
* @author Darkguardsman
*/
* @author Darkguardsman */
public interface IUpdate
{
public void update();

View file

@ -1,11 +1,12 @@
package resonantinduction.core.debug;
import javax.swing.*;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Panel;
/**
* @author Darkguardsman
*/
import javax.swing.JPanel;
/** @author Darkguardsman */
@SuppressWarnings("serial")
public class UpdatePanel extends JPanel implements IUpdate
{

View file

@ -1,12 +1,10 @@
package resonantinduction.core.debug;
import java.awt.*;
import java.awt.Label;
/**
* Simple label with an update method
/** Simple label with an update method
*
* @author Darkguardsman
*/
* @author Darkguardsman */
@SuppressWarnings("serial")
public class UpdatedLabel extends Label implements IUpdate
{
@ -24,9 +22,7 @@ public class UpdatedLabel extends Label implements IUpdate
this.setText(buildLabel());
}
/**
* Recreates then returns the label's string value
*/
/** Recreates then returns the label's string value */
public String buildLabel()
{
return start_string;

View file

@ -13,18 +13,21 @@ import universalelectricity.core.transform.vector.{Vector3, VectorWorld}
import scala.util.control.Breaks._
abstract class PartConductor extends TMultiPart with TraitPart {
override def doesTick: Boolean = {
abstract class PartConductor extends TMultiPart with TraitPart
{
override def doesTick: Boolean =
{
return false
}
def getConnections: Array[AnyRef] = {
def getConnections: Array[AnyRef] =
{
return this.connections
}
/** EXTERNAL USE Can this wire be connected by another block? */
def canConnect(direction: ForgeDirection, source: AnyRef): Boolean = {
def canConnect(direction: ForgeDirection, source: AnyRef): Boolean =
{
val connectPos: Vector3 = new Vector3(tile).add(direction)
val connectTile: TileEntity = connectPos.getTileEntity(world)
return Compatibility.isHandler(connectTile)
@ -33,9 +36,10 @@ abstract class PartConductor extends TMultiPart with TraitPart {
def canConnectTo(obj: AnyRef): Boolean
/** Recalculates all the network connections */
protected def recalculateConnections {
protected def recalculateConnections
{
this.connections = new Array[AnyRef](6)
for(i <- 0 until 6)
for (i <- 0 until 6)
{
val side: ForgeDirection = ForgeDirection.getOrientation(i)
val tileEntity: TileEntity = new VectorWorld(world, x, y, z).getTileEntity
@ -47,7 +51,8 @@ abstract class PartConductor extends TMultiPart with TraitPart {
}
/** IC2 Functions */
override def onWorldJoin {
override def onWorldJoin
{
if (!world.isRemote && tile.isInstanceOf[IEnergyTile])
{
var foundAnotherPart: Boolean = false
@ -73,18 +78,21 @@ abstract class PartConductor extends TMultiPart with TraitPart {
if (!world.isRemote)
{
//this.getNetwork.split(this)
if (tile.isInstanceOf[IEnergyTile]) {
if (tile.isInstanceOf[IEnergyTile])
{
var foundAnotherPart: Boolean = false
for(i <- 0 until tile.partList.size)
for (i <- 0 until tile.partList.size)
{
val part: TMultiPart = tile.partMap(i)
if (part.isInstanceOf[IEnergyTile] && part != this) {
if (part.isInstanceOf[IEnergyTile] && part != this)
{
foundAnotherPart = true
break //todo: break is not supported
}
}
if (!foundAnotherPart) {
if (!foundAnotherPart)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(tile.asInstanceOf[IEnergyTile]))
}
}
@ -92,15 +100,18 @@ abstract class PartConductor extends TMultiPart with TraitPart {
super.preRemove
}
override def save(nbt: NBTTagCompound) {
override def save(nbt: NBTTagCompound)
{
super.save(nbt)
}
override def load(nbt: NBTTagCompound) {
override def load(nbt: NBTTagCompound)
{
super.load(nbt)
}
override def toString: String = {
override def toString: String =
{
return "[PartConductor]" + x + "x " + y + "y " + z + "z "
}