Added Gui Overlay, and Creative Mode
This commit is contained in:
parent
479ba321fc
commit
9a93969fc7
|
@ -1,5 +1,7 @@
|
||||||
package com.mojang.minecraft;
|
package com.mojang.minecraft;
|
||||||
|
|
||||||
|
import com.mojang.minecraft.gamemode.*;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public final class GameSettings
|
public final class GameSettings
|
||||||
|
@ -24,6 +26,7 @@ public final class GameSettings
|
||||||
public boolean viewBobbing = true;
|
public boolean viewBobbing = true;
|
||||||
public boolean anaglyph = false;
|
public boolean anaglyph = false;
|
||||||
public boolean limitFramerate = false;
|
public boolean limitFramerate = false;
|
||||||
|
public boolean gamemode = false;
|
||||||
public KeyBinding forwardKey = new KeyBinding("Forward", 17);
|
public KeyBinding forwardKey = new KeyBinding("Forward", 17);
|
||||||
public KeyBinding leftKey = new KeyBinding("Left", 30);
|
public KeyBinding leftKey = new KeyBinding("Left", 30);
|
||||||
public KeyBinding backKey = new KeyBinding("Back", 31);
|
public KeyBinding backKey = new KeyBinding("Back", 31);
|
||||||
|
@ -93,6 +96,22 @@ public final class GameSettings
|
||||||
{
|
{
|
||||||
limitFramerate = !limitFramerate;
|
limitFramerate = !limitFramerate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(setting == 8) {
|
||||||
|
gamemode = !gamemode;
|
||||||
|
|
||||||
|
if(gamemode) {
|
||||||
|
GameMode gamemode = new CreativeGameMode(minecraft);
|
||||||
|
gamemode.apply(minecraft.level);
|
||||||
|
gamemode.apply(minecraft.player);
|
||||||
|
minecraft.gamemode = gamemode;
|
||||||
|
} else {
|
||||||
|
GameMode gamemode = new SurvivalGameMode(minecraft);
|
||||||
|
gamemode.apply(minecraft.level);
|
||||||
|
gamemode.apply(minecraft.player);
|
||||||
|
minecraft.gamemode = gamemode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -107,7 +126,8 @@ public final class GameSettings
|
||||||
: (id == 5 ? "View bobbing: " + (viewBobbing ? "ON" : "OFF")
|
: (id == 5 ? "View bobbing: " + (viewBobbing ? "ON" : "OFF")
|
||||||
: (id == 6 ? "3d anaglyph: " + (anaglyph ? "ON" : "OFF")
|
: (id == 6 ? "3d anaglyph: " + (anaglyph ? "ON" : "OFF")
|
||||||
: (id == 7 ? "Limit framerate: " + (limitFramerate ? "ON" : "OFF")
|
: (id == 7 ? "Limit framerate: " + (limitFramerate ? "ON" : "OFF")
|
||||||
: "")))))));
|
: (id == 8 ? "Game Mode: " + (gamemode ? "Creative" : "Survival")
|
||||||
|
: ""))))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void load()
|
private void load()
|
||||||
|
|
|
@ -982,7 +982,9 @@ public final class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tick() {
|
private void tick() {
|
||||||
this.gamemode.spawnMob();
|
if(!settings.gamemode) {
|
||||||
|
this.gamemode.spawnMob();
|
||||||
|
}
|
||||||
HUDScreen var17 = this.hud;
|
HUDScreen var17 = this.hud;
|
||||||
++this.hud.ticks;
|
++this.hud.ticks;
|
||||||
|
|
||||||
|
|
|
@ -31,30 +31,34 @@ public class Screen {
|
||||||
GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void drawFadingBox(int var0, int var1, int var2, int var3, int var4, int var5) {
|
protected static void drawFadingBox(int i, int j, int k, int l, int i1, int j1) {
|
||||||
float var6 = (float)(var4 >>> 24) / 255.0F;
|
float f = (float) (i1 >> 24 & 0xff) / 255F;
|
||||||
float var7 = (float)(var4 >> 16 & 255) / 255.0F;
|
float f1 = (float) (i1 >> 16 & 0xff) / 255F;
|
||||||
float var8 = (float)(var4 >> 8 & 255) / 255.0F;
|
float f2 = (float) (i1 >> 8 & 0xff) / 255F;
|
||||||
float var12 = (float)(var4 & 255) / 255.0F;
|
float f3 = (float) (i1 & 0xff) / 255F;
|
||||||
float var9 = (float)(var5 >>> 24) / 255.0F;
|
float f4 = (float) (j1 >> 24 & 0xff) / 255F;
|
||||||
float var10 = (float)(var5 >> 16 & 255) / 255.0F;
|
float f5 = (float) (j1 >> 16 & 0xff) / 255F;
|
||||||
float var11 = (float)(var5 >> 8 & 255) / 255.0F;
|
float f6 = (float) (j1 >> 8 & 0xff) / 255F;
|
||||||
float var13 = (float)(var5 & 255) / 255.0F;
|
float f7 = (float) (j1 & 0xff) / 255F;
|
||||||
GL11.glDisable(3553);
|
GL11.glDisable(3553 /* GL_TEXTURE_2D */);
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042 /* GL_BLEND */);
|
||||||
GL11.glBlendFunc(770, 771);
|
GL11.glDisable(3008 /* GL_ALPHA_TEST */);
|
||||||
//TODO: Rewrite later...
|
GL11.glBlendFunc(770, 771);
|
||||||
|
GL11.glShadeModel(7425 /* GL_SMOOTH */);
|
||||||
//GL11.glBegin(7);
|
Tessellator tessellator = Tessellator.instance;
|
||||||
GL11.glColor4f(var7, var8, var12, var6);
|
tessellator.startDrawingQuads();
|
||||||
//GL11.glVertex2f((float)var2, (float)var1);
|
tessellator.setColorRGBA_F(f1, f2, f3, f);
|
||||||
//GL11.glVertex2f((float)var0, (float)var1);
|
tessellator.addVertex(k, j, 0.0D);
|
||||||
GL11.glColor4f(var10, var11, var13, var9);
|
tessellator.addVertex(i, j, 0.0D);
|
||||||
//GL11.glVertex2f((float)var0, (float)var3);
|
tessellator.setColorRGBA_F(f5, f6, f7, f4);
|
||||||
//GL11.glVertex2f((float)var2, (float)var3);
|
tessellator.addVertex(i, l, 0.0D);
|
||||||
//GL11.glEnd();
|
tessellator.addVertex(k, l, 0.0D);
|
||||||
GL11.glDisable(3042);
|
tessellator.draw();
|
||||||
GL11.glEnable(3553);
|
GL11.glShadeModel(7424 /* GL_FLAT */);
|
||||||
|
GL11.glDisable(3042 /* GL_BLEND */);
|
||||||
|
GL11.glEnable(3008 /* GL_ALPHA_TEST */);
|
||||||
|
GL11.glEnable(3553 /* GL_TEXTURE_2D */);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCenteredString(FontRenderer var0, String var1, int var2, int var3, int var4) {
|
public static void drawCenteredString(FontRenderer var0, String var1, int var2, int var3, int var4) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user