My Minecraft knockoff

Off topicMinecraft related → My Minecraft knockoff

First off, install Processing.

There you go. Now, paste this code in the editor:

PGraphics w, UI;
PVector mov, pos, coord;
float L, R, U, D, rotX, rotY, tempX, tempY, vel;
float d = 850, o, sc = 250;
float a, v, h;
boolean jump;

void setup() {
  fullScreen(P3D);
  rectMode(CENTER);
  noCursor();
  o = -2*sc;
  w = createGraphics(width, height, P3D);
  UI = createGraphics(width, height);
  mov = new PVector();
  pos = new PVector();
  coord = new PVector();
}

void draw() {
  w.beginDraw();
  w.background(124, 170, 255);
  w.translate(width/2, height/2, d);
  tempX += 2*(mouseY-pmouseY);
  tempY += (float)(mouseX-pmouseX);
  rotX = PI-PI/2*tempX/height;
  rotY = -tempY/250;
  w.rotateX(rotX);
  w.rotateZ(rotY);
  w.spotLight(255, 255, 255, 0, 0, 10*sc, 0, 0, -1, PI/2, 1);
  w.ambientLight(127, 127, 127);
  if (keyPressed) {
    vel = (mov.x != 0 && mov.y != 0) ? 20/pow(2, 0.5) : 20;
    pos.add(vel*sin(rotY)*mov.y, vel*cos(rotY)*mov.y);
    pos.add(vel*sin(rotY-PI/2)*mov.x, vel*cos(rotY-PI/2)*mov.x);
  }
  coord.set(floor(-pos.x/sc+0.5), floor(pos.y/sc-0.5)+1);
  if (coord.x > 7 || coord.x < -6 || coord.y > 7 || coord.y < -6) {
    a = -1.5;
    v += a;
    o -= v;
  } else {
    if (jump && o == -2*sc) {
      a = -1.5;
      v = 28;
    }
    v += a;
    o -= v;
    if (o > -2*sc) {
      a = 0;
      vel = 0;
      o = -2*sc;
    }
  }
  w.translate(pos.x, pos.y, o);
  for (int i = -7; i < 8; i++) {
    for (int j = -7; j < 8; j++) {
      placeBlock(i, j, 0);
    }
  }
  placeBlock(-1, 0, 1);
  placeBlock(-1, 0, 2);
  placeBlock(-1, 0, 3);
  placeBlock(1, 0, 1);
  placeBlock(1, 0, 2);
  placeBlock(1, 0, 3);
  placeBlock(0, 0, 3);
  w.endDraw();
  UI.beginDraw();
  UI.clear();
  UI.translate(width/2, height/2);
  UI.line(-10, 0, 10, 0);
  UI.line(0, -10, 0, 10);
  UI.text(coord.x+" "+coord.y, 10, 10);
  UI.endDraw();
  image(w, 0, 0);
  image(UI, 0, 0);
}

void keyPressed() {
  L = (keyCode == LEFT || key == 'a') ? 1 : L;
  R = (keyCode == RIGHT || key == 'd') ? 1 : R;
  U = (keyCode == UP || key == 'w') ? 1 : U;
  D = (keyCode == DOWN || key == 's') ? 1 : D;
  mov.set(R-L, U-D);
  if (keyCode == ENTER || key == ' ') {
    jump = true;
  }
  if (key == 'r') {
    pos.set(0, 0, 0);
  }
}

void keyReleased() {
  L = (keyCode == LEFT || key == 'a') ? 0 : L;
  R = (keyCode == RIGHT || key == 'd') ? 0 : R;
  U = (keyCode == UP || key == 'w') ? 0 : U;
  D = (keyCode == DOWN || key == 's') ? 0 : D;
  mov.set(R-L, U-D);
  if (keyCode == ENTER || key == ' ') {
    jump = false;
  }
}

void placeBlock(float x, float y, float z) {
  w.pushMatrix();
  w.translate(x*sc, y*sc, z*sc);
  w.box(sc);
  w.popMatrix();
}

Arrows or wasd to move, enter or spacebar to jump, and reset with r, in case you do something stupid. Oh and, it opens as fullscreen, and horizontal rotation is limited to your screen width, so… lower the 250 on line 27 to fit in more rotations, albeit at the cost of increased sensitivity, if you prefer.