Add debug text + new diamond textures
parent
9749990052
commit
ef3cc78a02
|
@ -82,6 +82,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
private String title;
|
||||
|
||||
public Minecraft(final Canvas parent, final int width, final int height, final boolean fullscreen) {
|
||||
System.out.println("Gamerappa's Minecraft has been launched.");
|
||||
this.fullscreen = false;
|
||||
this.fogColor0 = BufferUtils.createFloatBuffer(4);
|
||||
this.fogColor1 = BufferUtils.createFloatBuffer(4);
|
||||
|
@ -114,6 +115,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
}
|
||||
|
||||
public void init() throws LWJGLException, IOException {
|
||||
System.out.println("Initializing Gamerappa's Minecraft Version " + VERSION_STRING);
|
||||
final int col1 = 920330;
|
||||
final float fr = 0.5f;
|
||||
final float fg = 0.8f;
|
||||
|
@ -146,6 +148,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
Keyboard.create();
|
||||
Mouse.create();
|
||||
this.checkGlError("Pre startup");
|
||||
System.out.println("Pre-startup");
|
||||
GL11.glEnable(3553);
|
||||
GL11.glShadeModel(7425);
|
||||
GL11.glClearColor(fr, fg, fb, 0.0f);
|
||||
|
@ -159,24 +162,27 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(5888);
|
||||
this.checkGlError("Startup");
|
||||
System.out.println("Startup");
|
||||
this.font = new Font("/default.gif", this.textures);
|
||||
final IntBuffer imgData = BufferUtils.createIntBuffer(256);
|
||||
imgData.clear().limit(256);
|
||||
GL11.glViewport(0, 0, this.width, this.height);
|
||||
//this.setScreen(new MenuScreen());
|
||||
Minecraft.level = new Level();
|
||||
System.out.println("Initalizing level.");
|
||||
boolean success = false;
|
||||
try {
|
||||
success = Minecraft.levelIo.load(Minecraft.level,
|
||||
new FileInputStream(new File("level.dat")));
|
||||
if (!success) {
|
||||
success = Minecraft.levelIo.loadLegacy(Minecraft.level,
|
||||
new FileInputStream(new File("level.dat")));
|
||||
new FileInputStream(new File("level.dat")));
|
||||
}
|
||||
} catch (Exception e3) {
|
||||
success = false;
|
||||
}
|
||||
if (!success) {
|
||||
System.out.println("Save file doesn't exist.");
|
||||
this.levelGen.generateLevel(Minecraft.level, User.name, 256,
|
||||
256, 64, nameLevel);
|
||||
}
|
||||
|
@ -198,6 +204,7 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
}
|
||||
}
|
||||
this.checkGlError("Post startup");
|
||||
System.out.println("Post-startup");
|
||||
}
|
||||
|
||||
public void setScreen(final Screen screen) {
|
||||
|
@ -519,12 +526,12 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
this.setupFog(1);
|
||||
this.levelRenderer.clouds(a);
|
||||
this.levelRenderer.render(this.player, 1);
|
||||
// for (int i = 0; i < this.entities.size(); ++i) {
|
||||
// final Entity zombie = this.entities.get(i);
|
||||
// if (!zombie.isLit() && frustum.isVisible(zombie.bb)) {
|
||||
// this.entities.get(i).render(a);
|
||||
// }
|
||||
// }
|
||||
// for (int i = 0; i < this.entities.size(); ++i) {
|
||||
// final Entity zombie = this.entities.get(i);
|
||||
// if (!zombie.isLit() && frustum.isVisible(zombie.bb)) {
|
||||
// this.entities.get(i).render(a);
|
||||
// }
|
||||
// }
|
||||
this.particleEngine.render(this.player, a, 1);
|
||||
this.levelRenderer.renderSurroundingGround();
|
||||
if (this.hitResult != null) {
|
||||
|
@ -645,7 +652,6 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
// For some random reason, the text color uses BGR and not RGB.
|
||||
// We should add a text color system later, in case we actually
|
||||
// implement multiplayer. -Chaziz 5/31/2021
|
||||
//this.font.drawShadow("Gamerappa's Minecraft", 2, 2, 16777215);
|
||||
this.font.drawShadow(VERSION_STRING + " - " + this.fpsString, 2, 2, 16777215);
|
||||
this.font.drawShadow(this.paintTextureString, 2, 12, 13948116);
|
||||
this.font.drawShadow("User: " + User.name, 2, 212, 16764165); //yellow text
|
||||
|
@ -762,9 +768,10 @@ public class Minecraft implements Runnable, LevelLoaderListener {
|
|||
}
|
||||
|
||||
public class inputLevelName {
|
||||
JFrame f;
|
||||
JFrame f;
|
||||
public inputLevelName(){
|
||||
f=new JFrame();
|
||||
f=new JFrame();
|
||||
System.out.println("A dialog asking for the level name should have opened.");
|
||||
nameLevel=JOptionPane.showInputDialog(f,"Enter name for level.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public class Font
|
|||
img = ImageIO.read(Textures.class.getResourceAsStream(name));
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Font couldn't load");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
final int w = img.getWidth();
|
||||
|
|
|
@ -26,7 +26,6 @@ public class PauseScreen extends Screen
|
|||
@Override
|
||||
public void init() {
|
||||
attemptSaveLevel();
|
||||
System.out.println("Level saved? [PAUSE MENU]");
|
||||
this.buttons.add(new Button(0, this.width / 2 - 100, this.height / 4 + 32, 200, 20, "Generate new level"));
|
||||
//this.buttons.add(new Button(1, this.width / 2 - 100, this.height / 4 + 96, 200, 20, "Save level.."));
|
||||
//this.buttons.add(new Button(2, this.width / 2 - 100, this.height / 4 + 128, 200, 20, "Load level.."));
|
||||
|
|
|
@ -26,6 +26,7 @@ public class LevelIO
|
|||
}
|
||||
|
||||
public boolean load(final Level level, final InputStream in) {
|
||||
System.out.println("Save file exists, loading.");
|
||||
this.levelLoaderListener.beginLevelLoading("Loading level");
|
||||
this.levelLoaderListener.levelLoadUpdate("Reading..");
|
||||
try {
|
||||
|
@ -53,8 +54,7 @@ public class LevelIO
|
|||
level.name = name;
|
||||
level.creator = creator;
|
||||
level.createTime = createTime;
|
||||
System.out.println("Level Loaded");
|
||||
System.out.println(level.name);
|
||||
System.out.println(level.name + " by " + level.creator + ". ");
|
||||
Minecraft.nameLevel = level.name;
|
||||
return true;
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ public class LevelIO
|
|||
}
|
||||
|
||||
public boolean loadLegacy(final Level level, final InputStream in) {
|
||||
this.levelLoaderListener.beginLevelLoading("Loading level");
|
||||
System.out.println("Save file does exist, but it's in a legacy pre-classic format, loading with alternative function.");
|
||||
this.levelLoaderListener.beginLevelLoading("Loading legacy level");
|
||||
this.levelLoaderListener.levelLoadUpdate("Reading..");
|
||||
try {
|
||||
final DataInputStream dis = new DataInputStream(new GZIPInputStream(in));
|
||||
|
@ -105,6 +106,7 @@ public class LevelIO
|
|||
dos.writeShort(level.depth);
|
||||
dos.write(level.blocks);
|
||||
dos.close();
|
||||
System.out.println("Saved.");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -31,6 +31,7 @@ public class LevelGen
|
|||
}
|
||||
|
||||
public boolean generateLevel(final Level level, final String userName, final int width, final int height, final int depth, final String levelName) {
|
||||
System.out.println("Generating new level.");
|
||||
this.levelLoaderListener.beginLevelLoading("Generating level");
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
@ -50,7 +51,7 @@ public class LevelGen
|
|||
level.createTime = System.currentTimeMillis();
|
||||
level.creator = userName;
|
||||
level.name = levelName;
|
||||
System.out.println("Level Generated -" + level.name);
|
||||
System.out.println("Level Generated: " + level.name);
|
||||
Minecraft.nameLevel = level.name;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,10 +55,11 @@ public class Textures
|
|||
pixels.put(newPixels);
|
||||
pixels.position(0).limit(newPixels.length);
|
||||
GLU.gluBuild2DMipmaps(3553, 6408, w, h, 6408, 5121, pixels);
|
||||
System.out.println("Loaded texture " + (resourceName));
|
||||
return id;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException("!!");
|
||||
throw new RuntimeException("Couldn't load texture");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
src/terrain.png
BIN
src/terrain.png
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 21 KiB |
Loading…
Reference in New Issue