mirror of
https://github.com/catfoolyou/Alpha-1.1.2_01.git
synced 2025-06-03 21:20:57 -05:00
52 errors
This commit is contained in:
parent
50417d9c8e
commit
e042c6ff4b
9
.idea/Alpha-1.1.2_01.iml
generated
Normal file
9
.idea/Alpha-1.1.2_01.iml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
20
.idea/jarRepositories.xml
generated
Normal file
20
.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
2
lwjgl-rundir/_start_desktop_runtime.sh
Executable file
2
lwjgl-rundir/_start_desktop_runtime.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
java -Xmx4G -Xms4G -Djava.library.path=. -cp "eaglercraft.jar:UnsafeMemcpy.jar:lwjgl.jar:lwjgl-egl.jar:lwjgl-glfw.jar:lwjgl-jemalloc.jar:lwjgl-openal.jar:lwjgl-opengles.jar:soundsystem-20120107.jar:codecjorbis-20101023.jar:codecwav-20101023.jar:Java-WebSocket-1.5.1-with-dependencies.jar" net.lax1dude.eaglercraft.internal.LWJGLEntryPoint
|
@ -1,13 +1,9 @@
|
||||
package net.minecraft.client;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.io.File;
|
||||
import net.lax1dude.eaglercraft.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.internal.EnumPlatformType;
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
import net.lax1dude.eaglercraft.minecraft.EaglerFontRenderer;
|
||||
|
||||
import net.lax1dude.eaglercraft.profile.EaglerProfile;
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
@ -40,7 +36,6 @@ import net.minecraft.src.ModelBiped;
|
||||
import net.minecraft.src.MouseHelper;
|
||||
import net.minecraft.src.MovementInputFromOptions;
|
||||
import net.minecraft.src.MovingObjectPosition;
|
||||
import net.minecraft.src.OSMap;
|
||||
import net.minecraft.src.OpenGlCapsChecker;
|
||||
import net.minecraft.src.PlayerController;
|
||||
import net.minecraft.src.PlayerControllerCreative;
|
||||
@ -57,7 +52,6 @@ import net.minecraft.src.TextureLavaFX;
|
||||
import net.minecraft.src.TextureLavaFlowFX;
|
||||
import net.minecraft.src.TextureWaterFX;
|
||||
import net.minecraft.src.TextureWaterFlowFX;
|
||||
import net.minecraft.src.ThreadDownloadResources;
|
||||
import net.minecraft.src.ThreadSleepForever;
|
||||
import net.minecraft.src.Timer;
|
||||
import net.minecraft.src.UnexpectedThrowable;
|
||||
@ -71,11 +65,13 @@ import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
|
||||
public abstract class Minecraft implements Runnable {
|
||||
public class Minecraft implements Runnable {
|
||||
public PlayerController playerController;
|
||||
private boolean fullscreen = false;
|
||||
public int displayWidth;
|
||||
public int displayHeight;
|
||||
public float dpi;
|
||||
public int debugFPS;
|
||||
private OpenGlCapsChecker glCapabilities;
|
||||
private Timer timer = new Timer(20.0F);
|
||||
public World theWorld;
|
||||
@ -83,16 +79,12 @@ public abstract class Minecraft implements Runnable {
|
||||
public EntityPlayerSP thePlayer;
|
||||
public EffectRenderer effectRenderer;
|
||||
public Session session = null;
|
||||
public String minecraftUri;
|
||||
public Canvas mcCanvas;
|
||||
public boolean appletMode = true;
|
||||
public volatile boolean isGamePaused = false;
|
||||
public RenderEngine renderEngine;
|
||||
public FontRenderer fontRenderer;
|
||||
public GuiScreen currentScreen = null;
|
||||
public LoadingScreenRenderer loadingScreen = new LoadingScreenRenderer(this);
|
||||
public EntityRenderer entityRenderer = new EntityRenderer(this);
|
||||
private ThreadDownloadResources downloadResourcesThread;
|
||||
private int ticksRan = 0;
|
||||
private int leftClickCounter = 0;
|
||||
private int tempDisplayWidth;
|
||||
@ -106,14 +98,14 @@ public abstract class Minecraft implements Runnable {
|
||||
public GameSettings options;
|
||||
public SoundManager sndManager = new SoundManager();
|
||||
public MouseHelper mouseHelper;
|
||||
public File mcDataDir;
|
||||
public VFile2 mcDataDir;
|
||||
public static long[] frameTimes = new long[512];
|
||||
public static int numRecordedFrameTimes = 0;
|
||||
private String serverName;
|
||||
private int serverPort;
|
||||
private TextureWaterFX textureWaterFX = new TextureWaterFX();
|
||||
private TextureLavaFX textureLavaFX = new TextureLavaFX();
|
||||
private static File minecraftDir = null;
|
||||
private static VFile2 minecraftDir = null;
|
||||
public volatile boolean running = true;
|
||||
public String debug = "";
|
||||
long prevFrameTime = -1L;
|
||||
@ -123,72 +115,68 @@ public abstract class Minecraft implements Runnable {
|
||||
long systemTime = System.currentTimeMillis();
|
||||
private int joinPlayerCounter = 0;
|
||||
|
||||
public Minecraft(Canvas var2) {
|
||||
public ScaledResolution scaledResolution = null;
|
||||
|
||||
public Minecraft() {
|
||||
this.tempDisplayWidth = 640;
|
||||
this.tempDisplayHeight = 480;
|
||||
this.fullscreen = false;
|
||||
new ThreadSleepForever(this, "Timer hack thread");
|
||||
this.mcCanvas = var2;
|
||||
this.displayWidth = 640;
|
||||
this.displayHeight = 480;
|
||||
}
|
||||
|
||||
public abstract void displayUnexpectedThrowable(UnexpectedThrowable var1);
|
||||
public void updateDisplay() {
|
||||
if(Display.isVSyncSupported()) {
|
||||
if(EagRuntime.getPlatformType() == EnumPlatformType.WASM_GC) {
|
||||
Display.setVSync(true);
|
||||
} else {
|
||||
Display.setVSync(this.options.limitFramerate);
|
||||
}
|
||||
}
|
||||
Display.update(0);
|
||||
this.checkWindowResize();
|
||||
}
|
||||
|
||||
public void setServer(String var1, int var2) {
|
||||
this.serverName = var1;
|
||||
this.serverPort = var2;
|
||||
protected void checkWindowResize() {
|
||||
float dpiFetch = -1.0f;
|
||||
if ((Display.wasResized() || (dpiFetch = Math.max(Display.getDPI(), 1.0f)) != this.dpi)) {
|
||||
int i = this.displayWidth;
|
||||
int j = this.displayHeight;
|
||||
float f = this.dpi;
|
||||
this.displayWidth = Display.getWidth();
|
||||
this.displayHeight = Display.getHeight();
|
||||
this.dpi = dpiFetch == -1.0f ? Math.max(Display.getDPI(), 1.0f) : dpiFetch;
|
||||
if (this.displayWidth != i || this.displayHeight != j || this.dpi != f) {
|
||||
if (this.displayWidth <= 0) {
|
||||
this.displayWidth = 1;
|
||||
}
|
||||
|
||||
if (this.displayHeight <= 0) {
|
||||
this.displayHeight = 1;
|
||||
}
|
||||
|
||||
this.resize(this.displayWidth, this.displayHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.getWidth();
|
||||
this.displayHeight = Display.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 Alpha v1.1.2_01");
|
||||
|
||||
try {
|
||||
Display.create();
|
||||
} catch (LWJGLException var6) {
|
||||
var6.printStackTrace();
|
||||
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException var5) {
|
||||
}
|
||||
|
||||
Display.create();
|
||||
}
|
||||
|
||||
this.scaledResolution = new ScaledResolution(this.displayWidth, this.displayHeight);
|
||||
RenderManager.instance.itemRenderer = new ItemRenderer(this);
|
||||
this.mcDataDir = getMinecraftDir();
|
||||
this.options = new GameSettings(this, this.mcDataDir);
|
||||
this.renderEngine = new RenderEngine(this.options);
|
||||
this.fontRenderer = new FontRenderer(this.options, "/default.png", this.renderEngine);
|
||||
this.loadScreen();
|
||||
Keyboard.create();
|
||||
Mouse.create();
|
||||
this.mouseHelper = new MouseHelper(this.mcCanvas);
|
||||
this.mouseHelper = new MouseHelper();
|
||||
|
||||
this.checkGLError("Pre startup");
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
@ -216,12 +204,6 @@ public abstract class Minecraft implements Runnable {
|
||||
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
||||
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
||||
|
||||
try {
|
||||
this.downloadResourcesThread = new ThreadDownloadResources(this.mcDataDir, this);
|
||||
this.downloadResourcesThread.start();
|
||||
} catch (Exception var3) {
|
||||
}
|
||||
|
||||
this.checkGLError("Post startup");
|
||||
this.ingameGUI = new GuiIngame(this);
|
||||
if(this.serverName != null) {
|
||||
@ -266,7 +248,7 @@ public abstract class Minecraft implements Runnable {
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
Display.swapBuffers();
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
public void scaledTessellator(int var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
@ -281,43 +263,43 @@ public abstract class Minecraft implements Runnable {
|
||||
var9.draw();
|
||||
}
|
||||
|
||||
public static File getMinecraftDir() {
|
||||
public static VFile2 getMinecraftDir() {
|
||||
if(minecraftDir == null) {
|
||||
minecraftDir = getAppDir("minecraft");
|
||||
minecraftDir = new VFile2("minecraft");
|
||||
}
|
||||
|
||||
return minecraftDir;
|
||||
}
|
||||
|
||||
public static File getAppDir(String var0) {
|
||||
String var1 = System.getProperty("user.home", ".");
|
||||
File var2;
|
||||
switch(OSMap.osValues[getOs().ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
var2 = new File(var1, '.' + var0 + '/');
|
||||
break;
|
||||
case 3:
|
||||
String var3 = System.getenv("APPDATA");
|
||||
if(var3 != null) {
|
||||
var2 = new File(var3, "." + var0 + '/');
|
||||
} else {
|
||||
var2 = new File(var1, '.' + var0 + '/');
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
var2 = new File(var1, "Library/Application Support/" + var0);
|
||||
break;
|
||||
default:
|
||||
var2 = new File(var1, var0 + '/');
|
||||
}
|
||||
|
||||
if(!var2.exists() && !var2.mkdirs()) {
|
||||
throw new RuntimeException("The working directory could not be created: " + var2);
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
// public static File getAppDir(String var0) {
|
||||
// String var1 = System.getProperty("user.home", ".");
|
||||
// File var2;
|
||||
// switch(OSMap.osValues[getOs().ordinal()]) {
|
||||
// case 1:
|
||||
// case 2:
|
||||
// var2 = new File(var1, '.' + var0 + '/');
|
||||
// break;
|
||||
// case 3:
|
||||
// String var3 = System.getenv("APPDATA");
|
||||
// if(var3 != null) {
|
||||
// var2 = new File(var3, "." + var0 + '/');
|
||||
// } else {
|
||||
// var2 = new File(var1, '.' + var0 + '/');
|
||||
// }
|
||||
// break;
|
||||
// case 4:
|
||||
// var2 = new File(var1, "Library/Application Support/" + var0);
|
||||
// break;
|
||||
// default:
|
||||
// var2 = new File(var1, var0 + '/');
|
||||
// }
|
||||
//
|
||||
// if(!var2.exists() && !var2.mkdirs()) {
|
||||
// throw new RuntimeException("The working directory could not be created: " + var2);
|
||||
// } else {
|
||||
// return var2;
|
||||
// }
|
||||
// }
|
||||
|
||||
private static EnumOS getOs() {
|
||||
String var0 = System.getProperty("os.name").toLowerCase();
|
||||
@ -364,29 +346,17 @@ public abstract class Minecraft implements Runnable {
|
||||
}
|
||||
|
||||
public void shutdownMinecraftApplet() {
|
||||
try {
|
||||
if(this.downloadResourcesThread != null) {
|
||||
this.downloadResourcesThread.closeMinecraft();
|
||||
}
|
||||
} catch (Exception var8) {
|
||||
}
|
||||
System.out.println("Stopping!");
|
||||
//isShuttingDown = true;
|
||||
this.changeWorld1(null);
|
||||
|
||||
try {
|
||||
System.out.println("Stopping!");
|
||||
this.changeWorld1((World)null);
|
||||
|
||||
try {
|
||||
GLAllocation.deleteTexturesAndDisplayLists();
|
||||
} catch (Exception var6) {
|
||||
}
|
||||
|
||||
this.sndManager.closeMinecraft();
|
||||
Mouse.destroy();
|
||||
Keyboard.destroy();
|
||||
} finally {
|
||||
Display.destroy();
|
||||
GLAllocation.deleteTexturesAndDisplayLists();
|
||||
} catch (Exception var6) {
|
||||
}
|
||||
|
||||
this.sndManager.closeMinecraft();
|
||||
EagRuntime.exit();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
@ -395,10 +365,9 @@ public abstract class Minecraft implements Runnable {
|
||||
|
||||
try {
|
||||
this.startGame();
|
||||
} catch (Exception var13) {
|
||||
var13.printStackTrace();
|
||||
this.displayUnexpectedThrowable(new UnexpectedThrowable("Failed to start game", var13));
|
||||
return;
|
||||
} catch (Exception var15) {
|
||||
var15.printStackTrace();
|
||||
throw new RuntimeException("Failed to start game", var15);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -406,10 +375,10 @@ public abstract class Minecraft implements Runnable {
|
||||
long var1 = System.currentTimeMillis();
|
||||
int var3 = 0;
|
||||
|
||||
while(this.running && (this.mcApplet == null || this.mcApplet.isActive())) {
|
||||
while(this.running) {
|
||||
AxisAlignedBB.clearBoundingBoxPool();
|
||||
Vec3D.initialize();
|
||||
if(this.mcCanvas == null && Display.isCloseRequested()) {
|
||||
if(Display.isCloseRequested()) {
|
||||
this.shutdown();
|
||||
}
|
||||
|
||||
@ -421,24 +390,31 @@ public abstract class Minecraft implements Runnable {
|
||||
this.timer.updateTimer();
|
||||
}
|
||||
|
||||
for(int var17 = 0; var17 < this.timer.elapsedTicks; ++var17) {
|
||||
long var19 = System.nanoTime();
|
||||
|
||||
for(int var6 = 0; var6 < this.timer.elapsedTicks; ++var6) {
|
||||
++this.ticksRan;
|
||||
|
||||
try {
|
||||
this.runTick();
|
||||
} catch (MinecraftException var12) {
|
||||
} catch (MinecraftException var14) {
|
||||
this.theWorld = null;
|
||||
this.changeWorld1((World)null);
|
||||
this.displayGuiScreen(new GuiConflictWarning());
|
||||
}
|
||||
}
|
||||
|
||||
long var20 = System.nanoTime() - var19;
|
||||
this.checkGLError("Pre render");
|
||||
this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(this.theWorld != null) {
|
||||
while(this.theWorld.updatingLighting()) {
|
||||
}
|
||||
|
||||
// if(this.theWorld != null && this.theWorld.multiplayerWorld) {
|
||||
// this.theWorld.updateLighting();
|
||||
// }
|
||||
|
||||
if(!Keyboard.isKeyDown(Keyboard.KEY_F7)) {
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
if(!this.skipRenderWorld) {
|
||||
@ -449,57 +425,35 @@ public abstract class Minecraft implements Runnable {
|
||||
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
if(!Display.isActive()) {
|
||||
if(this.fullscreen) {
|
||||
this.toggleFullscreen();
|
||||
}
|
||||
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_F6)) {
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_F3)) {
|
||||
this.displayDebugInfo();
|
||||
} else {
|
||||
this.prevFrameTime = System.nanoTime();
|
||||
}
|
||||
|
||||
Thread.yield();
|
||||
Display.update();
|
||||
if(this.mcCanvas != null && !this.fullscreen && (this.mcCanvas.getWidth() != this.displayWidth || this.mcCanvas.getHeight() != this.displayHeight)) {
|
||||
this.displayWidth = this.mcCanvas.getWidth();
|
||||
this.displayHeight = this.mcCanvas.getHeight();
|
||||
if(this.displayWidth <= 0) {
|
||||
this.displayWidth = 1;
|
||||
}
|
||||
|
||||
if(this.displayHeight <= 0) {
|
||||
this.displayHeight = 1;
|
||||
}
|
||||
|
||||
this.resize(this.displayWidth, this.displayHeight);
|
||||
}
|
||||
|
||||
if(this.options.limitFramerate) {
|
||||
Thread.sleep(5L);
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_F7)) {
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
//this.screenshotListener();
|
||||
this.checkGLError("Post render");
|
||||
++var3;
|
||||
|
||||
for(this.isGamePaused = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
|
||||
debugFPS = var3;
|
||||
this.debug = var3 + " fps, " + WorldRenderer.chunksUpdated + " chunk updates";
|
||||
WorldRenderer.chunksUpdated = 0;
|
||||
var1 += 1000L;
|
||||
}
|
||||
}
|
||||
} catch (MinecraftError var14) {
|
||||
} catch (Throwable var15) {
|
||||
} catch (MinecraftError var16) {
|
||||
} catch (Throwable var17) {
|
||||
this.theWorld = null;
|
||||
var15.printStackTrace();
|
||||
this.displayUnexpectedThrowable(new UnexpectedThrowable("Unexpected error", var15));
|
||||
var17.printStackTrace();
|
||||
throw new RuntimeException("Unexpected error", var17);
|
||||
}
|
||||
|
||||
} finally {
|
||||
this.shutdownMinecraftApplet();
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,60 +631,60 @@ 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();
|
||||
}
|
||||
|
||||
}
|
||||
// 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) {
|
||||
if(var1 <= 0) {
|
||||
@ -839,7 +793,7 @@ public abstract class Minecraft implements Runnable {
|
||||
} while(!Keyboard.getEventKeyState());
|
||||
|
||||
if(Keyboard.getEventKey() == Keyboard.KEY_F11) {
|
||||
this.toggleFullscreen();
|
||||
//this.toggleFullscreen();
|
||||
} else {
|
||||
if(this.currentScreen != null) {
|
||||
this.currentScreen.handleKeyboardInput();
|
||||
@ -959,7 +913,7 @@ public abstract class Minecraft implements Runnable {
|
||||
System.out.println("FORCING RELOAD!");
|
||||
this.sndManager = new SoundManager();
|
||||
this.sndManager.loadSoundSettings(this.options);
|
||||
this.downloadResourcesThread.reloadResources();
|
||||
//this.downloadResourcesThread.reloadResources();
|
||||
}
|
||||
|
||||
public boolean isMultiplayerWorld() {
|
||||
@ -969,7 +923,7 @@ public abstract class Minecraft implements Runnable {
|
||||
public void startWorld(String var1) {
|
||||
this.changeWorld1((World)null);
|
||||
System.gc();
|
||||
World var2 = new World(new File(getMinecraftDir(), "saves"), var1);
|
||||
World var2 = new World(new VFile2(getMinecraftDir(), "saves"), var1);
|
||||
if(var2.isNewWorld) {
|
||||
this.changeWorld(var2, "Generating level");
|
||||
} else {
|
||||
@ -1063,23 +1017,23 @@ public abstract class Minecraft implements Runnable {
|
||||
this.theWorld.dropOldChunks();
|
||||
}
|
||||
|
||||
public void installResource(String var1, File var2) {
|
||||
int var3 = var1.indexOf("/");
|
||||
String var4 = var1.substring(0, var3);
|
||||
var1 = var1.substring(var3 + 1);
|
||||
if(var4.equalsIgnoreCase("sound")) {
|
||||
this.sndManager.addSound(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("newsound")) {
|
||||
this.sndManager.addSound(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("streaming")) {
|
||||
this.sndManager.addStreaming(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("music")) {
|
||||
this.sndManager.addMusic(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("newmusic")) {
|
||||
this.sndManager.addMusic(var1, var2);
|
||||
}
|
||||
|
||||
}
|
||||
// public void installResource(String var1, File var2) {
|
||||
// int var3 = var1.indexOf("/");
|
||||
// String var4 = var1.substring(0, var3);
|
||||
// var1 = var1.substring(var3 + 1);
|
||||
// if(var4.equalsIgnoreCase("sound")) {
|
||||
// this.sndManager.addSound(var1, var2);
|
||||
// } else if(var4.equalsIgnoreCase("newsound")) {
|
||||
// this.sndManager.addSound(var1, var2);
|
||||
// } else if(var4.equalsIgnoreCase("streaming")) {
|
||||
// this.sndManager.addStreaming(var1, var2);
|
||||
// } else if(var4.equalsIgnoreCase("music")) {
|
||||
// this.sndManager.addMusic(var1, var2);
|
||||
// } else if(var4.equalsIgnoreCase("newmusic")) {
|
||||
// this.sndManager.addMusic(var1, var2);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
public OpenGlCapsChecker getOpenGlCapsChecker() {
|
||||
return this.glCapabilities;
|
||||
@ -1112,51 +1066,37 @@ public abstract class Minecraft implements Runnable {
|
||||
this.preloadWorld("Respawning");
|
||||
}
|
||||
|
||||
public static void startMainThread(String var0, String var1) {
|
||||
startMainThread(var0, var1, (String)null);
|
||||
}
|
||||
|
||||
public static void startMainThread(String var0, String var1, String var2) {
|
||||
boolean var3 = false;
|
||||
Frame var5 = new Frame("Minecraft");
|
||||
Canvas var6 = new Canvas();
|
||||
var5.setLayout(new BorderLayout());
|
||||
var5.add(var6, "Center");
|
||||
var6.setPreferredSize(new Dimension(854, 480));
|
||||
var5.pack();
|
||||
var5.setLocationRelativeTo((Component)null);
|
||||
MinecraftImpl var7 = new MinecraftImpl(var5, var6, null, 854, 480, var3, var5);
|
||||
Thread var8 = new Thread(var7, "Minecraft main thread");
|
||||
var8.setPriority(10);
|
||||
var7.appletMode = false;
|
||||
var7.minecraftUri = "www.minecraft.net";
|
||||
if(var0 != null && var1 != null) {
|
||||
var7.session = new Session(var0, var1);
|
||||
} else {
|
||||
var7.session = new Session(EaglerProfile.getName(), "");
|
||||
}
|
||||
|
||||
if(var2 != null) {
|
||||
String[] var9 = var2.split(":");
|
||||
var7.setServer(var9[0], Integer.parseInt(var9[1]));
|
||||
}
|
||||
|
||||
var5.setVisible(true);
|
||||
var5.addWindowListener(new GameWindowListener(var7, var8));
|
||||
var8.start();
|
||||
}
|
||||
|
||||
public static void main(String[] var0) {
|
||||
String var1 = EaglerProfile.getName();
|
||||
if(var0.length > 0) {
|
||||
var1 = var0[0];
|
||||
}
|
||||
|
||||
String var2 = "-";
|
||||
if(var0.length > 1) {
|
||||
var2 = var0[1];
|
||||
}
|
||||
|
||||
startMainThread(var1, var2);
|
||||
}
|
||||
// public static void startMainThread(String var0, String var1) {
|
||||
// startMainThread(var0, var1, (String)null);
|
||||
// }
|
||||
//
|
||||
// public static void startMainThread(String var0, String var1, String var2) {
|
||||
// boolean var3 = false;
|
||||
// Frame var5 = new Frame("Minecraft");
|
||||
// Canvas var6 = new Canvas();
|
||||
// var5.setLayout(new BorderLayout());
|
||||
// var5.add(var6, "Center");
|
||||
// var6.setPreferredSize(new Dimension(854, 480));
|
||||
// var5.pack();
|
||||
// var5.setLocationRelativeTo((Component)null);
|
||||
// MinecraftImpl var7 = new MinecraftImpl(var5, var6, null, 854, 480, var3, var5);
|
||||
// Thread var8 = new Thread(var7, "Minecraft main thread");
|
||||
// var8.setPriority(10);
|
||||
// var7.appletMode = false;
|
||||
// var7.minecraftUri = "www.minecraft.net";
|
||||
// if(var0 != null && var1 != null) {
|
||||
// var7.session = new Session(var0, var1);
|
||||
// } else {
|
||||
// var7.session = new Session(EaglerProfile.getName(), "");
|
||||
// }
|
||||
//
|
||||
// if(var2 != null) {
|
||||
// String[] var9 = var2.split(":");
|
||||
// var7.setServer(var9[0], Integer.parseInt(var9[1]));
|
||||
// }
|
||||
//
|
||||
// var5.setVisible(true);
|
||||
// var5.addWindowListener(new GameWindowListener(var7, var8));
|
||||
// var8.start();
|
||||
// }
|
||||
}
|
||||
|
@ -1,51 +1,41 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ChunkLoader implements IChunkLoader {
|
||||
private File saveDir;
|
||||
private VFile2 saveDir;
|
||||
private boolean createIfNecessary;
|
||||
private static final String hex = "0123456789ABCDEF";
|
||||
|
||||
public ChunkLoader(File var1, boolean var2) {
|
||||
public ChunkLoader(VFile2 var1, boolean var2) {
|
||||
this.saveDir = var1;
|
||||
this.createIfNecessary = var2;
|
||||
}
|
||||
|
||||
private File chunkFileForXZ(int var1, int var2) {
|
||||
String var3 = "c." + Integer.toString(var1, 36) + "." + Integer.toString(var2, 36) + ".dat";
|
||||
String var4 = Integer.toString(var1 & 63, 36);
|
||||
String var5 = Integer.toString(var2 & 63, 36);
|
||||
File var6 = new File(this.saveDir, var4);
|
||||
if(!var6.exists()) {
|
||||
if(!this.createIfNecessary) {
|
||||
return null;
|
||||
}
|
||||
private String chunkFileForXZ(int var1, int var2) {
|
||||
int unsignedX = var1 + 1900000;
|
||||
int unsignedZ = var2 + 1900000;
|
||||
|
||||
var6.mkdir();
|
||||
char[] path = new char[12];
|
||||
for(int i = 5; i >= 0; --i) {
|
||||
path[i] = hex.charAt((unsignedX >>> (i << 2)) & 0xF);
|
||||
path[i + 6] = hex.charAt((unsignedZ >>> (i << 2)) & 0xF);
|
||||
}
|
||||
|
||||
var6 = new File(var6, var5);
|
||||
if(!var6.exists()) {
|
||||
if(!this.createIfNecessary) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var6.mkdir();
|
||||
}
|
||||
|
||||
var6 = new File(var6, var3);
|
||||
return !var6.exists() && !this.createIfNecessary ? null : var6;
|
||||
return new String(path);
|
||||
}
|
||||
|
||||
public Chunk loadChunk(World var1, int var2, int var3) {
|
||||
File var4 = this.chunkFileForXZ(var2, var3);
|
||||
public Chunk loadChunk(World var1, int var2, int var3){
|
||||
VFile2 var4 = new VFile2(this.saveDir, this.chunkFileForXZ(var2, var3) + ".dat");
|
||||
if(var4 != null && var4.exists()) {
|
||||
try {
|
||||
FileInputStream var5 = new FileInputStream(var4);
|
||||
NBTTagCompound var6 = CompressedStreamTools.readCompressed(var5);
|
||||
NBTTagCompound var6;
|
||||
try (InputStream is = var4.getInputStream()) {
|
||||
var6 = CompressedStreamTools.readCompressed(is);
|
||||
}
|
||||
if(!var6.hasKey("Level")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping");
|
||||
return null;
|
||||
@ -73,27 +63,22 @@ public class ChunkLoader implements IChunkLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void saveChunk(World var1, Chunk var2) {
|
||||
var1.checkSessionLock();
|
||||
File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
|
||||
public void saveChunk(World var1, Chunk var2) throws IOException {
|
||||
VFile2 var3 = new VFile2(this.saveDir, this.chunkFileForXZ(var2.xPosition, var2.zPosition) + ".dat");
|
||||
if(var3.exists()) {
|
||||
var1.sizeOnDisk -= var3.length();
|
||||
}
|
||||
|
||||
try {
|
||||
File var4 = new File(this.saveDir, "tmp_chunk.dat");
|
||||
FileOutputStream var5 = new FileOutputStream(var4);
|
||||
NBTTagCompound var6 = new NBTTagCompound();
|
||||
NBTTagCompound var7 = new NBTTagCompound();
|
||||
var6.setTag("Level", var7);
|
||||
this.storeChunkInCompound(var2, var1, var7);
|
||||
CompressedStreamTools.writeCompressed(var6, var5);
|
||||
var5.close();
|
||||
if(var3.exists()) {
|
||||
var3.delete();
|
||||
|
||||
try (OutputStream os = var3.getOutputStream()) {
|
||||
CompressedStreamTools.writeCompressed(var6, os);
|
||||
}
|
||||
|
||||
var4.renameTo(var3);
|
||||
var1.sizeOnDisk += var3.length();
|
||||
} catch (Exception var8) {
|
||||
var8.printStackTrace();
|
||||
|
@ -1,14 +1,13 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.lax1dude.eaglercraft.internal.buffer.FloatBuffer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.NVFogDistance;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
|
||||
public class EntityRenderer {
|
||||
@ -591,9 +590,9 @@ public class EntityRenderer {
|
||||
GL11.glFogf(GL11.GL_FOG_END, this.farPlaneDistance * 0.8F);
|
||||
}
|
||||
|
||||
if(GLContext.getCapabilities().GL_NV_fog_distance) {
|
||||
GL11.glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV);
|
||||
}
|
||||
// if(GLContext.getCapabilities().GL_NV_fog_distance) {
|
||||
// GL11.glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV);
|
||||
// }
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
|
@ -1,9 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import net.lax1dude.eaglercraft.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.internal.buffer.FloatBuffer;
|
||||
import net.lax1dude.eaglercraft.internal.buffer.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@ -48,8 +50,7 @@ public class GLAllocation {
|
||||
}
|
||||
|
||||
public static synchronized ByteBuffer createDirectByteBuffer(int var0) {
|
||||
ByteBuffer var1 = ByteBuffer.allocateDirect(var0).order(ByteOrder.nativeOrder());
|
||||
return var1;
|
||||
return EagRuntime.allocateByteBuffer(var0);
|
||||
}
|
||||
|
||||
public static IntBuffer createDirectIntBuffer(int var0) {
|
||||
|
@ -1,10 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
@ -32,14 +30,14 @@ public class GameSettings {
|
||||
public KeyBinding keyBindSneak = new KeyBinding("Sneak", 42);
|
||||
public KeyBinding[] keyBindings = new KeyBinding[]{this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindToggleFog};
|
||||
protected Minecraft mc;
|
||||
private File optionsFile;
|
||||
private VFile2 optionsFile;
|
||||
public int numberOfOptions = 10;
|
||||
public int difficulty = 2;
|
||||
public boolean thirdPersonView = false;
|
||||
|
||||
public GameSettings(Minecraft var1, File var2) {
|
||||
public GameSettings(Minecraft var1, VFile2 var2) {
|
||||
this.mc = var1;
|
||||
this.optionsFile = new File(var2, "options.txt");
|
||||
this.optionsFile = new VFile2(var2, "options.txt");
|
||||
this.loadOptions();
|
||||
}
|
||||
|
||||
@ -124,7 +122,7 @@ public class GameSettings {
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedReader var1 = new BufferedReader(new FileReader(this.optionsFile));
|
||||
BufferedReader var1 = new BufferedReader(new InputStreamReader(this.optionsFile.getInputStream()));
|
||||
String var2 = "";
|
||||
|
||||
while(true) {
|
||||
@ -194,7 +192,7 @@ public class GameSettings {
|
||||
|
||||
public void saveOptions() {
|
||||
try {
|
||||
PrintWriter var1 = new PrintWriter(new FileWriter(this.optionsFile));
|
||||
PrintWriter var1 = new PrintWriter(new OutputStreamWriter(this.optionsFile.getOutputStream()));
|
||||
var1.println("music:" + this.musicVolume);
|
||||
var1.println("sound:" + this.soundVolume);
|
||||
var1.println("invertYMouse:" + this.invertMouse);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class GuiDeleteWorld extends GuiSelectWorld {
|
||||
@ -23,7 +23,7 @@ public class GuiDeleteWorld extends GuiSelectWorld {
|
||||
|
||||
public void deleteWorld(boolean var1, int var2) {
|
||||
if(var1) {
|
||||
File var3 = Minecraft.getMinecraftDir();
|
||||
VFile2 var3 = Minecraft.getMinecraftDir();
|
||||
World.deleteWorld(var3, this.getSaveName(var2));
|
||||
}
|
||||
|
||||
|
@ -112,10 +112,10 @@ public class GuiScreen extends Gui {
|
||||
|
||||
public void handleKeyboardInput() {
|
||||
if(Keyboard.getEventKeyState()) {
|
||||
if(Keyboard.getEventKey() == Keyboard.KEY_F11) {
|
||||
this.mc.toggleFullscreen();
|
||||
return;
|
||||
}
|
||||
// if(Keyboard.getEventKey() == Keyboard.KEY_F11) {
|
||||
// this.mc.toggleFullscreen();
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class GuiSelectWorld extends GuiScreen {
|
||||
@ -13,7 +15,7 @@ public class GuiSelectWorld extends GuiScreen {
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
File var1 = Minecraft.getMinecraftDir();
|
||||
VFile2 var1 = Minecraft.getMinecraftDir();
|
||||
|
||||
for(int var2 = 0; var2 < 5; ++var2) {
|
||||
NBTTagCompound var3 = World.getLevelData(var1, "World" + (var2 + 1));
|
||||
@ -31,7 +33,7 @@ public class GuiSelectWorld extends GuiScreen {
|
||||
}
|
||||
|
||||
protected String getSaveName(int var1) {
|
||||
File var2 = Minecraft.getMinecraftDir();
|
||||
VFile2 var2 = Minecraft.getMinecraftDir();
|
||||
return World.getLevelData(var2, "World" + var1) != null ? "World" + var1 : null;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public class MathHelper {
|
||||
private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION;
|
||||
private static float[] SIN_TABLE = new float[65536];
|
||||
|
||||
public static final float sin(float var0) {
|
||||
@ -45,6 +46,37 @@ public class MathHelper {
|
||||
return var0 > var2 ? var0 : var2;
|
||||
}
|
||||
|
||||
public static int clamp(int num, int min, int max) {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return num > max ? max : num;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPowerOfTwo(int value) {
|
||||
return value != 0 && (value & value - 1) == 0;
|
||||
}
|
||||
|
||||
public static int log2DeBruijn(int value) {
|
||||
value = isPowerOfTwo(value) ? value : smallestEncompassingPowerOfTwo(value);
|
||||
return MULTIPLY_DE_BRUIJN_BIT_POSITION[(int) ((long) value * 125613361L >> 27) & 31];
|
||||
}
|
||||
|
||||
public static int smallestEncompassingPowerOfTwo(int value) {
|
||||
int i = value - 1;
|
||||
i = i | i >> 1;
|
||||
i = i | i >> 2;
|
||||
i = i | i >> 4;
|
||||
i = i | i >> 8;
|
||||
i = i | i >> 16;
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
public static int log2(int value) {
|
||||
return log2DeBruijn(value) - (isPowerOfTwo(value) ? 0 : 1);
|
||||
}
|
||||
|
||||
public static int bucketInt(int var0, int var1) {
|
||||
return var0 < 0 ? -((-var0 - 1) / var1) - 1 : var0 / var1;
|
||||
}
|
||||
@ -54,5 +86,7 @@ public class MathHelper {
|
||||
SIN_TABLE[var0] = (float)Math.sin((double)var0 * Math.PI * 2.0D / 65536.0D);
|
||||
}
|
||||
|
||||
MULTIPLY_DE_BRUIJN_BIT_POSITION = new int[] { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27,
|
||||
13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.nio.IntBuffer;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.input.Cursor;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class MouseHelper {
|
||||
private Component windowComponent;
|
||||
private Cursor cursor;
|
||||
public int deltaX;
|
||||
public int deltaY;
|
||||
private int mouseInt = 10;
|
||||
|
||||
public MouseHelper(Component var1) {
|
||||
this.windowComponent = var1;
|
||||
IntBuffer var2 = GLAllocation.createDirectIntBuffer(1);
|
||||
var2.put(0);
|
||||
var2.flip();
|
||||
IntBuffer var3 = GLAllocation.createDirectIntBuffer(1024);
|
||||
|
||||
try {
|
||||
this.cursor = new Cursor(32, 32, 16, 16, 1, var3, var2);
|
||||
} catch (LWJGLException var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
|
||||
public MouseHelper() {
|
||||
}
|
||||
|
||||
public void grabMouseCursor() {
|
||||
@ -35,7 +16,6 @@ public class MouseHelper {
|
||||
}
|
||||
|
||||
public void ungrabMouseCursor() {
|
||||
Mouse.setCursorPosition(this.windowComponent.getWidth() / 2, this.windowComponent.getHeight() / 2);
|
||||
Mouse.setGrabbed(false);
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,13 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Panel;
|
||||
import java.awt.TextArea;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class PanelCrashReport extends Panel {
|
||||
public class PanelCrashReport {
|
||||
public PanelCrashReport(UnexpectedThrowable var1) {
|
||||
this.setBackground(new Color(3028036));
|
||||
this.setLayout(new BorderLayout());
|
||||
StringWriter var2 = new StringWriter();
|
||||
var1.exception.printStackTrace(new PrintWriter(var2));
|
||||
String var3 = var2.toString();
|
||||
@ -29,7 +21,7 @@ public class PanelCrashReport extends Panel {
|
||||
var5 = var5 + "OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version") + "\n";
|
||||
var5 = var5 + "Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n";
|
||||
var5 = var5 + "VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n";
|
||||
var5 = var5 + "LWJGL: " + Sys.getVersion() + "\n";
|
||||
var5 = var5 + "LWJGL: 3.3.3"+ "\n";
|
||||
var4 = GL11.glGetString(GL11.GL_VENDOR);
|
||||
var5 = var5 + "OpenGL: " + GL11.glGetString(GL11.GL_RENDERER) + " version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR) + "\n";
|
||||
} catch (Throwable var8) {
|
||||
@ -74,12 +66,12 @@ public class PanelCrashReport extends Panel {
|
||||
var6 = var6 + "--- END ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " ----------\n";
|
||||
var6 = var6 + "\n";
|
||||
var6 = var6 + "\n";
|
||||
TextArea var7 = new TextArea(var6, 0, 0, 1);
|
||||
var7.setFont(new Font("Monospaced", 0, 12));
|
||||
this.add(new CanvasMojangLogo(), "North");
|
||||
this.add(new CanvasCrashReport(80), "East");
|
||||
this.add(new CanvasCrashReport(80), "West");
|
||||
this.add(new CanvasCrashReport(100), "South");
|
||||
this.add(var7, "Center");
|
||||
// TextArea var7 = new TextArea(var6, 0, 0, 1);
|
||||
// var7.setFont(new Font("Monospaced", 0, 12));
|
||||
// this.add(new CanvasMojangLogo(), "North");
|
||||
// this.add(new CanvasCrashReport(80), "East");
|
||||
// this.add(new CanvasCrashReport(80), "West");
|
||||
// this.add(new CanvasCrashReport(100), "South");
|
||||
// this.add(var7, "Center");
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.opengl.ARBOcclusionQuery;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
|
||||
public class RenderGlobal implements IWorldAccess {
|
||||
public List tileEntities = new ArrayList();
|
||||
|
@ -2,11 +2,12 @@ package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Random;
|
||||
|
||||
import net.lax1dude.eaglercraft.internal.paulscode.lwjgl3.LibraryLWJGLOpenAL;
|
||||
import paulscode.sound.SoundSystem;
|
||||
import paulscode.sound.SoundSystemConfig;
|
||||
import paulscode.sound.codecs.CodecJOrbis;
|
||||
import paulscode.sound.codecs.CodecWav;
|
||||
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
|
||||
|
||||
public class SoundManager {
|
||||
private static SoundSystem sndSystem;
|
||||
|
@ -1,143 +1,45 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import org.lwjgl.opengl.ARBVertexBufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import net.lax1dude.eaglercraft.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.opengl.WorldVertexBufferUploader;
|
||||
|
||||
public class Tessellator {
|
||||
private static boolean convertQuadsToTriangles = true;
|
||||
private static boolean tryVBO = false;
|
||||
private ByteBuffer byteBuffer;
|
||||
private IntBuffer intBuffer;
|
||||
private FloatBuffer floatBuffer;
|
||||
private int[] rawBuffer;
|
||||
private int vertexCount = 0;
|
||||
private double textureU;
|
||||
private double textureV;
|
||||
private int color;
|
||||
private boolean hasColor = false;
|
||||
|
||||
private net.lax1dude.eaglercraft.opengl.WorldRenderer worldRenderer;
|
||||
public static final Tessellator instance = new Tessellator(2097152);
|
||||
private VertexFormat format;
|
||||
|
||||
private boolean hasTexture = false;
|
||||
private boolean hasNormals = false;
|
||||
private int rawBufferIndex = 0;
|
||||
private int addedVertices = 0;
|
||||
private boolean isColorDisabled = false;
|
||||
private int drawMode;
|
||||
private boolean hasColor = false;
|
||||
private boolean hasNormal = false;
|
||||
|
||||
private double textureU = 0;
|
||||
private double textureV = 0;
|
||||
|
||||
private int colorR;
|
||||
private int colorG;
|
||||
private int colorB;
|
||||
private int colorA;
|
||||
|
||||
private float normalX;
|
||||
private float normalY;
|
||||
private float normalZ;
|
||||
|
||||
private double xOffset;
|
||||
private double yOffset;
|
||||
private double zOffset;
|
||||
private int normal;
|
||||
public static final Tessellator instance = new Tessellator(2097152);
|
||||
private boolean isDrawing = false;
|
||||
private boolean useVBO = false;
|
||||
private IntBuffer vertexBuffers;
|
||||
private int vboIndex = 0;
|
||||
private int vboCount = 10;
|
||||
private int bufferSize;
|
||||
|
||||
private Tessellator(int var1) {
|
||||
this.bufferSize = var1;
|
||||
this.byteBuffer = GLAllocation.createDirectByteBuffer(var1 * 4);
|
||||
this.intBuffer = this.byteBuffer.asIntBuffer();
|
||||
this.floatBuffer = this.byteBuffer.asFloatBuffer();
|
||||
this.rawBuffer = new int[var1];
|
||||
this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
|
||||
if(this.useVBO) {
|
||||
this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount);
|
||||
ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers);
|
||||
}
|
||||
|
||||
this.worldRenderer = new net.lax1dude.eaglercraft.opengl.WorldRenderer(var1);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
if(!this.isDrawing) {
|
||||
throw new IllegalStateException("Not tesselating!");
|
||||
} else {
|
||||
this.isDrawing = false;
|
||||
if(this.vertexCount > 0) {
|
||||
this.intBuffer.clear();
|
||||
this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex);
|
||||
this.byteBuffer.position(0);
|
||||
this.byteBuffer.limit(this.rawBufferIndex * 4);
|
||||
if(this.useVBO) {
|
||||
this.vboIndex = (this.vboIndex + 1) % this.vboCount;
|
||||
ARBVertexBufferObject.glBindBufferARB(GL15.GL_ARRAY_BUFFER, this.vertexBuffers.get(this.vboIndex));
|
||||
ARBVertexBufferObject.glBufferDataARB(GL15.GL_ARRAY_BUFFER, this.byteBuffer, GL15.GL_STREAM_DRAW);
|
||||
}
|
||||
|
||||
if(this.hasTexture) {
|
||||
if(this.useVBO) {
|
||||
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 32, 12L);
|
||||
} else {
|
||||
this.floatBuffer.position(3);
|
||||
GL11.glTexCoordPointer(2, 32, (FloatBuffer)this.floatBuffer);
|
||||
}
|
||||
|
||||
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
if(this.hasColor) {
|
||||
if(this.useVBO) {
|
||||
GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 32, 20L);
|
||||
} else {
|
||||
this.byteBuffer.position(20);
|
||||
GL11.glColorPointer(4, true, 32, this.byteBuffer);
|
||||
}
|
||||
|
||||
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if(this.hasNormals) {
|
||||
if(this.useVBO) {
|
||||
GL11.glNormalPointer(GL11.GL_BYTE, 32, 24L);
|
||||
} else {
|
||||
this.byteBuffer.position(24);
|
||||
GL11.glNormalPointer(32, (ByteBuffer)this.byteBuffer);
|
||||
}
|
||||
|
||||
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
|
||||
if(this.useVBO) {
|
||||
GL11.glVertexPointer(3, GL11.GL_FLOAT, 32, 0L);
|
||||
} else {
|
||||
this.floatBuffer.position(0);
|
||||
GL11.glVertexPointer(3, 32, (FloatBuffer)this.floatBuffer);
|
||||
}
|
||||
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
if(this.drawMode == 7 && convertQuadsToTriangles) {
|
||||
GL11.glDrawArrays(GL11.GL_TRIANGLES, GL11.GL_POINTS, this.vertexCount);
|
||||
} else {
|
||||
GL11.glDrawArrays(this.drawMode, GL11.GL_POINTS, this.vertexCount);
|
||||
}
|
||||
|
||||
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
if(this.hasTexture) {
|
||||
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
if(this.hasColor) {
|
||||
GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if(this.hasNormals) {
|
||||
GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
this.reset();
|
||||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
this.vertexCount = 0;
|
||||
this.byteBuffer.clear();
|
||||
this.rawBufferIndex = 0;
|
||||
this.addedVertices = 0;
|
||||
this.worldRenderer.finishDrawing();
|
||||
WorldVertexBufferUploader.func_181679_a(this.worldRenderer);
|
||||
format = null;
|
||||
hasTexture = false;
|
||||
hasColor = false;
|
||||
hasNormal = false;
|
||||
}
|
||||
|
||||
public void startDrawingQuads() {
|
||||
@ -145,23 +47,18 @@ public class Tessellator {
|
||||
}
|
||||
|
||||
public void startDrawing(int var1) {
|
||||
if(this.isDrawing) {
|
||||
throw new IllegalStateException("Already tesselating!");
|
||||
} else {
|
||||
this.isDrawing = true;
|
||||
this.reset();
|
||||
this.drawMode = var1;
|
||||
this.hasNormals = false;
|
||||
this.hasColor = false;
|
||||
this.hasTexture = false;
|
||||
this.isColorDisabled = false;
|
||||
}
|
||||
this.worldRenderer.begin(var1);
|
||||
}
|
||||
|
||||
public void setTextureUV(double var1, double var3) {
|
||||
this.hasTexture = true;
|
||||
this.textureU = var1;
|
||||
this.textureV = var3;
|
||||
if(this.format == null) {
|
||||
this.format = new VertexFormat(true, false, false, false);
|
||||
} else {
|
||||
this.format = new VertexFormat(true, format.attribColorEnabled, format.attribNormalEnabled, false);
|
||||
}
|
||||
hasTexture = true;
|
||||
textureU = var1;
|
||||
textureV = var3;
|
||||
}
|
||||
|
||||
public void setColorOpaque_F(float var1, float var2, float var3) {
|
||||
@ -177,41 +74,17 @@ public class Tessellator {
|
||||
}
|
||||
|
||||
public void setColorRGBA(int var1, int var2, int var3, int var4) {
|
||||
if(!this.isColorDisabled) {
|
||||
if(var1 > 255) {
|
||||
var1 = 255;
|
||||
if(!this.worldRenderer.needsUpdate) {
|
||||
if(this.format == null) {
|
||||
this.format = new VertexFormat(false, true, false, false);
|
||||
} else {
|
||||
this.format = new VertexFormat(format.attribTextureEnabled, true, format.attribNormalEnabled, false);
|
||||
}
|
||||
|
||||
if(var2 > 255) {
|
||||
var2 = 255;
|
||||
}
|
||||
|
||||
if(var3 > 255) {
|
||||
var3 = 255;
|
||||
}
|
||||
|
||||
if(var4 > 255) {
|
||||
var4 = 255;
|
||||
}
|
||||
|
||||
if(var1 < 0) {
|
||||
var1 = 0;
|
||||
}
|
||||
|
||||
if(var2 < 0) {
|
||||
var2 = 0;
|
||||
}
|
||||
|
||||
if(var3 < 0) {
|
||||
var3 = 0;
|
||||
}
|
||||
|
||||
if(var4 < 0) {
|
||||
var4 = 0;
|
||||
}
|
||||
|
||||
this.hasColor = true;
|
||||
this.color = var4 << 24 | var3 << 16 | var2 << 8 | var1;
|
||||
this.colorR = var1;
|
||||
this.colorG = var2;
|
||||
this.colorB = var3;
|
||||
this.colorA = var4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,50 +94,23 @@ public class Tessellator {
|
||||
}
|
||||
|
||||
public void addVertex(double var1, double var3, double var5) {
|
||||
++this.addedVertices;
|
||||
if(this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0) {
|
||||
for(int var7 = 0; var7 < 2; ++var7) {
|
||||
int var8 = 8 * (3 - var7);
|
||||
if(this.hasTexture) {
|
||||
this.rawBuffer[this.rawBufferIndex + 3] = this.rawBuffer[this.rawBufferIndex - var8 + 3];
|
||||
this.rawBuffer[this.rawBufferIndex + 4] = this.rawBuffer[this.rawBufferIndex - var8 + 4];
|
||||
}
|
||||
worldRenderer.setVertexFormat(format == null ? new VertexFormat(false, false, false, false) : format);
|
||||
|
||||
if(this.hasColor) {
|
||||
this.rawBuffer[this.rawBufferIndex + 5] = this.rawBuffer[this.rawBufferIndex - var8 + 5];
|
||||
}
|
||||
|
||||
this.rawBuffer[this.rawBufferIndex + 0] = this.rawBuffer[this.rawBufferIndex - var8 + 0];
|
||||
this.rawBuffer[this.rawBufferIndex + 1] = this.rawBuffer[this.rawBufferIndex - var8 + 1];
|
||||
this.rawBuffer[this.rawBufferIndex + 2] = this.rawBuffer[this.rawBufferIndex - var8 + 2];
|
||||
++this.vertexCount;
|
||||
this.rawBufferIndex += 8;
|
||||
}
|
||||
}
|
||||
worldRenderer.pos((float)(var1 + this.xOffset), (float)(var3 + this.yOffset), (float)(var5 + this.zOffset));
|
||||
|
||||
if(this.hasTexture) {
|
||||
this.rawBuffer[this.rawBufferIndex + 3] = Float.floatToRawIntBits((float)this.textureU);
|
||||
this.rawBuffer[this.rawBufferIndex + 4] = Float.floatToRawIntBits((float)this.textureV);
|
||||
worldRenderer.tex(this.textureU, this.textureV);
|
||||
}
|
||||
|
||||
if(this.hasColor) {
|
||||
this.rawBuffer[this.rawBufferIndex + 5] = this.color;
|
||||
worldRenderer.setColorRGBA(colorR, colorG, colorB, colorA);
|
||||
}
|
||||
|
||||
if(this.hasNormals) {
|
||||
this.rawBuffer[this.rawBufferIndex + 6] = this.normal;
|
||||
}
|
||||
|
||||
this.rawBuffer[this.rawBufferIndex + 0] = Float.floatToRawIntBits((float)(var1 + this.xOffset));
|
||||
this.rawBuffer[this.rawBufferIndex + 1] = Float.floatToRawIntBits((float)(var3 + this.yOffset));
|
||||
this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(var5 + this.zOffset));
|
||||
this.rawBufferIndex += 8;
|
||||
++this.vertexCount;
|
||||
if(this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) {
|
||||
this.draw();
|
||||
this.isDrawing = true;
|
||||
if(this.hasNormal) {
|
||||
worldRenderer.normal(this.normalX, this.normalY, this.normalZ);
|
||||
}
|
||||
|
||||
worldRenderer.endVertex();
|
||||
}
|
||||
|
||||
public void setColorOpaque_I(int var1) {
|
||||
@ -274,20 +120,27 @@ public class Tessellator {
|
||||
this.setColorOpaque(var2, var3, var4);
|
||||
}
|
||||
|
||||
public void setColorRGBA_I(int var1, int var2) {
|
||||
int var3 = var1 >> 16 & 255;
|
||||
int var4 = var1 >> 8 & 255;
|
||||
int var5 = var1 & 255;
|
||||
this.setColorRGBA(var3, var4, var5, var2);
|
||||
}
|
||||
|
||||
public void disableColor() {
|
||||
this.isColorDisabled = true;
|
||||
worldRenderer.markDirty();
|
||||
}
|
||||
|
||||
public void setNormal(float var1, float var2, float var3) {
|
||||
if(!this.isDrawing) {
|
||||
System.out.println("But..");
|
||||
if(this.format == null) {
|
||||
this.format = new VertexFormat(false, false, true, false);
|
||||
} else {
|
||||
this.format = new VertexFormat(format.attribTextureEnabled, format.attribColorEnabled, true, false);
|
||||
}
|
||||
|
||||
this.hasNormals = true;
|
||||
byte var4 = (byte)((int)(var1 * 128.0F));
|
||||
byte var5 = (byte)((int)(var2 * 127.0F));
|
||||
byte var6 = (byte)((int)(var3 * 127.0F));
|
||||
this.normal = var4 | var5 << 8 | var6 << 16;
|
||||
hasNormal = true;
|
||||
normalX = var1;
|
||||
normalY = var2;
|
||||
normalZ = var3;
|
||||
}
|
||||
|
||||
public void setTranslationD(double var1, double var3, double var5) {
|
||||
@ -301,4 +154,4 @@ public class Tessellator {
|
||||
this.yOffset += (double)var2;
|
||||
this.zOffset += (double)var3;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class ThreadDownloadResources extends Thread {
|
||||
public File resourcesFolder;
|
||||
private Minecraft mc;
|
||||
private boolean closing = false;
|
||||
|
||||
public ThreadDownloadResources(File var1, Minecraft var2) {
|
||||
this.mc = var2;
|
||||
this.setName("Resource download thread");
|
||||
this.setDaemon(true);
|
||||
this.resourcesFolder = new File(var1, "resources/");
|
||||
if(!this.resourcesFolder.exists() && !this.resourcesFolder.mkdirs()) {
|
||||
throw new RuntimeException("The working directory could not be created: " + this.resourcesFolder);
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/");
|
||||
DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder var3 = var2.newDocumentBuilder();
|
||||
Document var4 = var3.parse(var1.openStream());
|
||||
NodeList var5 = var4.getElementsByTagName("Contents");
|
||||
|
||||
for(int var6 = 0; var6 < 2; ++var6) {
|
||||
for(int var7 = 0; var7 < var5.getLength(); ++var7) {
|
||||
Node var8 = var5.item(var7);
|
||||
if(var8.getNodeType() == 1) {
|
||||
Element var9 = (Element)var8;
|
||||
String var10 = ((Element)var9.getElementsByTagName("Key").item(0)).getChildNodes().item(0).getNodeValue();
|
||||
long var11 = Long.parseLong(((Element)var9.getElementsByTagName("Size").item(0)).getChildNodes().item(0).getNodeValue());
|
||||
if(var11 > 0L) {
|
||||
this.downloadAndInstallResource(var1, var10, var11, var6);
|
||||
if(this.closing) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception var13) {
|
||||
this.loadResource(this.resourcesFolder, "");
|
||||
var13.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
this.loadResource(this.resourcesFolder, "");
|
||||
}
|
||||
|
||||
private void loadResource(File var1, String var2) {
|
||||
File[] var3 = var1.listFiles();
|
||||
|
||||
for(int var4 = 0; var4 < var3.length; ++var4) {
|
||||
if(var3[var4].isDirectory()) {
|
||||
this.loadResource(var3[var4], var2 + var3[var4].getName() + "/");
|
||||
} else {
|
||||
try {
|
||||
this.mc.installResource(var2 + var3[var4].getName(), var3[var4]);
|
||||
} catch (Exception var6) {
|
||||
System.out.println("Failed to add " + var2 + var3[var4].getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void downloadAndInstallResource(URL var1, String var2, long var3, int var5) {
|
||||
try {
|
||||
int var6 = var2.indexOf("/");
|
||||
String var7 = var2.substring(0, var6);
|
||||
if(!var7.equals("sound") && !var7.equals("newsound")) {
|
||||
if(var5 != 1) {
|
||||
return;
|
||||
}
|
||||
} else if(var5 != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
File var8 = new File(this.resourcesFolder, var2);
|
||||
if(!var8.exists() || var8.length() != var3) {
|
||||
var8.getParentFile().mkdirs();
|
||||
String var9 = var2.replaceAll(" ", "%20");
|
||||
this.downloadResource(new URL(var1, var9), var8, var3);
|
||||
if(this.closing) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.mc.installResource(var2, var8);
|
||||
} catch (Exception var10) {
|
||||
var10.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void downloadResource(URL var1, File var2, long var3) throws IOException {
|
||||
byte[] var5 = new byte[4096];
|
||||
DataInputStream var6 = new DataInputStream(var1.openStream());
|
||||
DataOutputStream var7 = new DataOutputStream(new FileOutputStream(var2));
|
||||
boolean var8 = false;
|
||||
|
||||
do {
|
||||
int var9 = var6.read(var5);
|
||||
if(var9 < 0) {
|
||||
var6.close();
|
||||
var7.close();
|
||||
return;
|
||||
}
|
||||
|
||||
var7.write(var5, 0, var9);
|
||||
} while(!this.closing);
|
||||
|
||||
}
|
||||
|
||||
public void closeMinecraft() {
|
||||
this.closing = true;
|
||||
}
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@ -43,7 +40,7 @@ public class World implements IBlockAccess {
|
||||
public boolean isNewWorld;
|
||||
protected List worldAccesses;
|
||||
private IChunkProvider chunkProvider;
|
||||
public File saveDirectory;
|
||||
public VFile2 saveDirectory;
|
||||
public long randomSeed;
|
||||
private NBTTagCompound nbtCompoundPlayer;
|
||||
public long sizeOnDisk;
|
||||
@ -55,16 +52,19 @@ public class World implements IBlockAccess {
|
||||
private List entitiesWithinAABBExcludingEntity;
|
||||
public boolean multiplayerWorld;
|
||||
|
||||
public static NBTTagCompound getLevelData(File var0, String var1) {
|
||||
File var2 = new File(var0, "saves");
|
||||
File var3 = new File(var2, var1);
|
||||
public static NBTTagCompound getLevelData(VFile2 var0, String var1) {
|
||||
VFile2 var2 = new VFile2(var0, "saves");
|
||||
VFile2 var3 = new VFile2(var2, var1);
|
||||
if(!var3.exists()) {
|
||||
return null;
|
||||
} else {
|
||||
File var4 = new File(var3, "level.dat");
|
||||
VFile2 var4 = new VFile2(var3, "level.dat");
|
||||
if(var4.exists()) {
|
||||
try {
|
||||
NBTTagCompound var5 = CompressedStreamTools.readCompressed(new FileInputStream(var4));
|
||||
NBTTagCompound var5;
|
||||
try (InputStream is = var4.getInputStream()) {
|
||||
var5 = CompressedStreamTools.readCompressed(is);
|
||||
}
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
return var6;
|
||||
} catch (Exception var7) {
|
||||
@ -76,27 +76,25 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteWorld(File var0, String var1) {
|
||||
File var2 = new File(var0, "saves");
|
||||
File var3 = new File(var2, var1);
|
||||
public static void deleteWorld(VFile2 var0, String var1) {
|
||||
VFile2 var2 = new VFile2(var0, "saves");
|
||||
VFile2 var3 = new VFile2(var2, var1);
|
||||
if(var3.exists()) {
|
||||
deleteWorldFiles(var3.listFiles());
|
||||
deleteWorldFiles((VFile2[]) var3.listFiles(true).toArray());
|
||||
var3.delete();
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteWorldFiles(File[] var0) {
|
||||
private static void deleteWorldFiles(VFile2[] var0) {
|
||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
||||
if(var0[var1].isDirectory()) {
|
||||
deleteWorldFiles(var0[var1].listFiles());
|
||||
}
|
||||
|
||||
// if(var0[var1].isDirectory()) {
|
||||
// deleteWorldFiles((VFile2[]) var0[var1].listFiles(true).toArray());
|
||||
// }
|
||||
var0[var1].delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public World(File var1, String var2) {
|
||||
public World(VFile2 var1, String var2) {
|
||||
this(var1, var2, (new Random()).nextLong());
|
||||
}
|
||||
|
||||
@ -134,7 +132,7 @@ public class World implements IBlockAccess {
|
||||
this.calculateInitialSkylight();
|
||||
}
|
||||
|
||||
public World(File var1, String var2, long var3) {
|
||||
public World(VFile2 var1, String var2, long var3) {
|
||||
this.lightingToUpdate = new ArrayList();
|
||||
this.loadedEntityList = new ArrayList();
|
||||
this.unloadedEntityList = new ArrayList();
|
||||
@ -164,29 +162,19 @@ public class World implements IBlockAccess {
|
||||
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
||||
this.multiplayerWorld = false;
|
||||
this.levelName = var2;
|
||||
var1.mkdirs();
|
||||
this.saveDirectory = new File(var1, var2);
|
||||
this.saveDirectory.mkdirs();
|
||||
//var1.mkdirs();
|
||||
this.saveDirectory = new VFile2(var1, var2);
|
||||
//this.saveDirectory.mkdirs();
|
||||
|
||||
File var5;
|
||||
try {
|
||||
var5 = new File(this.saveDirectory, "session.lock");
|
||||
DataOutputStream var6 = new DataOutputStream(new FileOutputStream(var5));
|
||||
|
||||
try {
|
||||
var6.writeLong(this.lockTimestamp);
|
||||
} finally {
|
||||
var6.close();
|
||||
}
|
||||
} catch (IOException var13) {
|
||||
throw new RuntimeException("Failed to check session lock, aborting");
|
||||
}
|
||||
|
||||
var5 = new File(this.saveDirectory, "level.dat");
|
||||
VFile2 var5;
|
||||
var5 = new VFile2(this.saveDirectory, "level.dat");
|
||||
this.isNewWorld = !var5.exists();
|
||||
if(var5.exists()) {
|
||||
try {
|
||||
NBTTagCompound var14 = CompressedStreamTools.readCompressed(new FileInputStream(var5));
|
||||
NBTTagCompound var14;
|
||||
try (InputStream is = var5.getInputStream()) {
|
||||
var14 = CompressedStreamTools.readCompressed(is);
|
||||
}
|
||||
NBTTagCompound var7 = var14.getCompoundTag("Data");
|
||||
this.randomSeed = var7.getLong("RandomSeed");
|
||||
this.spawnX = var7.getInteger("SpawnX");
|
||||
@ -227,7 +215,7 @@ public class World implements IBlockAccess {
|
||||
this.calculateInitialSkylight();
|
||||
}
|
||||
|
||||
protected IChunkProvider getChunkProvider(File var1) {
|
||||
protected IChunkProvider getChunkProvider(VFile2 var1) {
|
||||
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1, true), new ChunkProviderGenerate(this, this.randomSeed));
|
||||
}
|
||||
|
||||
@ -312,10 +300,10 @@ public class World implements IBlockAccess {
|
||||
var3.setTag("Data", var1);
|
||||
|
||||
try {
|
||||
File var4 = new File(this.saveDirectory, "level.dat_new");
|
||||
File var5 = new File(this.saveDirectory, "level.dat_old");
|
||||
File var6 = new File(this.saveDirectory, "level.dat");
|
||||
CompressedStreamTools.writeCompressed(var3, new FileOutputStream(var4));
|
||||
VFile2 var4 = new VFile2(this.saveDirectory, "level.dat_new");
|
||||
VFile2 var5 = new VFile2(this.saveDirectory, "level.dat_old");
|
||||
VFile2 var6 = new VFile2(this.saveDirectory, "level.dat");
|
||||
CompressedStreamTools.writeCompressed(var3, var4.getOutputStream());
|
||||
if(var5.exists()) {
|
||||
var5.delete();
|
||||
}
|
||||
@ -1885,21 +1873,21 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void checkSessionLock() {
|
||||
try {
|
||||
File var1 = new File(this.saveDirectory, "session.lock");
|
||||
DataInputStream var2 = new DataInputStream(new FileInputStream(var1));
|
||||
|
||||
try {
|
||||
if(var2.readLong() != this.lockTimestamp) {
|
||||
throw new MinecraftException("The save is being accessed from another location, aborting");
|
||||
}
|
||||
} finally {
|
||||
var2.close();
|
||||
}
|
||||
|
||||
} catch (IOException var7) {
|
||||
throw new MinecraftException("Failed to check session lock, aborting");
|
||||
}
|
||||
// try {
|
||||
// VFile2 var1 = new VFile2(this.saveDirectory, "session.lock");
|
||||
// DataInputStream var2 = new DataInputStream(new FileInputStream(var1));
|
||||
//
|
||||
// try {
|
||||
// if(var2.readLong() != this.lockTimestamp) {
|
||||
// throw new MinecraftException("The save is being accessed from another location, aborting");
|
||||
// }
|
||||
// } finally {
|
||||
// var2.close();
|
||||
// }
|
||||
//
|
||||
// } catch (IOException var7) {
|
||||
// throw new MinecraftException("Failed to check session lock, aborting");
|
||||
// }
|
||||
}
|
||||
|
||||
public void setWorldTime(long var1) {
|
||||
|
@ -1,16 +1,16 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import net.lax1dude.eaglercraft.internal.vfs2.VFile2;
|
||||
|
||||
class WorldIso extends World {
|
||||
final CanvasIsomPreview isomPreview;
|
||||
|
||||
WorldIso(CanvasIsomPreview var1, File var2, String var3) {
|
||||
WorldIso(CanvasIsomPreview var1, VFile2 var2, String var3) {
|
||||
super(var2, var3);
|
||||
this.isomPreview = var1;
|
||||
}
|
||||
|
||||
protected IChunkProvider getChunkProvider(File var1) {
|
||||
protected IChunkProvider getChunkProvider(VFile2 var1) {
|
||||
return new ChunkProviderIso(this, new ChunkLoader(var1, false));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lax1dude.eaglercraft.internal;
|
||||
|
||||
import net.minecraft.src.EnumOS1;
|
||||
import net.minecraft.src.EnumOS;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
||||
@ -19,13 +19,13 @@ import net.minecraft.src.EnumOS1;
|
||||
*
|
||||
*/
|
||||
public enum EnumPlatformOS {
|
||||
WINDOWS("Windows", EnumOS1.windows), MACOS("MacOS", EnumOS1.macos), LINUX("Linux", EnumOS1.linux),
|
||||
CHROMEBOOK_LINUX("ChromeOS", EnumOS1.linux), OTHER("Unknown", EnumOS1.unknown);
|
||||
WINDOWS("Windows", EnumOS.windows), MACOS("MacOS", EnumOS.macos), LINUX("Linux", EnumOS.linux),
|
||||
CHROMEBOOK_LINUX("ChromeOS", EnumOS.linux), OTHER("Unknown", EnumOS.unknown);
|
||||
|
||||
private final String name;
|
||||
private final EnumOS1 minecraftEnum;
|
||||
private final EnumOS minecraftEnum;
|
||||
|
||||
private EnumPlatformOS(String name, EnumOS1 minecraftEnum) {
|
||||
private EnumPlatformOS(String name, EnumOS minecraftEnum) {
|
||||
this.name = name;
|
||||
this.minecraftEnum = minecraftEnum;
|
||||
}
|
||||
@ -34,7 +34,7 @@ public enum EnumPlatformOS {
|
||||
return name;
|
||||
}
|
||||
|
||||
public EnumOS1 getMinecraftEnum() {
|
||||
public EnumOS getMinecraftEnum() {
|
||||
return minecraftEnum;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class EaglerProfile {
|
||||
profile.setString("username", username);
|
||||
EaglerOutputStream bao = new EaglerOutputStream();
|
||||
try {
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(profile, bao);
|
||||
CompressedStreamTools.writeCompressed(profile, bao);
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user