|
|
@ -11,6 +11,7 @@ import java.awt.image.BufferedImage; |
|
|
|
import java.awt.image.WritableRaster; |
|
|
|
import java.awt.image.WritableRaster; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
@ -30,7 +31,7 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene |
|
|
|
|
|
|
|
|
|
|
|
public static boolean WIREFRAME = false; |
|
|
|
public static boolean WIREFRAME = false; |
|
|
|
public static boolean PROFILING = false; |
|
|
|
public static boolean PROFILING = false; |
|
|
|
public static boolean FLYING_MODE = true; |
|
|
|
public static boolean FLYING_MODE = false; |
|
|
|
public static int SCREEN_WIDTH=1280; |
|
|
|
public static int SCREEN_WIDTH=1280; |
|
|
|
public static int SCREEN_HEIGHT=720; |
|
|
|
public static int SCREEN_HEIGHT=720; |
|
|
|
public final static long TIMEPERTICK = 16666667l; |
|
|
|
public final static long TIMEPERTICK = 16666667l; |
|
|
@ -256,22 +257,22 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene |
|
|
|
if (answer.e.getButton()==MouseEvent.BUTTON1) { |
|
|
|
if (answer.e.getButton()==MouseEvent.BUTTON1) { |
|
|
|
switch (answer.t.dir) { |
|
|
|
switch (answer.t.dir) { |
|
|
|
case BlockType.FRONT:{ |
|
|
|
case BlockType.FRONT:{ |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,0,-1)),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,0,-1)),Cube.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case BlockType.BACK:{ |
|
|
|
case BlockType.BACK:{ |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,0,1)),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,0,1)),Cube.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case BlockType.LEFT:{ |
|
|
|
case BlockType.LEFT:{ |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(-1,0,0)),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(-1,0,0)),Cube.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case BlockType.RIGHT:{ |
|
|
|
case BlockType.RIGHT:{ |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(1,0,0)),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(1,0,0)),Cube.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case BlockType.TOP:{ |
|
|
|
case BlockType.TOP:{ |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,1,0)),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,1,0)),Cube.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case BlockType.BOTTOM:{ |
|
|
|
case BlockType.BOTTOM:{ |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,-1,0)),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(Vector.add(answer.t.b.pos,new Vector(0,-1,0)),Cube.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
} |
|
|
|
} |
|
|
|
} else |
|
|
|
} else |
|
|
@ -285,11 +286,17 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void addBlock(Vector pos,BlockType type,FacingDirection facingDir) { |
|
|
|
public static void addBlock(Vector pos,Class<?> meshType,BlockType type,FacingDirection facingDir) { |
|
|
|
Block b = new Block(pos,new Staircase(type),FacingDirection.SOUTH); |
|
|
|
Block b; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
b = new Block(pos,(Mesh)meshType.getConstructor(BlockType.class).newInstance(type),FacingDirection.SOUTH); |
|
|
|
b.setFacingDirection(facingDir); |
|
|
|
b.setFacingDirection(facingDir); |
|
|
|
blockGrid.put(pos.x+"_"+pos.y+"_"+pos.z,b); |
|
|
|
blockGrid.put(pos.x+"_"+pos.y+"_"+pos.z,b); |
|
|
|
b.updateFaces(); |
|
|
|
b.updateFaces(); |
|
|
|
|
|
|
|
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException |
|
|
|
|
|
|
|
| NoSuchMethodException | SecurityException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void removeBlock(Vector pos) { |
|
|
|
public static void removeBlock(Vector pos) { |
|
|
@ -319,7 +326,7 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene |
|
|
|
Random r = new Random(438107); |
|
|
|
Random r = new Random(438107); |
|
|
|
for (int x=0;x<64;x++) { |
|
|
|
for (int x=0;x<64;x++) { |
|
|
|
for (int z=0;z<64;z++) { |
|
|
|
for (int z=0;z<64;z++) { |
|
|
|
addBlock(new Vector(x,0,z),BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
addBlock(new Vector(x,0,z),Staircase.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
//addBlock(new Vector(x,1,z),BlockType.JUNGLE_PLANK,FacingDirection.SOUTH);
|
|
|
|
//addBlock(new Vector(x,1,z),BlockType.JUNGLE_PLANK,FacingDirection.SOUTH);
|
|
|
|
//addBlock(new Vector(x,2,z),BlockType.SPRUCE_PLANK,FacingDirection.SOUTH);
|
|
|
|
//addBlock(new Vector(x,2,z),BlockType.SPRUCE_PLANK,FacingDirection.SOUTH);
|
|
|
|
/*for (int y=1;y<r.nextInt(5);y++) { |
|
|
|
/*for (int y=1;y<r.nextInt(5);y++) { |
|
|
@ -346,10 +353,11 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene |
|
|
|
}*/ |
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
addBlock(new Vector(31,1,31),Staircase.class,BlockType.PLANKS,FacingDirection.NORTH); |
|
|
|
Block b = new Block(new Vector(31,3,31),new Staircase(BlockType.PLANKS),FacingDirection.SOUTH); |
|
|
|
addBlock(new Vector(31,2,32),Staircase.class,BlockType.PLANKS,FacingDirection.EAST); |
|
|
|
b.setFacingDirection(FacingDirection.SOUTH); |
|
|
|
addBlock(new Vector(31,3,33),Staircase.class,BlockType.PLANKS,FacingDirection.WEST); |
|
|
|
blockGrid.put("31.0_3.0_31.0",b); |
|
|
|
addBlock(new Vector(31,4,34),Staircase.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
|
|
|
|
addBlock(new Vector(31,5,35),Staircase.class,BlockType.PLANKS,FacingDirection.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
for (int x=0;x<64;x++) { |
|
|
|
for (int x=0;x<64;x++) { |
|
|
|
for (int y=1;y<5;y++) { |
|
|
|
for (int y=1;y<5;y++) { |
|
|
|