Rewrite some* unsupported code
This commit is contained in:
parent
7d5fb0a402
commit
e5a859313a
|
@ -81,7 +81,6 @@ public class GameSettings {
|
||||||
|
|
||||||
if(var1 == 6) {
|
if(var1 == 6) {
|
||||||
this.anaglyph = !this.anaglyph;
|
this.anaglyph = !this.anaglyph;
|
||||||
this.mc.renderEngine.refreshTextures();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var1 == 7) {
|
if(var1 == 7) {
|
||||||
|
|
|
@ -1,26 +1,19 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.awt.Canvas;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import net.minecraft.client.MinecraftApplet;
|
|
||||||
import org.lwjgl.LWJGLException;
|
import org.lwjgl.LWJGLException;
|
||||||
import org.lwjgl.input.Controllers;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.Display;
|
import org.lwjgl.opengl.Display;
|
||||||
import org.lwjgl.opengl.DisplayMode;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.util.glu.GLU;
|
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public abstract class Minecraft implements Runnable {
|
public abstract class Minecraft implements Runnable {
|
||||||
public PlayerController playerController = new PlayerControllerSP(this);
|
public PlayerController playerController = new PlayerControllerSP(this);
|
||||||
private boolean fullscreen = false;
|
private boolean fullscreen = false;
|
||||||
public int displayWidth;
|
public int displayWidth;
|
||||||
public int displayHeight;
|
public int displayHeight;
|
||||||
private OpenGlCapsChecker glCapabilities;
|
|
||||||
private Timer timer = new Timer(20.0F);
|
private Timer timer = new Timer(20.0F);
|
||||||
public World theWorld;
|
public World theWorld;
|
||||||
public RenderGlobal renderGlobal;
|
public RenderGlobal renderGlobal;
|
||||||
|
@ -28,7 +21,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
public EffectRenderer effectRenderer;
|
public EffectRenderer effectRenderer;
|
||||||
public Session session = null;
|
public Session session = null;
|
||||||
public String minecraftUri;
|
public String minecraftUri;
|
||||||
public Canvas mcCanvas;
|
|
||||||
public boolean appletMode = true;
|
public boolean appletMode = true;
|
||||||
public volatile boolean isGamePaused = false;
|
public volatile boolean isGamePaused = false;
|
||||||
public RenderEngine renderEngine;
|
public RenderEngine renderEngine;
|
||||||
|
@ -48,7 +40,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
public ModelBiped playerModelBiped = new ModelBiped(0.0F);
|
public ModelBiped playerModelBiped = new ModelBiped(0.0F);
|
||||||
public MovingObjectPosition objectMouseOver = null;
|
public MovingObjectPosition objectMouseOver = null;
|
||||||
public GameSettings gameSettings;
|
public GameSettings gameSettings;
|
||||||
protected MinecraftApplet mcApplet;
|
|
||||||
public SoundManager sndManager = new SoundManager();
|
public SoundManager sndManager = new SoundManager();
|
||||||
public MouseHelper mouseHelper;
|
public MouseHelper mouseHelper;
|
||||||
public File mcDataDir;
|
public File mcDataDir;
|
||||||
|
@ -65,13 +56,11 @@ public abstract class Minecraft implements Runnable {
|
||||||
public boolean isRaining = false;
|
public boolean isRaining = false;
|
||||||
long systemTime = System.currentTimeMillis();
|
long systemTime = System.currentTimeMillis();
|
||||||
|
|
||||||
public Minecraft(Component var1, Canvas var2, MinecraftApplet var3, int var4, int var5, boolean var6) {
|
public Minecraft(int var4, int var5, boolean var6) {
|
||||||
this.tempDisplayWidth = var4;
|
this.tempDisplayWidth = var4;
|
||||||
this.tempDisplayHeight = var5;
|
this.tempDisplayHeight = var5;
|
||||||
this.fullscreen = var6;
|
this.fullscreen = var6;
|
||||||
this.mcApplet = var3;
|
|
||||||
new ThreadSleepForever(this, "Timer hack thread");
|
new ThreadSleepForever(this, "Timer hack thread");
|
||||||
this.mcCanvas = var2;
|
|
||||||
this.displayWidth = var4;
|
this.displayWidth = var4;
|
||||||
this.displayHeight = var5;
|
this.displayHeight = var5;
|
||||||
this.fullscreen = var6;
|
this.fullscreen = var6;
|
||||||
|
@ -83,64 +72,17 @@ public abstract class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startGame() throws LWJGLException {
|
public void startGame() throws LWJGLException {
|
||||||
if(this.mcCanvas != null) {
|
|
||||||
Graphics var1 = this.mcCanvas.getGraphics();
|
|
||||||
if(var1 != null) {
|
|
||||||
var1.setColor(Color.BLACK);
|
|
||||||
var1.fillRect(0, 0, this.displayWidth, this.displayHeight);
|
|
||||||
var1.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Display.setParent(this.mcCanvas);
|
|
||||||
} else if(this.fullscreen) {
|
|
||||||
Display.setFullscreen(true);
|
|
||||||
this.displayWidth = Display.getDisplayMode().getWidth();
|
|
||||||
this.displayHeight = Display.getDisplayMode().getHeight();
|
|
||||||
if(this.displayWidth <= 0) {
|
|
||||||
this.displayWidth = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.displayHeight <= 0) {
|
|
||||||
this.displayHeight = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
|
|
||||||
}
|
|
||||||
|
|
||||||
Display.setTitle("Minecraft Minecraft Infdev");
|
|
||||||
|
|
||||||
try {
|
|
||||||
Display.create();
|
|
||||||
} catch (LWJGLException var6) {
|
|
||||||
var6.printStackTrace();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000L);
|
|
||||||
} catch (InterruptedException var5) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Display.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mcDataDir = getMinecraftDir();
|
this.mcDataDir = getMinecraftDir();
|
||||||
this.gameSettings = new GameSettings(this, this.mcDataDir);
|
this.gameSettings = new GameSettings(this, this.mcDataDir);
|
||||||
this.renderEngine = new RenderEngine(this.gameSettings);
|
this.renderEngine = new RenderEngine(this.gameSettings);
|
||||||
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
|
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
|
||||||
this.loadScreen();
|
this.loadScreen();
|
||||||
Keyboard.create();
|
this.mouseHelper = new MouseHelper();
|
||||||
Mouse.create();
|
|
||||||
this.mouseHelper = new MouseHelper(this.mcCanvas);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Controllers.create();
|
|
||||||
} catch (Exception var4) {
|
|
||||||
var4.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.checkGLError("Pre startup");
|
this.checkGLError("Pre startup");
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
GL11.glClearDepth(1.0D);
|
GL11.glClearDepth((float)1.0D);
|
||||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
@ -150,7 +92,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
GL11.glLoadIdentity();
|
GL11.glLoadIdentity();
|
||||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||||
this.checkGLError("Startup");
|
this.checkGLError("Startup");
|
||||||
this.glCapabilities = new OpenGlCapsChecker();
|
|
||||||
this.sndManager.loadSoundSettings(this.gameSettings);
|
this.sndManager.loadSoundSettings(this.gameSettings);
|
||||||
this.renderEngine.registerTextureFX(this.textureLavaFX);
|
this.renderEngine.registerTextureFX(this.textureLavaFX);
|
||||||
this.renderEngine.registerTextureFX(this.textureWaterFX);
|
this.renderEngine.registerTextureFX(this.textureWaterFX);
|
||||||
|
@ -206,7 +147,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
this.fontRenderer.drawStringWithShadow("Loading...", 8, this.displayHeight / 2 - 16, -1);
|
this.fontRenderer.drawStringWithShadow("Loading...", 8, this.displayHeight / 2 - 16, -1);
|
||||||
Display.swapBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getMinecraftDir() {
|
public static File getMinecraftDir() {
|
||||||
|
@ -282,7 +222,7 @@ public abstract class Minecraft implements Runnable {
|
||||||
private void checkGLError(String var1) {
|
private void checkGLError(String var1) {
|
||||||
int var2 = GL11.glGetError();
|
int var2 = GL11.glGetError();
|
||||||
if(var2 != 0) {
|
if(var2 != 0) {
|
||||||
String var3 = GLU.gluErrorString(var2);
|
String var3 = GL11.gluErrorString(var2);
|
||||||
System.out.println("########## GL ERROR ##########");
|
System.out.println("########## GL ERROR ##########");
|
||||||
System.out.println("@ " + var1);
|
System.out.println("@ " + var1);
|
||||||
System.out.println(var2 + ": " + var3);
|
System.out.println(var2 + ": " + var3);
|
||||||
|
@ -292,10 +232,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdownMinecraftApplet() {
|
public void shutdownMinecraftApplet() {
|
||||||
if(this.mcApplet != null) {
|
|
||||||
this.mcApplet.clearApplet();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(this.downloadResourcesThread != null) {
|
if(this.downloadResourcesThread != null) {
|
||||||
this.downloadResourcesThread.closeMinecraft();
|
this.downloadResourcesThread.closeMinecraft();
|
||||||
|
@ -303,21 +239,10 @@ public abstract class Minecraft implements Runnable {
|
||||||
} catch (Exception var8) {
|
} catch (Exception var8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
System.out.println("Stopping!");
|
||||||
System.out.println("Stopping!");
|
this.changeWorld1((World)null);
|
||||||
this.changeWorld1((World)null);
|
GLAllocation.deleteTexturesAndDisplayLists();
|
||||||
|
this.sndManager.closeMinecraft();
|
||||||
try {
|
|
||||||
GLAllocation.deleteTexturesAndDisplayLists();
|
|
||||||
} catch (Exception var6) {
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sndManager.closeMinecraft();
|
|
||||||
Mouse.destroy();
|
|
||||||
Keyboard.destroy();
|
|
||||||
} finally {
|
|
||||||
Display.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
|
@ -337,12 +262,9 @@ public abstract class Minecraft implements Runnable {
|
||||||
long var1 = System.currentTimeMillis();
|
long var1 = System.currentTimeMillis();
|
||||||
int var3 = 0;
|
int var3 = 0;
|
||||||
|
|
||||||
while(this.running && (this.mcApplet == null || this.mcApplet.isActive())) {
|
while(this.running) {
|
||||||
AxisAlignedBB.clearBoundingBoxPool();
|
AxisAlignedBB.clearBoundingBoxPool();
|
||||||
Vec3D.initialize();
|
Vec3D.initialize();
|
||||||
if(this.mcCanvas == null && Display.isCloseRequested()) {
|
|
||||||
this.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.isGamePaused) {
|
if(this.isGamePaused) {
|
||||||
float var4 = this.timer.renderPartialTicks;
|
float var4 = this.timer.renderPartialTicks;
|
||||||
|
@ -374,11 +296,7 @@ public abstract class Minecraft implements Runnable {
|
||||||
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Display.isActive() && this.fullscreen) {
|
if(Keyboard.isKeyDown(33) && Keyboard.isKeyDown(7)) {
|
||||||
this.toggleFullscreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Keyboard.isKeyDown(Keyboard.KEY_F6)) {
|
|
||||||
this.displayDebugInfo();
|
this.displayDebugInfo();
|
||||||
} else {
|
} else {
|
||||||
this.prevFrameTime = System.nanoTime();
|
this.prevFrameTime = System.nanoTime();
|
||||||
|
@ -386,9 +304,9 @@ public abstract class Minecraft implements Runnable {
|
||||||
|
|
||||||
Thread.yield();
|
Thread.yield();
|
||||||
Display.update();
|
Display.update();
|
||||||
if(this.mcCanvas != null && !this.fullscreen && (this.mcCanvas.getWidth() != this.displayWidth || this.mcCanvas.getHeight() != this.displayHeight)) {
|
if(LWJGLMain.canvas.getWidth() != this.displayWidth || LWJGLMain.canvas.getHeight() != this.displayHeight) {
|
||||||
this.displayWidth = this.mcCanvas.getWidth();
|
this.displayWidth = LWJGLMain.canvas.getWidth();
|
||||||
this.displayHeight = this.mcCanvas.getHeight();
|
this.displayHeight = LWJGLMain.canvas.getHeight();
|
||||||
if(this.displayWidth <= 0) {
|
if(this.displayWidth <= 0) {
|
||||||
this.displayWidth = 1;
|
this.displayWidth = 1;
|
||||||
}
|
}
|
||||||
|
@ -602,61 +520,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleFullscreen() {
|
|
||||||
try {
|
|
||||||
this.fullscreen = !this.fullscreen;
|
|
||||||
System.out.println("Toggle fullscreen!");
|
|
||||||
if(this.fullscreen) {
|
|
||||||
Display.setDisplayMode(Display.getDesktopDisplayMode());
|
|
||||||
this.displayWidth = Display.getDisplayMode().getWidth();
|
|
||||||
this.displayHeight = Display.getDisplayMode().getHeight();
|
|
||||||
if(this.displayWidth <= 0) {
|
|
||||||
this.displayWidth = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.displayHeight <= 0) {
|
|
||||||
this.displayHeight = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(this.mcCanvas != null) {
|
|
||||||
this.displayWidth = this.mcCanvas.getWidth();
|
|
||||||
this.displayHeight = this.mcCanvas.getHeight();
|
|
||||||
} else {
|
|
||||||
this.displayWidth = this.tempDisplayWidth;
|
|
||||||
this.displayHeight = this.tempDisplayHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.displayWidth <= 0) {
|
|
||||||
this.displayWidth = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.displayHeight <= 0) {
|
|
||||||
this.displayHeight = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setIngameNotInFocus();
|
|
||||||
Display.setFullscreen(this.fullscreen);
|
|
||||||
Display.update();
|
|
||||||
Thread.sleep(1000L);
|
|
||||||
if(this.fullscreen) {
|
|
||||||
this.setIngameFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.currentScreen != null) {
|
|
||||||
this.setIngameNotInFocus();
|
|
||||||
this.resize(this.displayWidth, this.displayHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Size: " + this.displayWidth + ", " + this.displayHeight);
|
|
||||||
} catch (Exception var2) {
|
|
||||||
var2.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resize(int var1, int var2) {
|
private void resize(int var1, int var2) {
|
||||||
if(var1 <= 0) {
|
if(var1 <= 0) {
|
||||||
var1 = 1;
|
var1 = 1;
|
||||||
|
@ -704,9 +567,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/terrain.png"));
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/terrain.png"));
|
||||||
if(!this.isGamePaused) {
|
|
||||||
this.renderEngine.updateDynamicTextures();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.currentScreen == null && this.thePlayer != null && this.thePlayer.health <= 0) {
|
if(this.currentScreen == null && this.thePlayer != null && this.thePlayer.health <= 0) {
|
||||||
this.displayGuiScreen((GuiScreen)null);
|
this.displayGuiScreen((GuiScreen)null);
|
||||||
|
@ -747,47 +607,43 @@ public abstract class Minecraft implements Runnable {
|
||||||
this.thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState());
|
this.thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState());
|
||||||
} while(!Keyboard.getEventKeyState());
|
} while(!Keyboard.getEventKeyState());
|
||||||
|
|
||||||
if(Keyboard.getEventKey() == Keyboard.KEY_F11) {
|
if(this.currentScreen != null) {
|
||||||
this.toggleFullscreen();
|
this.currentScreen.handleKeyboardInput();
|
||||||
} else {
|
} else {
|
||||||
if(this.currentScreen != null) {
|
if(Keyboard.getEventKey() == 1) {
|
||||||
this.currentScreen.handleKeyboardInput();
|
this.displayInGameMenu();
|
||||||
} else {
|
}
|
||||||
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
|
|
||||||
this.displayInGameMenu();
|
if(this.playerController instanceof PlayerControllerCreative) {
|
||||||
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindLoad.keyCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.playerController instanceof PlayerControllerCreative) {
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindSave.keyCode) {
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindLoad.keyCode) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindSave.keyCode) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Keyboard.getEventKey() == Keyboard.KEY_F5) {
|
|
||||||
this.gameSettings.thirdPersonView = !this.gameSettings.thirdPersonView;
|
|
||||||
this.isRaining = !this.isRaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindInventory.keyCode) {
|
|
||||||
this.displayGuiScreen(new GuiInventory(this.thePlayer.inventory));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) {
|
|
||||||
this.thePlayer.dropPlayerItemWithRandomChoice(this.thePlayer.inventory.decrStackSize(this.thePlayer.inventory.currentItem, 1), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int var4 = 0; var4 < 9; ++var4) {
|
if(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(6)) {
|
||||||
if(Keyboard.getEventKey() == Keyboard.KEY_1 + var4) {
|
this.gameSettings.thirdPersonView = !this.gameSettings.thirdPersonView;
|
||||||
this.thePlayer.inventory.currentItem = var4;
|
this.isRaining = !this.isRaining;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) {
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindInventory.keyCode) {
|
||||||
this.gameSettings.setOptionFloatValue(4, !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ? 1 : -1);
|
this.displayGuiScreen(new GuiInventory(this.thePlayer.inventory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) {
|
||||||
|
this.thePlayer.dropPlayerItemWithRandomChoice(this.thePlayer.inventory.decrStackSize(this.thePlayer.inventory.currentItem, 1), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int var4 = 0; var4 < 9; ++var4) {
|
||||||
|
if(Keyboard.getEventKey() == 2 + var4) {
|
||||||
|
this.thePlayer.inventory.currentItem = var4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) {
|
||||||
|
this.gameSettings.setOptionFloatValue(4, !Keyboard.isKeyDown(42) && !Keyboard.isKeyDown(54) ? 1 : -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -988,10 +844,6 @@ public abstract class Minecraft implements Runnable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenGlCapsChecker getOpenGlCapsChecker() {
|
|
||||||
return this.glCapabilities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String debugInfoRenders() {
|
public String debugInfoRenders() {
|
||||||
return this.renderGlobal.getDebugInfoRenders();
|
return this.renderGlobal.getDebugInfoRenders();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.awt.Canvas;
|
|
||||||
import java.awt.Component;
|
|
||||||
import net.minecraft.client.MinecraftApplet;
|
|
||||||
|
|
||||||
public class MinecraftAppletImpl extends Minecraft {
|
|
||||||
final MinecraftApplet mainFrame;
|
|
||||||
|
|
||||||
public MinecraftAppletImpl(MinecraftApplet var1, Component var2, Canvas var3, MinecraftApplet var4, int var5, int var6, boolean var7) {
|
|
||||||
super(var2, var3, var4, var5, var6, var7);
|
|
||||||
this.mainFrame = var1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayUnexpectedThrowable(UnexpectedThrowable var1) {
|
|
||||||
this.mainFrame.removeAll();
|
|
||||||
this.mainFrame.add(new PanelCrashReport(var1), "Center");
|
|
||||||
this.mainFrame.validate();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,13 +5,13 @@ import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class MouseHelper {
|
public class MouseHelper {
|
||||||
|
|
||||||
public void grabMouse() {
|
public void grabMouseCursor() {
|
||||||
Mouse.setNativeCursor(true);
|
Mouse.setNativeCursor(true);
|
||||||
deltaX = 0;
|
deltaX = 0;
|
||||||
deltaY = 0;
|
deltaY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ungrabMouse() {
|
public void ungrabMouseCursor() {
|
||||||
Mouse.setCursorPosition(LWJGLMain.getCanvasWidth() / 2, LWJGLMain.getCanvasHeight() / 2);
|
Mouse.setCursorPosition(LWJGLMain.getCanvasWidth() / 2, LWJGLMain.getCanvasHeight() / 2);
|
||||||
Mouse.setNativeCursor(false);
|
Mouse.setNativeCursor(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,254 +1,202 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
import net.PeytonPlayz585.opengl.MinecraftImageData;
|
||||||
|
|
||||||
public class RenderEngine {
|
public class RenderEngine {
|
||||||
private HashMap textureMap = new HashMap();
|
|
||||||
private HashMap textureContentsMap = new HashMap();
|
|
||||||
private IntBuffer singleIntBuffer = GLAllocation.createIntBuffer(1);
|
|
||||||
private ByteBuffer imageData = GLAllocation.createDirectByteBuffer(262144);
|
|
||||||
private List textureList = new ArrayList();
|
|
||||||
private Map urlToImageDataMap = new HashMap();
|
|
||||||
private GameSettings options;
|
|
||||||
private boolean clampTexture = false;
|
|
||||||
|
|
||||||
public RenderEngine(GameSettings var1) {
|
public RenderEngine(GameSettings gamesettings) {
|
||||||
this.options = var1;
|
textureMap = new HashMap<String, Integer>();
|
||||||
|
textureNameToImageMap = new HashMap<Integer, MinecraftImageData>();
|
||||||
|
singleIntBuffer = GLAllocation.createIntBuffer(1);
|
||||||
|
imageDataB1 = GLAllocation.createByteBuffer(0x100000);
|
||||||
|
imageDataB2 = GLAllocation.createByteBuffer(0x100000);
|
||||||
|
textureList = new ArrayList<TextureFX>();
|
||||||
|
clampTexture = false;
|
||||||
|
blurTexture = false;
|
||||||
|
options = gamesettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTexture(String var1) {
|
public int getTexture(String s) {
|
||||||
Integer var2 = (Integer)this.textureMap.get(var1);
|
Integer integer = (Integer) textureMap.get(s);
|
||||||
if(var2 != null) {
|
if (integer != null) {
|
||||||
return var2.intValue();
|
return integer.intValue();
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
this.singleIntBuffer.clear();
|
|
||||||
GLAllocation.generateDisplayLists(this.singleIntBuffer);
|
|
||||||
int var4 = this.singleIntBuffer.get(0);
|
|
||||||
if(var1.startsWith("##")) {
|
|
||||||
this.setupTexture(this.unwrapImageByColumns(ImageIO.read(RenderEngine.class.getResourceAsStream(var1.substring(2)))), var4);
|
|
||||||
} else if(var1.startsWith("%%")) {
|
|
||||||
this.clampTexture = true;
|
|
||||||
this.setupTexture(ImageIO.read(RenderEngine.class.getResourceAsStream(var1.substring(2))), var4);
|
|
||||||
this.clampTexture = false;
|
|
||||||
} else {
|
|
||||||
this.setupTexture(ImageIO.read(RenderEngine.class.getResourceAsStream(var1)), var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.textureMap.put(var1, Integer.valueOf(var4));
|
|
||||||
return var4;
|
|
||||||
} catch (IOException var3) {
|
|
||||||
throw new RuntimeException("!!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
try {
|
||||||
|
singleIntBuffer.clear();
|
||||||
private BufferedImage unwrapImageByColumns(BufferedImage var1) {
|
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||||
int var2 = var1.getWidth() / 16;
|
int i = singleIntBuffer.get(0);
|
||||||
BufferedImage var3 = new BufferedImage(16, var1.getHeight() * var2, 2);
|
if (s.startsWith("%clamp%")) {
|
||||||
Graphics var4 = var3.getGraphics();
|
clampTexture = true;
|
||||||
|
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(7))), i);
|
||||||
for(int var5 = 0; var5 < var2; ++var5) {
|
clampTexture = false;
|
||||||
var4.drawImage(var1, -var5 * 16, var5 * var1.getHeight(), (ImageObserver)null);
|
} else if (s.startsWith("%blur%")) {
|
||||||
}
|
blurTexture = true;
|
||||||
|
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(6))), i);
|
||||||
var4.dispose();
|
blurTexture = false;
|
||||||
return var3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int allocateAndSetupTexture(BufferedImage var1) {
|
|
||||||
this.singleIntBuffer.clear();
|
|
||||||
GLAllocation.generateDisplayLists(this.singleIntBuffer);
|
|
||||||
int var2 = this.singleIntBuffer.get(0);
|
|
||||||
this.setupTexture(var1, var2);
|
|
||||||
this.textureContentsMap.put(Integer.valueOf(var2), var1);
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setupTexture(BufferedImage var1, int var2) {
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2);
|
|
||||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
|
||||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
|
||||||
if(this.clampTexture) {
|
|
||||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
|
|
||||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
|
|
||||||
} else {
|
|
||||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
|
|
||||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
int var3 = var1.getWidth();
|
|
||||||
int var4 = var1.getHeight();
|
|
||||||
int[] var5 = new int[var3 * var4];
|
|
||||||
byte[] var6 = new byte[var3 * var4 * 4];
|
|
||||||
var1.getRGB(0, 0, var3, var4, var5, 0, var3);
|
|
||||||
|
|
||||||
for(int var7 = 0; var7 < var5.length; ++var7) {
|
|
||||||
int var8 = var5[var7] >> 24 & 255;
|
|
||||||
int var9 = var5[var7] >> 16 & 255;
|
|
||||||
int var10 = var5[var7] >> 8 & 255;
|
|
||||||
int var11 = var5[var7] & 255;
|
|
||||||
if(this.options != null && this.options.anaglyph) {
|
|
||||||
int var12 = (var9 * 30 + var10 * 59 + var11 * 11) / 100;
|
|
||||||
int var13 = (var9 * 30 + var10 * 70) / 100;
|
|
||||||
int var14 = (var9 * 30 + var11 * 70) / 100;
|
|
||||||
var9 = var12;
|
|
||||||
var10 = var13;
|
|
||||||
var11 = var14;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6[var7 * 4 + 0] = (byte)var9;
|
|
||||||
var6[var7 * 4 + 1] = (byte)var10;
|
|
||||||
var6[var7 * 4 + 2] = (byte)var11;
|
|
||||||
var6[var7 * 4 + 3] = (byte)var8;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.imageData.clear();
|
|
||||||
this.imageData.put(var6);
|
|
||||||
this.imageData.position(0).limit(var6.length);
|
|
||||||
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, var3, var4, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteTexture(int var1) {
|
|
||||||
this.textureContentsMap.remove(Integer.valueOf(var1));
|
|
||||||
this.singleIntBuffer.clear();
|
|
||||||
this.singleIntBuffer.put(var1);
|
|
||||||
this.singleIntBuffer.flip();
|
|
||||||
GL11.glDeleteTextures(this.singleIntBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTextureForDownloadableImage(String var1, String var2) {
|
|
||||||
ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1);
|
|
||||||
if(var3 != null && var3.image != null && !var3.textureSetupComplete) {
|
|
||||||
if(var3.textureName < 0) {
|
|
||||||
var3.textureName = this.allocateAndSetupTexture(var3.image);
|
|
||||||
} else {
|
} else {
|
||||||
this.setupTexture(var3.image, var3.textureName);
|
if(s.equals("/terrain.png")) {
|
||||||
|
useMipmaps = true;
|
||||||
|
}
|
||||||
|
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s)), i);
|
||||||
|
useMipmaps = false;
|
||||||
}
|
}
|
||||||
|
textureMap.put(s, Integer.valueOf(i));
|
||||||
var3.textureSetupComplete = true;
|
return i;
|
||||||
|
} catch (IOException ioexception) {
|
||||||
|
throw new RuntimeException("!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return var3 != null && var3.textureName >= 0 ? var3.textureName : this.getTexture(var2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThreadDownloadImageData obtainImageData(String var1, ImageBuffer var2) {
|
public int allocateAndSetupTexture(MinecraftImageData bufferedimage) {
|
||||||
ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1);
|
singleIntBuffer.clear();
|
||||||
if(var3 == null) {
|
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||||
this.urlToImageDataMap.put(var1, new ThreadDownloadImageData(var1, var2));
|
int i = singleIntBuffer.get(0);
|
||||||
|
setupTexture(bufferedimage, i);
|
||||||
|
textureNameToImageMap.put(Integer.valueOf(i), bufferedimage);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int allocateAndSetupTexture(byte[] data, int w, int h) {
|
||||||
|
int i = GL11.glGenTextures();
|
||||||
|
bindTexture(i);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||||
|
imageDataB1.clear();
|
||||||
|
imageDataB1.put(data);
|
||||||
|
imageDataB1.position(0).limit(data.length);
|
||||||
|
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, w, h, 0, 6408 /* GL_RGBA */,
|
||||||
|
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupTexture(MinecraftImageData bufferedimage, int i) {
|
||||||
|
bindTexture(i);
|
||||||
|
if (useMipmaps) {
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, GL11.GL_NEAREST_MIPMAP_LINEAR);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, GL11.GL_NEAREST /* GL_LINEAR */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, GL11.GL_TEXTURE_MAX_LEVEL, 4);
|
||||||
} else {
|
} else {
|
||||||
++var3.referenceCount;
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9728 /* GL_NEAREST */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
|
||||||
}
|
}
|
||||||
|
if (blurTexture) {
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */);
|
||||||
|
}
|
||||||
|
if (clampTexture) {
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10496 /* GL_CLAMP */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10496 /* GL_CLAMP */);
|
||||||
|
} else {
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||||
|
}
|
||||||
|
int j = bufferedimage.w;
|
||||||
|
int k = bufferedimage.h;
|
||||||
|
int ai[] = bufferedimage.data;
|
||||||
|
byte abyte0[] = new byte[j * k * 4];
|
||||||
|
for (int l = 0; l < ai.length; l++) {
|
||||||
|
int j1 = ai[l] >> 24 & 0xff;
|
||||||
|
int l1 = ai[l] >> 16 & 0xff;
|
||||||
|
int j2 = ai[l] >> 8 & 0xff;
|
||||||
|
int l2 = ai[l] >> 0 & 0xff;
|
||||||
|
if (options != null && options.anaglyph) {
|
||||||
|
int j3 = (l1 * 30 + j2 * 59 + l2 * 11) / 100;
|
||||||
|
int l3 = (l1 * 30 + j2 * 70) / 100;
|
||||||
|
int j4 = (l1 * 30 + l2 * 70) / 100;
|
||||||
|
l1 = j3;
|
||||||
|
j2 = l3;
|
||||||
|
l2 = j4;
|
||||||
|
}
|
||||||
|
abyte0[l * 4 + 0] = (byte) l1;
|
||||||
|
abyte0[l * 4 + 1] = (byte) j2;
|
||||||
|
abyte0[l * 4 + 2] = (byte) l2;
|
||||||
|
abyte0[l * 4 + 3] = (byte) j1;
|
||||||
|
}
|
||||||
|
imageDataB1.clear();
|
||||||
|
imageDataB1.put(abyte0);
|
||||||
|
imageDataB1.position(0).limit(abyte0.length);
|
||||||
|
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */,
|
||||||
|
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||||
|
if (useMipmaps) {
|
||||||
|
for (int i1 = 1; i1 <= 4; i1++) {
|
||||||
|
int k1 = j >> i1 - 1;
|
||||||
|
int i2 = j >> i1;
|
||||||
|
int k2 = k >> i1;
|
||||||
|
imageDataB2.clear();
|
||||||
|
for (int i3 = 0; i3 < i2; i3++) {
|
||||||
|
for (int k3 = 0; k3 < k2; k3++) {
|
||||||
|
int i4 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 0) * k1) * 4);
|
||||||
|
int k4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 0) * k1) * 4);
|
||||||
|
int l4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 1) * k1) * 4);
|
||||||
|
int i5 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 1) * k1) * 4);
|
||||||
|
int j5 = averageColor(averageColor(i4, k4), averageColor(l4, i5));
|
||||||
|
imageDataB2.putInt((i3 + k3 * i2) * 4, j5);
|
||||||
|
}
|
||||||
|
|
||||||
return var3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void releaseImageData(String var1) {
|
|
||||||
ThreadDownloadImageData var2 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1);
|
|
||||||
if(var2 != null) {
|
|
||||||
--var2.referenceCount;
|
|
||||||
if(var2.referenceCount == 0) {
|
|
||||||
if(var2.textureName >= 0) {
|
|
||||||
this.deleteTexture(var2.textureName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.urlToImageDataMap.remove(var1);
|
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, i1, 6408 /* GL_RGBA */, i2, k2, 0, 6408 /* GL_RGBA */,
|
||||||
|
5121 /* GL_UNSIGNED_BYTE */, imageDataB2);
|
||||||
|
ByteBuffer tmp = imageDataB1;
|
||||||
|
imageDataB1 = imageDataB2;
|
||||||
|
imageDataB2 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteTexture(int i) {
|
||||||
|
GL11.glDeleteTextures(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTextureForDownloadableImage(String s, String s1) {
|
||||||
|
return getTexture("/mob/char.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerTextureFX(TextureFX texturefx) {
|
||||||
|
textureList.add(texturefx);
|
||||||
|
texturefx.onTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int averageColor(int i, int j) {
|
||||||
|
int k = (i & 0xff000000) >> 24 & 0xff;
|
||||||
|
int l = (j & 0xff000000) >> 24 & 0xff;
|
||||||
|
return ((k + l >> 1) << 24) + ((i & 0xfefefe) + (j & 0xfefefe) >> 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerTextureFX(TextureFX var1) {
|
private MinecraftImageData readTextureImage(byte[] inputstream) throws IOException {
|
||||||
this.textureList.add(var1);
|
return LWJGLMain.loadPNG(inputstream);
|
||||||
var1.onTick();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDynamicTextures() {
|
public void bindTexture(int i) {
|
||||||
int var1;
|
if (i < 0) {
|
||||||
TextureFX var2;
|
return;
|
||||||
for(var1 = 0; var1 < this.textureList.size(); ++var1) {
|
} else {
|
||||||
var2 = (TextureFX)this.textureList.get(var1);
|
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
|
||||||
var2.anaglyphEnabled = this.options.anaglyph;
|
return;
|
||||||
var2.onTick();
|
|
||||||
this.imageData.clear();
|
|
||||||
this.imageData.put(var2.imageData);
|
|
||||||
this.imageData.position(0).limit(var2.imageData.length);
|
|
||||||
|
|
||||||
for(int var3 = 0; var3 < var2.tileSize; ++var3) {
|
|
||||||
for(int var4 = 0; var4 < var2.tileSize; ++var4) {
|
|
||||||
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var2.iconIndex % 16 * 16 + var3 * 16, var2.iconIndex / 16 * 16 + var4 * 16, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(var1 = 0; var1 < this.textureList.size(); ++var1) {
|
|
||||||
var2 = (TextureFX)this.textureList.get(var1);
|
|
||||||
if(var2.textureId > 0) {
|
|
||||||
this.imageData.clear();
|
|
||||||
this.imageData.put(var2.imageData);
|
|
||||||
this.imageData.position(0).limit(var2.imageData.length);
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2.textureId);
|
|
||||||
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshTextures() {
|
|
||||||
Iterator var1 = this.textureContentsMap.keySet().iterator();
|
|
||||||
|
|
||||||
BufferedImage var3;
|
|
||||||
while(var1.hasNext()) {
|
|
||||||
int var2 = ((Integer)var1.next()).intValue();
|
|
||||||
var3 = (BufferedImage)this.textureContentsMap.get(Integer.valueOf(var2));
|
|
||||||
this.setupTexture(var3, var2);
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadDownloadImageData var6;
|
|
||||||
for(var1 = this.urlToImageDataMap.values().iterator(); var1.hasNext(); var6.textureSetupComplete = false) {
|
|
||||||
var6 = (ThreadDownloadImageData)var1.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
var1 = this.textureMap.keySet().iterator();
|
|
||||||
|
|
||||||
while(var1.hasNext()) {
|
|
||||||
String var7 = (String)var1.next();
|
|
||||||
|
|
||||||
try {
|
|
||||||
if(var7.startsWith("##")) {
|
|
||||||
var3 = this.unwrapImageByColumns(ImageIO.read(RenderEngine.class.getResourceAsStream(var7.substring(2))));
|
|
||||||
} else if(var7.startsWith("%%")) {
|
|
||||||
this.clampTexture = true;
|
|
||||||
var3 = ImageIO.read(RenderEngine.class.getResourceAsStream(var7.substring(2)));
|
|
||||||
this.clampTexture = false;
|
|
||||||
} else {
|
|
||||||
var3 = ImageIO.read(RenderEngine.class.getResourceAsStream(var7));
|
|
||||||
}
|
|
||||||
|
|
||||||
int var4 = ((Integer)this.textureMap.get(var7)).intValue();
|
|
||||||
this.setupTexture(var3, var4);
|
|
||||||
} catch (IOException var5) {
|
|
||||||
var5.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bindTexture(int var1) {
|
|
||||||
if(var1 >= 0) {
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean useMipmaps = false;
|
||||||
|
private HashMap<String, Integer> textureMap;
|
||||||
|
private HashMap<Integer, MinecraftImageData> textureNameToImageMap;
|
||||||
|
private IntBuffer singleIntBuffer;
|
||||||
|
private ByteBuffer imageDataB1;
|
||||||
|
private ByteBuffer imageDataB2;
|
||||||
|
private java.util.List<TextureFX> textureList;
|
||||||
|
private GameSettings options;
|
||||||
|
private boolean clampTexture;
|
||||||
|
private boolean blurTexture;
|
||||||
}
|
}
|
|
@ -1051,17 +1051,9 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void obtainEntitySkin(Entity var1) {
|
public void obtainEntitySkin(Entity var1) {
|
||||||
if(var1.skinUrl != null) {
|
|
||||||
this.renderEngine.obtainImageData(var1.skinUrl, new ImageBufferDownload());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseEntitySkin(Entity var1) {
|
public void releaseEntitySkin(Entity var1) {
|
||||||
if(var1.skinUrl != null) {
|
|
||||||
this.renderEngine.releaseImageData(var1.skinUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateAllRenderers() {
|
public void updateAllRenderers() {
|
||||||
|
|
5
src/main/java/org/lwjgl/LWJGLException.java
Normal file
5
src/main/java/org/lwjgl/LWJGLException.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package org.lwjgl;
|
||||||
|
|
||||||
|
public class LWJGLException extends Exception {
|
||||||
|
|
||||||
|
}
|
|
@ -28,4 +28,8 @@ public class Keyboard {
|
||||||
LWJGLMain.enableRepeatEvents(b);
|
LWJGLMain.enableRepeatEvents(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isKeyDown(int i) {
|
||||||
|
return LWJGLMain.isKeyDown(i);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,12 @@ public class Mouse {
|
||||||
return LWJGLMain.mouseGetEventButton();
|
return LWJGLMain.mouseGetEventButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isButtonDown(int i) {
|
||||||
|
return LWJGLMain.mouseIsButtonDown(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getEventDWheel() {
|
||||||
|
return LWJGLMain.mouseGetEventDWheel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.lwjgl.opengl;
|
package org.lwjgl.opengl;
|
||||||
|
|
||||||
|
import org.teavm.jso.dom.html.HTMLCanvasElement;
|
||||||
|
|
||||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class Display {
|
public class Display {
|
||||||
|
@ -10,4 +12,8 @@ public class Display {
|
||||||
public static void update() {
|
public static void update() {
|
||||||
LWJGLMain.updateDisplay();
|
LWJGLMain.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HTMLCanvasElement getDisplayMode() {
|
||||||
|
return LWJGLMain.canvas;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user