Got the game to actually render

This commit is contained in:
PeytonPlayz595 2024-02-09 10:53:34 -05:00
parent c4d70358da
commit 4e1b162982
4 changed files with 82064 additions and 7012 deletions

82
build.gradle Normal file
View File

@ -0,0 +1,82 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.github.zebalu:teavm-gradle-plugin:1.0.0'
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'io.github.zebalu.teavm-gradle-plugin'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets {
main {
java {
srcDir 'src/main/java'
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.teavm:teavm-platform:0.6.1'
implementation 'org.teavm:teavm-classlib:0.6.1'
implementation 'com.jcraft:jzlib:1.1.3'
}
teavm {
compileScopes = null;
minifying = false;
maxTopLevelNames = 10000;
properties = null;
debugInformationGenerated = false;
sourceMapsGenerated = true;
sourceFilesCopied = false;
incremental = false;
transformers = null;
/** Where to save the result */
targetDirectory = file("js");
/** The directory to monitor to decide if compile is up-to-date or not */
sourceDirectory = file("src");
/** How to name the result file. */
targetFileName = "app.js";
/** Which class holds your public static void main(Strin[] args) method */
mainClass = 'net.lax1dude.eaglercraft.Client';
/** This will be the name of your main method after compilation. */
entryPointName = 'main';
classesToPreserve = null;
stopOnErrors = false;
optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
fastGlobalAnalysis = false;
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
cacheDirectory = null;
wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
minHeapSize = 4;
maxHeapSize = 128;
outOfProcess = false;
processMemory = 512;
longjmpSupported = true;
heapDump = false;
/** Add name of configurations here where to look for jarfiles. */
includeJarsFrom = [];
/** By default teavmc taskd epends on javaCompile task, unless this varaibale is true. */
skipJavaCompile = false;
}

88922
js/app.js

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -159,39 +159,47 @@ public class Minecraft implements Runnable {
} }
private void loadScreen() { private void loadScreen() {
ScaledResolution var1 = new ScaledResolution(this.displayWidth, this.displayHeight); int xx = displayWidth;
int var2 = var1.getScaledWidth(); if(xx > displayHeight) {
int var3 = var1.getScaledHeight(); xx = displayHeight;
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT); }
GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glClear(16640);
GL11.glMatrixMode(5889 /* GL_PROJECTION */);
GL11.glLoadIdentity(); GL11.glLoadIdentity();
GL11.glOrtho(0.0D, (double)var2, (double)var3, 0.0D, 1000.0D, 3000.0D); GL11.glOrtho(0.0F, displayWidth, displayHeight, 0.0F, 1000F, 3000F);
GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(5888 /* GL_MODELVIEW0_ARB */);
GL11.glLoadIdentity(); GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, 0.0F, -2000.0F); GL11.glTranslatef(0.0F, 0.0F, -2000F);
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); GL11.glViewport(0, 0, displayWidth, displayHeight);
GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
Tessellator var4 = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(2896 /* GL_LIGHTING */);
GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(3553 /* GL_TEXTURE_2D */);
GL11.glDisable(GL11.GL_FOG); GL11.glDisable(2912 /* GL_FOG */);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/title/mojang.png")); GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, renderEngine.getTexture("/title/mojang.png"));
var4.startDrawingQuads(); tessellator.startDrawingQuads();
var4.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(0xffffff);
var4.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, displayHeight, 0.0D, 0.0D, 0.0D);
var4.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(displayWidth, displayHeight, 0.0D, 0.0D, 0.0D);
var4.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
var4.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
var4.draw(); tessellator.draw();
short var5 = 256;
short var6 = 256;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
var4.setColorOpaque_I(16777215); tessellator.startDrawingQuads();
this.func_6274_a((this.displayWidth / 2 - var5) / 2, (this.displayHeight / 2 - var6) / 2, 0, 0, var5, var6); tessellator.setColorOpaque_I(0xffffff);
GL11.glDisable(GL11.GL_LIGHTING); int marginX = (displayWidth - xx) / 2;
GL11.glDisable(GL11.GL_FOG); int marginY = (displayHeight - xx) / 2;
GL11.glEnable(GL11.GL_ALPHA_TEST); tessellator.addVertexWithUV(marginX, displayHeight - marginY, 0.0D, 0.0D, 1.0D);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); tessellator.addVertexWithUV(displayWidth - marginX, displayHeight - marginY, 0.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(displayWidth - marginX, marginY, 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV(marginX, marginY, 0.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glDisable(2896 /* GL_LIGHTING */);
GL11.glDisable(2912 /* GL_FOG */);
GL11.glEnable(3008 /* GL_ALPHA_TEST */);
GL11.glAlphaFunc(516, 0.1F);
GL11.webgl.flush();
GL11.updateDisplay();
} }
public void func_6274_a(int var1, int var2, int var3, int var4, int var5, int var6) { public void func_6274_a(int var1, int var2, int var3, int var4, int var5, int var6) {
@ -304,6 +312,10 @@ public class Minecraft implements Runnable {
if(this.gameSettings.limitFramerate) { if(this.gameSettings.limitFramerate) {
Thread.sleep(5L); Thread.sleep(5L);
} }
if(!(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(8))) {
GL11.updateDisplay();
}
if(!this.field_6307_v) { if(!this.field_6307_v) {
if(this.field_6327_b != null) { if(this.field_6327_b != null) {