fucking fail
parent
53fcd65737
commit
e78aa753db
|
@ -9,6 +9,7 @@ import com.mojang.minecraft.renderer.Frustum;
|
|||
import com.mojang.minecraft.phys.AABB;
|
||||
import com.mojang.minecraft.level.tile.Tile;
|
||||
import com.mojang.minecraft.gui.PauseScreen;
|
||||
import com.mojang.minecraft.gui.MenuScreen;
|
||||
import com.mojang.minecraft.level.Chunk;
|
||||
import java.awt.Component;
|
||||
import javax.swing.JOptionPane;
|
||||
|
@ -160,6 +161,41 @@ public class Minecraft implements Runnable, LevelLoaderListener
|
|||
final IntBuffer imgData = BufferUtils.createIntBuffer(256);
|
||||
imgData.clear().limit(256);
|
||||
GL11.glViewport(0, 0, this.width, this.height);
|
||||
this.setScreen(new MenuScreen());
|
||||
/* this.level = new Level();
|
||||
boolean success = false;
|
||||
try {
|
||||
success = this.levelIo.load(this.level, new FileInputStream(new File("level.dat")));
|
||||
if (!success) {
|
||||
success = this.levelIo.loadLegacy(this.level, new FileInputStream(new File("level.dat")));
|
||||
}
|
||||
}
|
||||
catch (Exception e3) {
|
||||
success = false;
|
||||
}
|
||||
if (!success) {
|
||||
this.levelGen.generateLevel(this.level, this.user.name, 256, 256, 64);
|
||||
}
|
||||
this.levelRenderer = new LevelRenderer(this.level, this.textures);
|
||||
this.player = new Player(this.level);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.textures);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
final Zombie zombie = new Zombie(this.level, this.textures, 128.0f, 0.0f, 128.0f);
|
||||
zombie.resetPos();
|
||||
this.entities.add(zombie);
|
||||
}
|
||||
if (this.appletMode) {
|
||||
try {
|
||||
this.emptyCursor = new Cursor(16, 16, 0, 0, 1, imgData, (IntBuffer)null);
|
||||
}
|
||||
catch (LWJGLException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
this.checkGlError("Post startup");*/
|
||||
}
|
||||
|
||||
public void startGame() {
|
||||
this.level = new Level();
|
||||
boolean success = false;
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package com.mojang.minecraft.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MenuScreen extends Screen
|
||||
{
|
||||
private List<Button> buttons;
|
||||
|
||||
public MenuScreen() {
|
||||
this.buttons = new ArrayList<Button>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.buttons.add(new Button(0, this.width / 2 - 100, this.height / 4 + 0, 200, 20, "Generate new level"));
|
||||
this.buttons.add(new Button(1, this.width / 2 - 100, this.height / 4 + 32, 200, 20, "Save level.."));
|
||||
this.buttons.add(new Button(2, this.width / 2 - 100, this.height / 4 + 64, 200, 20, "Load level.."));
|
||||
this.buttons.add(new Button(3, this.width / 2 - 100, this.height / 4 + 96, 200, 20, "Back to game"));
|
||||
this.buttons.add(new Button(4, this.width / 2 - 100, this.height / 4 + 128, 200, 20, "Exit"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyPressed(final char eventCharacter, final int eventKey) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int x, final int y, final int buttonNum) {
|
||||
if (buttonNum == 0) {
|
||||
for (int i = 0; i < this.buttons.size(); ++i) {
|
||||
final Button button = this.buttons.get(i);
|
||||
if (x >= button.x && y >= button.y && x < button.x + button.w && y < button.y + button.h) {
|
||||
this.buttonClicked(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonClicked(final Button button) {
|
||||
if (button.id == 0) {
|
||||
this.minecraft.generateNewLevel();
|
||||
this.minecraft.setScreen(null);
|
||||
this.minecraft.grabMouse();
|
||||
}
|
||||
if (button.id == 3) {
|
||||
this.minecraft.setScreen(null);
|
||||
this.minecraft.grabMouse();
|
||||
}
|
||||
if (button.id == 4) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(final int xm, final int ym) {
|
||||
this.fillGradient(0, 0, this.width, this.height, 537199872, -1607454624);
|
||||
for (int i = 0; i < this.buttons.size(); ++i) {
|
||||
final Button button = this.buttons.get(i);
|
||||
this.fill(button.x - 1, button.y - 1, button.x + button.w + 1, button.y + button.h + 1, -16777216);
|
||||
if (xm >= button.x && ym >= button.y && xm < button.x + button.w && ym < button.y + button.h) {
|
||||
this.fill(button.x - 1, button.y - 1, button.x + button.w + 1, button.y + button.h + 1, -6250336);
|
||||
this.fill(button.x, button.y, button.x + button.w, button.y + button.h, -8355680);
|
||||
this.drawCenteredString(button.msg, button.x + button.w / 2, button.y + (button.h - 8) / 2, 16777120);
|
||||
}
|
||||
else {
|
||||
this.fill(button.x, button.y, button.x + button.w, button.y + button.h, -9408400);
|
||||
this.drawCenteredString(button.msg, button.x + button.w / 2, button.y + (button.h - 8) / 2, 14737632);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,11 +17,11 @@ public class PauseScreen extends Screen
|
|||
|
||||
@Override
|
||||
public void init() {
|
||||
this.buttons.add(new Button(0, this.width / 2 - 100, this.height / 3 + 0, 200, 20, "Generate new level"));
|
||||
this.buttons.add(new Button(1, this.width / 2 - 100, this.height / 3 + 32, 200, 20, "Save level.."));
|
||||
this.buttons.add(new Button(2, this.width / 2 - 100, this.height / 3 + 64, 200, 20, "Load level.."));
|
||||
this.buttons.add(new Button(3, this.width / 2 - 100, this.height / 3 + 96, 200, 20, "Back to game"));
|
||||
this.buttons.add(new Button(4, this.width / 2 - 100, this.height / 3 + 128, 200, 20, "Exit"));
|
||||
this.buttons.add(new Button(0, this.width / 2 - 100, this.height / 4 + 0, 200, 20, "Generate new level"));
|
||||
this.buttons.add(new Button(1, this.width / 2 - 100, this.height / 4 + 32, 200, 20, "Save level.."));
|
||||
this.buttons.add(new Button(2, this.width / 2 - 100, this.height / 4 + 64, 200, 20, "Load level.."));
|
||||
this.buttons.add(new Button(3, this.width / 2 - 100, this.height / 4 + 96, 200, 20, "Back to game"));
|
||||
this.buttons.add(new Button(4, this.width / 2 - 100, this.height / 4 + 128, 200, 20, "Exit"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue