Fixed Texture Loading (I think)

This commit is contained in:
PeytonPlayz595 2023-07-11 12:54:57 -04:00
parent 18ba66b293
commit 6f7c2a3608
3 changed files with 21 additions and 50 deletions

View File

@ -138,7 +138,6 @@ public final class Minecraft implements Runnable {
System.out.println("########## GL ERROR ##########"); System.out.println("########## GL ERROR ##########");
System.out.println("@ " + var0); System.out.println("@ " + var0);
System.out.println(var1 + ": " + var2); System.out.println(var1 + ": " + var2);
System.exit(0);
} }
} }
@ -151,7 +150,7 @@ public final class Minecraft implements Runnable {
public final void run() { public final void run() {
this.running = true; this.running = true;
try { //try {
Minecraft var1 = this; Minecraft var1 = this;
this.width = MinecraftMain.canvas.getWidth(); this.width = MinecraftMain.canvas.getWidth();
this.height = MinecraftMain.canvas.getHeight(); this.height = MinecraftMain.canvas.getHeight();
@ -182,59 +181,16 @@ public final class Minecraft implements Runnable {
(var85 = new Level()).setData(8, 8, 8, new byte[512]); (var85 = new Level()).setData(8, 8, 8, new byte[512]);
this.setLevel(var85); this.setLevel(var85);
} else { } else {
boolean var10 = false; this.generateLevel(1);
// try {
// if(var1.levelName != null) {
// var1.loadOnlineLevel(var1.levelName, var1.levelId);
// } else if(!var1.levelLoaded) {
// Level var11 = null;
// if((var11 = var1.levelIo.load((InputStream)(new FileInputStream(new File("level.dat"))))) != null) {
// var1.setLevel(var11);
// }
// }
// } catch (Exception var54) {
// var54.printStackTrace();
// }
//if(this.level == null) {
this.generateLevel(1);
//}
} }
this.particleManager = new ParticleManager(this.level); this.particleManager = new ParticleManager(this.level);
// try {
// var1.soundPlayer = new SoundPlayer(var1.settings);
// SoundPlayer var4 = var1.soundPlayer;
//
// try {
// AudioFormat var67 = new AudioFormat(44100.0F, 16, 2, true, true);
// var4.dataLine = AudioSystem.getSourceDataLine(var67);
// var4.dataLine.open(var67, 4410);
// var4.dataLine.start();
// var4.running = true;
// Thread var72;
// (var72 = new Thread(var4)).setDaemon(true);
// var72.setPriority(10);
// var72.start();
// } catch (Exception var51) {
// var51.printStackTrace();
// var4.running = false;
// }
//
// var1.resourceThread = new ResourceDownloadThread(var2, var1);
// var1.resourceThread.start();
// } catch (Exception var52) {
// ;
// }
checkGLError("Post startup"); checkGLError("Post startup");
this.hud = new HUDScreen(this, this.width, this.height); this.hud = new HUDScreen(this, this.width, this.height);
} catch (Exception var62) { //} catch (Exception var62) {
var62.printStackTrace(); //var62.printStackTrace();
throw new RuntimeException("Failed to start Minecraft! :("); //throw new RuntimeException("Failed to start Minecraft! :(");
} //}
long var13 = System.currentTimeMillis(); long var13 = System.currentTimeMillis();
int var15 = 0; int var15 = 0;

View File

@ -1,13 +1,16 @@
package com.mojang.minecraft.render; package com.mojang.minecraft.render;
import java.util.ArrayList;
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.HashMap; import java.util.HashMap;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.mojang.minecraft.GameSettings; import com.mojang.minecraft.GameSettings;
import com.mojang.minecraft.Minecraft;
import com.mojang.minecraft.render.texture.TextureFX; import com.mojang.minecraft.render.texture.TextureFX;
import net.PeytonPlayz585.lwjgl.LWJGLUtils; import net.PeytonPlayz585.lwjgl.LWJGLUtils;
@ -16,6 +19,16 @@ import net.PeytonPlayz585.minecraft.MinecraftImage;
public class RenderEngine { public class RenderEngine {
public RenderEngine() {
textureMap = new HashMap<String, Integer>();
textureNameToImageMap = new HashMap<Object, Object>();
singleIntBuffer = BufferUtils.createIntBuffer(1);
imageDataB1 = BufferUtils.createByteBuffer(0x100000);
imageDataB2 = BufferUtils.createByteBuffer(0x100000);
textureList = new ArrayList<TextureFX>();
options = Minecraft.settings;
}
public int getTexture(String s) { public int getTexture(String s) {
TextureBase texturebase = new TextureBase(); TextureBase texturebase = new TextureBase();
Integer integer = (Integer) textureMap.get(s); Integer integer = (Integer) textureMap.get(s);

View File

@ -68,6 +68,8 @@ public class MinecraftMain {
canvas.setAttribute("id", "minecraftClassicBrowser"); canvas.setAttribute("id", "minecraftClassicBrowser");
rootElement.appendChild(canvas); rootElement.appendChild(canvas);
canvasBack = (HTMLCanvasElement)doc.createElement("canvas"); canvasBack = (HTMLCanvasElement)doc.createElement("canvas");
imageLoadCanvas = (HTMLCanvasElement) doc.createElement("canvas");
imageLoadContext = (CanvasRenderingContext2D) imageLoadCanvas.getContext("2d");
double r = win.getDevicePixelRatio(); double r = win.getDevicePixelRatio();
int iw = parent.getClientWidth(); int iw = parent.getClientWidth();