Added treasure chests.
Added treasure chests.

--- a/net/minecraft/mazemod/Maze.java
+++ b/net/minecraft/mazemod/Maze.java
@@ -27,6 +27,8 @@
 
     public Maze(int halfWidth,int halfHeight)
     {
+	Random r=new Random();
+
 	MazeNode[][] nodes=new MazeNode[halfWidth*2+1][halfHeight*2+1];
 	// Prepare the base
 	for(int dx=0;dx<halfWidth*2+1;dx++)
@@ -47,6 +49,12 @@
 			nodes[dx][dy].setNeighbor(MazeNode.North,nodes[dx][dy+1]);
 		}
 
+	// Set the start base
+	start=nodes[halfWidth][halfHeight];
+	
+	// Make the maze... recursively using depth-first algorithm
+	generate();
+
 	// Pick the exit
 	List<MazeNode> edges=new LinkedList<MazeNode>();
 	for(int dx=0;dx<halfWidth*2+1;dx++)
@@ -54,16 +62,21 @@
 		if(nodes[dx][dy].isEdgeNode())
 		    edges.add(nodes[dx][dy]);
 
-	Random r=new Random();
 	int exitIdx=r.nextInt(edges.size());
 	edges.get(exitIdx).setExit(true);
-	
 
-	// Set the start base
-	start=nodes[halfWidth][halfHeight];
-	
-	// Make the maze... recursively using depth-first algorithm
-	generate();
+	// Find all of the end nodes
+	List<MazeNode> ends=new LinkedList<MazeNode>();
+	for(int dx=0;dx<halfWidth*2+1;dx++)
+	    for(int dy=0;dy<halfHeight*2+1;dy++)
+		if(nodes[dx][dy].isEndNode())
+		    ends.add(nodes[dx][dy]);
+
+	// Pick a treasure box
+	int treasureIdx=r.nextInt(ends.size());
+	MazeNode treasureNode=ends.remove(treasureIdx);
+	treasureNode.setTreasure(true);
+
     }
 
     private void generate()

--- a/net/minecraft/mazemod/MazeNode.java
+++ b/net/minecraft/mazemod/MazeNode.java
@@ -23,10 +23,10 @@
 
 public class MazeNode
 {
-    public static int North=0;
-    public static int East=1;
-    public static int South=2;
-    public static int West=3;
+    public static final int North=0;
+    public static final int East=1;
+    public static final int South=2;
+    public static final int West=3;
 
     private MazeNode[] neighbors=new MazeNode[4];
     private boolean[] connections=new boolean[4];
@@ -35,6 +35,7 @@
     private boolean visited=false;
 
     private boolean exit=false;
+    private boolean treasure=false;
 
     public MazeNode()
     { 
@@ -74,9 +75,24 @@
 	return false;
     }
 
+    public boolean isEndNode()
+    { // An end node is a node with only one connected neighbor and is not an exit
+	if(exit) return false;
+	
+	int numConnections=0;
+	for(int i=0;i<connections.length;i++)
+	    if(connections[i]) numConnections++;
+	return (numConnections==1);
+    }
+
     public void setExit(boolean exit)
     {
 	this.exit=exit;
+    }
+
+    public void setTreasure(boolean treasure)
+    {
+	this.treasure=treasure;
     }
 
     public void generate()
@@ -139,6 +155,41 @@
 
 	// Draw the ground
 	drawGround(world,pos);
+
+	// Draw the treasure
+	if(treasure)
+	    {
+		iVec3D chestPos=pos.plus(new iVec3D(0,1,0));
+		//0x2: Facing north
+		//0x3: Facing south
+		//0x4: Facing west
+		//0x5: Facing east
+		for(int i=0;i<connections.length;i++) // Determine direction
+		    {
+			if(connections[i]==false)
+			    {
+				int direction;
+				switch(i)
+				    {
+				    case North:
+					direction=2;
+					break;
+				    case East:
+					direction=5;
+					break;
+				    case West:
+					direction=4;
+					break;
+				    case South:
+				    default:
+					direction=3;
+					break;
+				    }	
+				world.setBlockAndMetadata(chestPos.x,chestPos.y,chestPos.z,Block.chest.blockID,direction);
+				break;
+			    }
+		    }
+	    }
     }
 
     public void drawGround(World world,iVec3D pos)