mirror of
https://github.com/catfoolyou/Beta-1.4_01.git
synced 2025-06-02 03:10:57 -05:00
68 errors
This commit is contained in:
parent
f0c9d758c6
commit
5c0fd89ae2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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>
|
||||
|
@ -60,180 +60,180 @@ public class EaglerCloudRenderer {
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
public void renderClouds(float partialTicks, int pass) {
|
||||
if (mc.theWorld.worldProvider.field_4220_c) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.mc.gameSettings.fancyGraphics) {
|
||||
pass = 2;
|
||||
}
|
||||
|
||||
int c = mc.gameSettings.shouldRenderClouds();
|
||||
if(c == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int newState;
|
||||
Entity rve = this.mc.thePlayer;
|
||||
float f = (float) (rve.lastTickPosY + (rve.posY - rve.lastTickPosY) * (double) partialTicks);
|
||||
float f3 = 128.0F - f + 0.33F;
|
||||
if(c == 2) {
|
||||
if (f3 > -5.0F) {
|
||||
if (f3 <= 5.0F) {
|
||||
newState = RENDER_STATE_FANCY_INSIDE;
|
||||
}else {
|
||||
newState = RENDER_STATE_FANCY_ABOVE;
|
||||
}
|
||||
}else {
|
||||
newState = RENDER_STATE_FANCY_BELOW;
|
||||
}
|
||||
}else {
|
||||
newState = RENDER_STATE_FAST;
|
||||
}
|
||||
|
||||
if(newState != currentRenderState) {
|
||||
rebuild(newState);
|
||||
currentRenderState = newState;
|
||||
}
|
||||
|
||||
locationCloudsPNG.bindTexture();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
Vec3D_112 vec3 = getWorldCloudColour(mc.theWorld, partialTicks);
|
||||
float _f1 = (float) vec3.xCoord;
|
||||
float _f2 = (float) vec3.yCoord;
|
||||
float _f3 = (float) vec3.zCoord;
|
||||
if (pass != 2) {
|
||||
float _f4 = (_f1 * 30.0F + _f2 * 59.0F + _f3 * 11.0F) / 100.0F;
|
||||
float _f5 = (_f1 * 30.0F + _f2 * 70.0F) / 100.0F;
|
||||
float _f6 = (_f1 * 30.0F + _f3 * 70.0F) / 100.0F;
|
||||
_f1 = _f4;
|
||||
_f2 = _f5;
|
||||
_f3 = _f6;
|
||||
}
|
||||
|
||||
if(newState != RENDER_STATE_FAST) {
|
||||
GlStateManager.enableCull();
|
||||
double d0 = this.mc.renderGlobal.getCloudCounter(partialTicks);
|
||||
double d1 = (rve.prevPosX + (rve.posX - rve.prevPosX) * (double) partialTicks + d0 * 0.029999999329447746D) / 12.0D;
|
||||
double d2 = (rve.prevPosZ + (rve.posZ - rve.prevPosZ) * (double) partialTicks) / 12.0D + 0.33000001311302185D;
|
||||
int i = MathHelper.floor_double(d1 / 2048.0D);
|
||||
int j = MathHelper.floor_double(d2 / 2048.0D);
|
||||
d1 = d1 - (double) (i * 2048);
|
||||
d2 = d2 - (double) (j * 2048);
|
||||
float f17 = (float) MathHelper.floor_double(d1) * 0.00390625F;
|
||||
float f18 = (float) MathHelper.floor_double(d2) * 0.00390625F;
|
||||
float f19 = (float) (d1 - (double) MathHelper.floor_double(d1));
|
||||
float f20 = (float) (d2 - (double) MathHelper.floor_double(d2));
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(12.0F, 1.0F, 12.0F);
|
||||
|
||||
Matrix4f.mul(GlStateManager.getProjectionReference(), GlStateManager.getModelViewReference(), fancyCloudProjView);
|
||||
frustum.set(fancyCloudProjView);
|
||||
|
||||
visibleCloudParts.clear();
|
||||
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
if (k == 0) {
|
||||
GlStateManager.colorMask(false, false, false, false);
|
||||
} else {
|
||||
switch (pass) {
|
||||
case 0:
|
||||
GlStateManager.colorMask(false, true, true, true);
|
||||
break;
|
||||
case 1:
|
||||
GlStateManager.colorMask(true, false, false, true);
|
||||
break;
|
||||
case 2:
|
||||
GlStateManager.colorMask(true, true, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
int j1;
|
||||
for (int l = -3; l <= 3; ++l) {
|
||||
for (int i1 = -3; i1 <= 3; ++i1) {
|
||||
float f22 = (float) (l * 8);
|
||||
float f23 = (float) (i1 * 8);
|
||||
float f24 = f22 - f19;
|
||||
float f25 = f23 - f20;
|
||||
|
||||
j1 = (l + 3) * 7 + i1 + 3;
|
||||
if(k == 0) {
|
||||
if(frustum.testAab(f24, f3, f25, (f24 + 8.0f), f3 + 4.0f, (f25 + 8.0f))) {
|
||||
visibleCloudParts.set(j1);
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
if(!visibleCloudParts.get(j1)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(f24, f3, f25);
|
||||
if(k != 0) {
|
||||
GlStateManager.color(_f1, _f2, _f3, 0.8f);
|
||||
}
|
||||
GlStateManager.matrixMode(GL_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(f22 * 0.00390625F + f17, f23 * 0.00390625F + f18, 0.0f);
|
||||
|
||||
int xx = 0;
|
||||
int yy = 0;
|
||||
if (l <= -1) {
|
||||
xx = -1;
|
||||
}else if (l >= 1) {
|
||||
xx = 1;
|
||||
}
|
||||
|
||||
if (i1 <= -1) {
|
||||
yy = -1;
|
||||
}else if (i1 >= 1) {
|
||||
yy = 1;
|
||||
}
|
||||
|
||||
GlStateManager.callList(renderListFancy[(yy + 1) * 3 + xx + 1]);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}else {
|
||||
GlStateManager.disableCull();
|
||||
double d2 = this.mc.renderGlobal.getCloudCounter(partialTicks);
|
||||
double d0 = rve.prevPosX + (rve.posX - rve.prevPosX) * (double) partialTicks + d2 * 0.029999999329447746D;
|
||||
double d1 = rve.prevPosZ + (rve.posZ - rve.prevPosZ) * (double) partialTicks;
|
||||
int i = MathHelper.floor_double(d0 / 2048.0D);
|
||||
int j = MathHelper.floor_double(d1 / 2048.0D);
|
||||
d0 = d0 - (double) (i * 2048);
|
||||
d1 = d1 - (double) (j * 2048);
|
||||
float f8 = (float) (d0 * 4.8828125E-4D);
|
||||
float f9 = (float) (d1 * 4.8828125E-4D);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.0f, f3, 0.0f);
|
||||
GlStateManager.color(_f1, _f2, _f3, 0.8f);
|
||||
GlStateManager.matrixMode(GL_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(f8, f9, 0.0f);
|
||||
GlStateManager.callList(renderList);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableCull();
|
||||
}
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
// public void renderClouds(float partialTicks, int pass) {
|
||||
// if (mc.theWorld.worldProvider.field_4220_c) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if(this.mc.gameSettings.fancyGraphics) {
|
||||
// pass = 2;
|
||||
// }
|
||||
//
|
||||
// int c = mc.gameSettings.shouldRenderClouds();
|
||||
// if(c == 0) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// int newState;
|
||||
// Entity rve = this.mc.thePlayer;
|
||||
// float f = (float) (rve.lastTickPosY + (rve.posY - rve.lastTickPosY) * (double) partialTicks);
|
||||
// float f3 = 128.0F - f + 0.33F;
|
||||
// if(c == 2) {
|
||||
// if (f3 > -5.0F) {
|
||||
// if (f3 <= 5.0F) {
|
||||
// newState = RENDER_STATE_FANCY_INSIDE;
|
||||
// }else {
|
||||
// newState = RENDER_STATE_FANCY_ABOVE;
|
||||
// }
|
||||
// }else {
|
||||
// newState = RENDER_STATE_FANCY_BELOW;
|
||||
// }
|
||||
// }else {
|
||||
// newState = RENDER_STATE_FAST;
|
||||
// }
|
||||
//
|
||||
// if(newState != currentRenderState) {
|
||||
// rebuild(newState);
|
||||
// currentRenderState = newState;
|
||||
// }
|
||||
//
|
||||
// locationCloudsPNG.bindTexture();
|
||||
//
|
||||
// GlStateManager.enableBlend();
|
||||
// GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
//
|
||||
// Vec3D_112 vec3 = getWorldCloudColour(mc.theWorld, partialTicks);
|
||||
// float _f1 = (float) vec3.xCoord;
|
||||
// float _f2 = (float) vec3.yCoord;
|
||||
// float _f3 = (float) vec3.zCoord;
|
||||
// if (pass != 2) {
|
||||
// float _f4 = (_f1 * 30.0F + _f2 * 59.0F + _f3 * 11.0F) / 100.0F;
|
||||
// float _f5 = (_f1 * 30.0F + _f2 * 70.0F) / 100.0F;
|
||||
// float _f6 = (_f1 * 30.0F + _f3 * 70.0F) / 100.0F;
|
||||
// _f1 = _f4;
|
||||
// _f2 = _f5;
|
||||
// _f3 = _f6;
|
||||
// }
|
||||
//
|
||||
// if(newState != RENDER_STATE_FAST) {
|
||||
// GlStateManager.enableCull();
|
||||
// double d0 = this.mc.renderGlobal.getCloudCounter(partialTicks);
|
||||
// double d1 = (rve.prevPosX + (rve.posX - rve.prevPosX) * (double) partialTicks + d0 * 0.029999999329447746D) / 12.0D;
|
||||
// double d2 = (rve.prevPosZ + (rve.posZ - rve.prevPosZ) * (double) partialTicks) / 12.0D + 0.33000001311302185D;
|
||||
// int i = MathHelper.floor_double(d1 / 2048.0D);
|
||||
// int j = MathHelper.floor_double(d2 / 2048.0D);
|
||||
// d1 = d1 - (double) (i * 2048);
|
||||
// d2 = d2 - (double) (j * 2048);
|
||||
// float f17 = (float) MathHelper.floor_double(d1) * 0.00390625F;
|
||||
// float f18 = (float) MathHelper.floor_double(d2) * 0.00390625F;
|
||||
// float f19 = (float) (d1 - (double) MathHelper.floor_double(d1));
|
||||
// float f20 = (float) (d2 - (double) MathHelper.floor_double(d2));
|
||||
//
|
||||
// GlStateManager.pushMatrix();
|
||||
// GlStateManager.scale(12.0F, 1.0F, 12.0F);
|
||||
//
|
||||
// Matrix4f.mul(GlStateManager.getProjectionReference(), GlStateManager.getModelViewReference(), fancyCloudProjView);
|
||||
// frustum.set(fancyCloudProjView);
|
||||
//
|
||||
// visibleCloudParts.clear();
|
||||
//
|
||||
// for (int k = 0; k < 2; ++k) {
|
||||
// if (k == 0) {
|
||||
// GlStateManager.colorMask(false, false, false, false);
|
||||
// } else {
|
||||
// switch (pass) {
|
||||
// case 0:
|
||||
// GlStateManager.colorMask(false, true, true, true);
|
||||
// break;
|
||||
// case 1:
|
||||
// GlStateManager.colorMask(true, false, false, true);
|
||||
// break;
|
||||
// case 2:
|
||||
// GlStateManager.colorMask(true, true, true, true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// int j1;
|
||||
// for (int l = -3; l <= 3; ++l) {
|
||||
// for (int i1 = -3; i1 <= 3; ++i1) {
|
||||
// float f22 = (float) (l * 8);
|
||||
// float f23 = (float) (i1 * 8);
|
||||
// float f24 = f22 - f19;
|
||||
// float f25 = f23 - f20;
|
||||
//
|
||||
// j1 = (l + 3) * 7 + i1 + 3;
|
||||
// if(k == 0) {
|
||||
// if(frustum.testAab(f24, f3, f25, (f24 + 8.0f), f3 + 4.0f, (f25 + 8.0f))) {
|
||||
// visibleCloudParts.set(j1);
|
||||
// }else {
|
||||
// continue;
|
||||
// }
|
||||
// }else {
|
||||
// if(!visibleCloudParts.get(j1)) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// GlStateManager.pushMatrix();
|
||||
// GlStateManager.translate(f24, f3, f25);
|
||||
// if(k != 0) {
|
||||
// GlStateManager.color(_f1, _f2, _f3, 0.8f);
|
||||
// }
|
||||
// GlStateManager.matrixMode(GL_TEXTURE);
|
||||
// GlStateManager.pushMatrix();
|
||||
// GlStateManager.translate(f22 * 0.00390625F + f17, f23 * 0.00390625F + f18, 0.0f);
|
||||
//
|
||||
// int xx = 0;
|
||||
// int yy = 0;
|
||||
// if (l <= -1) {
|
||||
// xx = -1;
|
||||
// }else if (l >= 1) {
|
||||
// xx = 1;
|
||||
// }
|
||||
//
|
||||
// if (i1 <= -1) {
|
||||
// yy = -1;
|
||||
// }else if (i1 >= 1) {
|
||||
// yy = 1;
|
||||
// }
|
||||
//
|
||||
// GlStateManager.callList(renderListFancy[(yy + 1) * 3 + xx + 1]);
|
||||
//
|
||||
// GlStateManager.popMatrix();
|
||||
// GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
// GlStateManager.popMatrix();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// GlStateManager.popMatrix();
|
||||
// }else {
|
||||
// GlStateManager.disableCull();
|
||||
// double d2 = this.mc.renderGlobal.getCloudCounter(partialTicks);
|
||||
// double d0 = rve.prevPosX + (rve.posX - rve.prevPosX) * (double) partialTicks + d2 * 0.029999999329447746D;
|
||||
// double d1 = rve.prevPosZ + (rve.posZ - rve.prevPosZ) * (double) partialTicks;
|
||||
// int i = MathHelper.floor_double(d0 / 2048.0D);
|
||||
// int j = MathHelper.floor_double(d1 / 2048.0D);
|
||||
// d0 = d0 - (double) (i * 2048);
|
||||
// d1 = d1 - (double) (j * 2048);
|
||||
// float f8 = (float) (d0 * 4.8828125E-4D);
|
||||
// float f9 = (float) (d1 * 4.8828125E-4D);
|
||||
// GlStateManager.pushMatrix();
|
||||
// GlStateManager.translate(0.0f, f3, 0.0f);
|
||||
// GlStateManager.color(_f1, _f2, _f3, 0.8f);
|
||||
// GlStateManager.matrixMode(GL_TEXTURE);
|
||||
// GlStateManager.pushMatrix();
|
||||
// GlStateManager.translate(f8, f9, 0.0f);
|
||||
// GlStateManager.callList(renderList);
|
||||
// GlStateManager.popMatrix();
|
||||
// GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
// GlStateManager.popMatrix();
|
||||
// GlStateManager.enableCull();
|
||||
// }
|
||||
//
|
||||
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// GlStateManager.disableBlend();
|
||||
// }
|
||||
|
||||
private VertexFormat texColorFormat = new VertexFormat(true, true, false, false);
|
||||
private VertexFormat texFormat = new VertexFormat(true, false, false, false);
|
||||
|
@ -37,7 +37,7 @@ public class EaglerProfile {
|
||||
username = str;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc != null && mc.session != null) {
|
||||
mc.session.playerName = str;
|
||||
mc.session.username = str;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,6 @@ import net.minecraft.src.TexturePortalFX;
|
||||
import net.minecraft.src.TextureWatchFX;
|
||||
import net.minecraft.src.TextureWaterFX;
|
||||
import net.minecraft.src.TexureWaterFlowFX;
|
||||
import net.minecraft.src.ThreadDownloadResources;
|
||||
import net.minecraft.src.Timer;
|
||||
import net.minecraft.src.UnexpectedThrowable;
|
||||
import net.minecraft.src.Vec3D;
|
||||
@ -108,7 +107,6 @@ public class Minecraft {
|
||||
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;
|
||||
public GuiAchievement field_25002_t = new GuiAchievement(this);
|
||||
@ -144,6 +142,10 @@ public class Minecraft {
|
||||
private boolean isShuttingDown = false;
|
||||
private static int debugFPS;
|
||||
|
||||
public static Minecraft getMinecraft() {
|
||||
return theMinecraft;
|
||||
}
|
||||
|
||||
public Minecraft() {
|
||||
this.displayWidth = Display.getWidth();
|
||||
this.displayHeight = Display.getHeight();
|
||||
@ -153,8 +155,6 @@ public class Minecraft {
|
||||
theMinecraft = this;
|
||||
}
|
||||
|
||||
public abstract void displayUnexpectedThrowable(UnexpectedThrowable var1);
|
||||
|
||||
public void setServer(String var1, int var2) {
|
||||
this.serverName = var1;
|
||||
this.serverPort = var2;
|
||||
@ -412,8 +412,7 @@ public class Minecraft {
|
||||
this.startGame();
|
||||
} catch (Exception var15) {
|
||||
var15.printStackTrace();
|
||||
this.displayUnexpectedThrowable(new UnexpectedThrowable("Failed to start game", var15));
|
||||
return;
|
||||
throw new RuntimeException("Failed to start game", var15);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -503,7 +502,7 @@ public class Minecraft {
|
||||
} catch (Throwable var17) {
|
||||
this.theWorld = null;
|
||||
var17.printStackTrace();
|
||||
this.displayUnexpectedThrowable(new UnexpectedThrowable("Unexpected error", var17));
|
||||
throw new RuntimeException("Unexpected error", var17);
|
||||
} finally {
|
||||
this.shutdownMinecraftApplet();
|
||||
}
|
||||
@ -979,7 +978,6 @@ public class Minecraft {
|
||||
System.out.println("FORCING RELOAD!");
|
||||
this.sndManager = new SoundManager();
|
||||
this.sndManager.loadSoundSettings(this.gameSettings);
|
||||
this.downloadResourcesThread.reloadResources();
|
||||
}
|
||||
|
||||
public boolean isMultiplayerWorld() {
|
||||
@ -1057,7 +1055,7 @@ public class Minecraft {
|
||||
this.renderViewEntity = null;
|
||||
this.loadingScreen.printText(var2);
|
||||
this.loadingScreen.displayLoadingString("");
|
||||
this.sndManager.playStreaming((String)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.sndManager.playSound((String)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
if(this.theWorld != null) {
|
||||
this.theWorld.func_651_a(this.loadingScreen);
|
||||
}
|
||||
@ -1163,24 +1161,6 @@ public class Minecraft {
|
||||
this.theWorld.func_656_j();
|
||||
}
|
||||
|
||||
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 func_6251_l() {
|
||||
return this.glCapabilities;
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import paulscode.sound.codecs.CodecJOrbis;
|
||||
|
||||
public class CodecMus extends CodecJOrbis {
|
||||
protected InputStream openInputStream() throws IOException {
|
||||
return new MusInputStream(this, this.url, this.urlConnection.getInputStream());
|
||||
}
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public class MathHelper {
|
||||
private static float[] SIN_TABLE = new float[65536];
|
||||
private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION;
|
||||
public static final float SQRT_2 = sqrt_float(2.0F);
|
||||
private static float[] SIN_TABLE = new float[4096];
|
||||
|
||||
public static final float sin(float var0) {
|
||||
return SIN_TABLE[(int)(var0 * 10430.378F) & '\uffff'];
|
||||
return SIN_TABLE[(int)(var0 * 651.8986F) & 4095];
|
||||
}
|
||||
|
||||
public static final float cos(float var0) {
|
||||
return SIN_TABLE[(int)(var0 * 10430.378F + 16384.0F) & '\uffff'];
|
||||
return SIN_TABLE[(int)((var0 + ((float)Math.PI / 2F)) * 651.8986F) & 4095];
|
||||
}
|
||||
|
||||
public static final float sqrt_float(float var0) {
|
||||
@ -33,6 +35,10 @@ public class MathHelper {
|
||||
return var0 >= 0.0F ? var0 : -var0;
|
||||
}
|
||||
|
||||
public static int abs(int var0) {
|
||||
return var0 >= 0 ? var0 : -var0;
|
||||
}
|
||||
|
||||
public static double abs_max(double var0, double var2) {
|
||||
if(var0 < 0.0D) {
|
||||
var0 = -var0;
|
||||
@ -53,10 +59,55 @@ public class MathHelper {
|
||||
return var0 == null || var0.length() == 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 log2(int value) {
|
||||
return log2DeBruijn(value) - (isPowerOfTwo(value) ? 0 : 1);
|
||||
}
|
||||
|
||||
public static int clamp(int num, int min, int max) {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return num > max ? max : num;
|
||||
}
|
||||
}
|
||||
|
||||
public static float clamp(float num, float min, float max) {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return num > max ? max : num;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
for(int var0 = 0; var0 < 65536; ++var0) {
|
||||
SIN_TABLE[var0] = (float)Math.sin((double)var0 * Math.PI * 2.0D / 65536.0D);
|
||||
for (int j = 0; j < 4096; ++j) {
|
||||
SIN_TABLE[j] = (float)Math.sin((double)(((float)j + 0.5F) / 4096.0F * ((float)Math.PI * 2F)));
|
||||
}
|
||||
|
||||
for (int l = 0; l < 360; l += 90) {
|
||||
SIN_TABLE[(int)((float)l * 11.377778F) & 4095] = (float)Math.sin((double)((float)l * 0.017453292F));
|
||||
}
|
||||
|
||||
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,37 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
class MusInputStream extends InputStream {
|
||||
private int hash;
|
||||
private InputStream inputStream;
|
||||
byte[] buffer;
|
||||
final CodecMus codec;
|
||||
|
||||
public MusInputStream(CodecMus var1, URL var2, InputStream var3) {
|
||||
this.codec = var1;
|
||||
this.buffer = new byte[1];
|
||||
this.inputStream = var3;
|
||||
String var4 = var2.getPath();
|
||||
var4 = var4.substring(var4.lastIndexOf("/") + 1);
|
||||
this.hash = var4.hashCode();
|
||||
}
|
||||
|
||||
public int read() throws IOException {
|
||||
int var1 = this.read(this.buffer, 0, 1);
|
||||
return var1 < 0 ? var1 : this.buffer[0];
|
||||
}
|
||||
|
||||
public int read(byte[] var1, int var2, int var3) throws IOException {
|
||||
var3 = this.inputStream.read(var1, var2, var3);
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
byte var5 = var1[var2 + var4] = (byte)(var1[var2 + var4] ^ this.hash >> 8);
|
||||
this.hash = this.hash * 498729871 + 85731 * var5;
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
@ -130,6 +130,10 @@ public class NBTTagCompound extends NBTBase {
|
||||
return this.getByte(var1) != 0;
|
||||
}
|
||||
|
||||
public boolean hasNoTags() {
|
||||
return this.tagMap.isEmpty();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + this.tagMap.size() + " entries";
|
||||
}
|
||||
|
@ -1,196 +1,195 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Random;
|
||||
import paulscode.sound.SoundSystem;
|
||||
import paulscode.sound.SoundSystemConfig;
|
||||
import paulscode.sound.codecs.CodecJOrbis;
|
||||
import paulscode.sound.codecs.CodecWav;
|
||||
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.lax1dude.eaglercraft.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.EaglerInputStream;
|
||||
import net.lax1dude.eaglercraft.Random;
|
||||
import net.lax1dude.eaglercraft.internal.EnumPlatformType;
|
||||
import net.lax1dude.eaglercraft.internal.IAudioCacheLoader;
|
||||
import net.lax1dude.eaglercraft.internal.IAudioHandle;
|
||||
import net.lax1dude.eaglercraft.internal.IAudioResource;
|
||||
import net.lax1dude.eaglercraft.internal.PlatformAudio;
|
||||
import net.peyton.eagler.minecraft.AudioUtils;
|
||||
|
||||
public class SoundManager {
|
||||
private static SoundSystem sndSystem;
|
||||
private SoundPool soundPoolSounds = new SoundPool();
|
||||
private SoundPool soundPoolStreaming = new SoundPool();
|
||||
private SoundPool soundPoolMusic = new SoundPool();
|
||||
private int field_587_e = 0;
|
||||
private GameSettings options;
|
||||
private static boolean loaded = false;
|
||||
private Random rand = new Random();
|
||||
private int ticksBeforeMusic = this.rand.nextInt(12000);
|
||||
|
||||
private Map<String, IAudioResource> sounds = new HashMap<String, IAudioResource>();
|
||||
private Map<String, IAudioResource> music = new HashMap<String, IAudioResource>();
|
||||
|
||||
private IAudioHandle musicHandle;
|
||||
|
||||
private String[] newMusic = new String[]{"hal1.ogg", "hal2.ogg", "hal3.ogg", "hal4.ogg", "nuance1.ogg", "nuance2.ogg", "piano1.ogg", "piano2.ogg", "piano3.ogg"};
|
||||
|
||||
public void loadSoundSettings(GameSettings var1) {
|
||||
this.soundPoolStreaming.field_1657_b = false;
|
||||
this.options = var1;
|
||||
if(!loaded && (var1 == null || var1.soundVolume != 0.0F || var1.musicVolume != 0.0F)) {
|
||||
this.tryToSetLibraryAndCodecs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void tryToSetLibraryAndCodecs() {
|
||||
try {
|
||||
float var1 = this.options.soundVolume;
|
||||
float var2 = this.options.musicVolume;
|
||||
this.options.soundVolume = 0.0F;
|
||||
this.options.musicVolume = 0.0F;
|
||||
this.options.saveOptions();
|
||||
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
|
||||
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
|
||||
SoundSystemConfig.setCodec("mus", CodecMus.class);
|
||||
SoundSystemConfig.setCodec("wav", CodecWav.class);
|
||||
sndSystem = new SoundSystem();
|
||||
this.options.soundVolume = var1;
|
||||
this.options.musicVolume = var2;
|
||||
this.options.saveOptions();
|
||||
} catch (Throwable var3) {
|
||||
var3.printStackTrace();
|
||||
System.err.println("error linking with the LibraryJavaSound plug-in");
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
public void onSoundOptionsChanged() {
|
||||
if(!loaded && (this.options.soundVolume != 0.0F || this.options.musicVolume != 0.0F)) {
|
||||
this.tryToSetLibraryAndCodecs();
|
||||
}
|
||||
|
||||
if(loaded) {
|
||||
if(this.options.musicVolume == 0.0F) {
|
||||
sndSystem.stop("BgMusic");
|
||||
} else {
|
||||
sndSystem.setVolume("BgMusic", this.options.musicVolume);
|
||||
if(this.options.musicVolume == 0.0F) {
|
||||
if(this.musicHandle != null && !this.musicHandle.shouldFree()) {
|
||||
musicHandle.end();
|
||||
}
|
||||
} else {
|
||||
if(this.musicHandle != null && !this.musicHandle.shouldFree()) {
|
||||
musicHandle.gain(this.options.musicVolume);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void closeMinecraft() {
|
||||
if(loaded) {
|
||||
sndSystem.cleanup();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addSound(String var1, File var2) {
|
||||
this.soundPoolSounds.addSound(var1, var2);
|
||||
}
|
||||
|
||||
public void addStreaming(String var1, File var2) {
|
||||
this.soundPoolStreaming.addSound(var1, var2);
|
||||
}
|
||||
|
||||
public void addMusic(String var1, File var2) {
|
||||
this.soundPoolMusic.addSound(var1, var2);
|
||||
}
|
||||
|
||||
public void playRandomMusicIfReady() {
|
||||
if(loaded && this.options.musicVolume != 0.0F) {
|
||||
if(!sndSystem.playing("BgMusic") && !sndSystem.playing("streaming")) {
|
||||
if(this.options.musicVolume != 0.0F) {
|
||||
if(this.musicHandle == null || this.musicHandle.shouldFree()) {
|
||||
if(this.ticksBeforeMusic > 0) {
|
||||
--this.ticksBeforeMusic;
|
||||
return;
|
||||
}
|
||||
|
||||
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
|
||||
if(var1 != null) {
|
||||
this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
|
||||
sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
|
||||
sndSystem.setVolume("BgMusic", this.options.musicVolume);
|
||||
sndSystem.play("BgMusic");
|
||||
}
|
||||
}
|
||||
int var1 = rand.nextInt(newMusic.length);
|
||||
this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
|
||||
String name = "/newmusic/" + newMusic[var1];
|
||||
|
||||
IAudioResource trk;
|
||||
if (!music.containsKey(name)) {
|
||||
if (EagRuntime.getPlatformType() != EnumPlatformType.DESKTOP) {
|
||||
trk = PlatformAudio.loadAudioDataNew(name, false, browserResourceLoader);
|
||||
} else {
|
||||
trk = PlatformAudio.loadAudioData(name, false);
|
||||
}
|
||||
if (trk != null) {
|
||||
music.put(name, trk);
|
||||
}
|
||||
} else {
|
||||
trk = music.get(name);
|
||||
}
|
||||
|
||||
musicHandle = PlatformAudio.beginPlaybackStatic(trk, this.options.musicVolume, 1.0f, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_338_a(EntityLiving var1, float var2) {
|
||||
if(loaded && this.options.soundVolume != 0.0F) {
|
||||
if(var1 != null) {
|
||||
if (var1 != null && this.options.soundVolume != 0.0F) {
|
||||
try {
|
||||
float var9 = var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var2;
|
||||
float var3 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2;
|
||||
double var4 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2;
|
||||
double var6 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2;
|
||||
double var8 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2;
|
||||
float var10 = MathHelper.cos(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI);
|
||||
float var11 = MathHelper.sin(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI);
|
||||
float var12 = -var11;
|
||||
float var13 = 0.0F;
|
||||
float var14 = -var10;
|
||||
float var15 = 0.0F;
|
||||
float var16 = 1.0F;
|
||||
float var17 = 0.0F;
|
||||
sndSystem.setListenerPosition((float)var4, (float)var6, (float)var8);
|
||||
sndSystem.setListenerOrientation(var12, var13, var14, var15, var16, var17);
|
||||
double var4 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double) var2;
|
||||
double var6 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double) var2;
|
||||
double var8 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double) var2;
|
||||
PlatformAudio.setListener((float) var4, (float) var6, (float) var8, (float) var9, (float) var3);
|
||||
} catch (Exception e) {
|
||||
// eaglercraft 1.5.2 had Infinity/NaN crashes for this function which
|
||||
// couldn't be resolved via if statement checks in the above variables
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playStreaming(String var1, float var2, float var3, float var4, float var5, float var6) {
|
||||
if(loaded && this.options.soundVolume != 0.0F) {
|
||||
String var7 = "streaming";
|
||||
if(sndSystem.playing("streaming")) {
|
||||
sndSystem.stop("streaming");
|
||||
}
|
||||
|
||||
if(var1 != null) {
|
||||
SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(var1);
|
||||
if(var8 != null && var5 > 0.0F) {
|
||||
if(sndSystem.playing("BgMusic")) {
|
||||
sndSystem.stop("BgMusic");
|
||||
}
|
||||
|
||||
float var9 = 16.0F;
|
||||
sndSystem.newStreamingSource(true, var7, var8.soundUrl, var8.soundName, false, var2, var3, var4, 2, var9 * 4.0F);
|
||||
sndSystem.setVolume(var7, 0.5F * this.options.soundVolume);
|
||||
sndSystem.play(var7);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void func_331_a(String var1, float var2, float var3, float var4, float var5, float var6) {
|
||||
// if(loaded && this.options.soundVolume != 0.0F) {
|
||||
// String var7 = "streaming";
|
||||
// if(sndSystem.playing("streaming")) {
|
||||
// sndSystem.stop("streaming");
|
||||
// }
|
||||
//
|
||||
// if(var1 != null) {
|
||||
// SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(var1);
|
||||
// if(var8 != null && var5 > 0.0F) {
|
||||
// if(sndSystem.playing("BgMusic")) {
|
||||
// sndSystem.stop("BgMusic");
|
||||
// }
|
||||
//
|
||||
// float var9 = 16.0F;
|
||||
// sndSystem.newStreamingSource(true, var7, var8.soundUrl, var8.soundName, false, var2, var3, var4, 2, var9 * 4.0F);
|
||||
// sndSystem.setVolume(var7, 0.5F * this.options.soundVolume);
|
||||
// sndSystem.play(var7);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public void playSound(String var1, float var2, float var3, float var4, float var5, float var6) {
|
||||
if(loaded && this.options.soundVolume != 0.0F) {
|
||||
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1);
|
||||
if(var7 != null && var5 > 0.0F) {
|
||||
this.field_587_e = (this.field_587_e + 1) % 256;
|
||||
String var8 = "sound_" + this.field_587_e;
|
||||
float var9 = 16.0F;
|
||||
if(var5 > 1.0F) {
|
||||
var9 *= var5;
|
||||
if(this.options.soundVolume != 0.0F) {
|
||||
if(var5 > 0.0F) {
|
||||
IAudioResource trk;
|
||||
if(var1 == null) return;
|
||||
|
||||
var1 = var1.replace(".", "/");
|
||||
|
||||
int randNum = AudioUtils.getRandomSound(var1);
|
||||
if(randNum == 0) {
|
||||
return;
|
||||
}
|
||||
String soundName = "/newsound/" + var1 + (randNum != -1 ? randNum : "") + ".ogg";
|
||||
if (!sounds.containsKey(soundName)) {
|
||||
if (EagRuntime.getPlatformType() != EnumPlatformType.DESKTOP) {
|
||||
trk = PlatformAudio.loadAudioDataNew(soundName, true, browserResourceLoader);
|
||||
} else {
|
||||
trk = PlatformAudio.loadAudioData(soundName, true);
|
||||
}
|
||||
if (trk != null) {
|
||||
sounds.put(soundName, trk);
|
||||
}
|
||||
} else {
|
||||
trk = sounds.get(soundName);
|
||||
}
|
||||
|
||||
sndSystem.newSource(var5 > 1.0F, var8, var7.soundUrl, var7.soundName, false, var2, var3, var4, 2, var9);
|
||||
sndSystem.setPitch(var8, var6);
|
||||
if(var5 > 1.0F) {
|
||||
var5 = 1.0F;
|
||||
if(trk != null) {
|
||||
PlatformAudio.beginPlayback(trk, var2, var3, var4, var5 * this.options.soundVolume, var6, false);
|
||||
}
|
||||
|
||||
sndSystem.setVolume(var8, var5 * this.options.soundVolume);
|
||||
sndSystem.play(var8);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void func_337_a(String var1, float var2, float var3) {
|
||||
if(loaded && this.options.soundVolume != 0.0F) {
|
||||
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1);
|
||||
if(var4 != null) {
|
||||
this.field_587_e = (this.field_587_e + 1) % 256;
|
||||
String var5 = "sound_" + this.field_587_e;
|
||||
sndSystem.newSource(false, var5, var4.soundUrl, var4.soundName, false, 0.0F, 0.0F, 0.0F, 0, 0.0F);
|
||||
if(var2 > 1.0F) {
|
||||
var2 = 1.0F;
|
||||
}
|
||||
if(this.options.soundVolume != 0.0F) {
|
||||
|
||||
var2 *= 0.25F;
|
||||
sndSystem.setPitch(var5, var3);
|
||||
sndSystem.setVolume(var5, var2 * this.options.soundVolume);
|
||||
sndSystem.play(var5);
|
||||
if(var2 > 1.0F) {
|
||||
var2 = 1.0F;
|
||||
}
|
||||
var2 *= 0.25F;
|
||||
|
||||
IAudioResource trk;
|
||||
if(var1 == null) return;
|
||||
|
||||
var1 = var1.replace(".", "/");
|
||||
int randNum = AudioUtils.getRandomSound(var1 + ".ogg");
|
||||
if(randNum == 0) {
|
||||
return;
|
||||
}
|
||||
String soundName = "/newsound/" + var1 + (randNum != -1 ? randNum : "") + ".ogg";
|
||||
System.out.println(soundName);
|
||||
if (!sounds.containsKey(soundName)) {
|
||||
if (EagRuntime.getPlatformType() != EnumPlatformType.DESKTOP) {
|
||||
trk = PlatformAudio.loadAudioDataNew(soundName, true, browserResourceLoader);
|
||||
} else {
|
||||
trk = PlatformAudio.loadAudioData(soundName, true);
|
||||
}
|
||||
if (trk != null) {
|
||||
sounds.put(soundName, trk);
|
||||
}
|
||||
} else {
|
||||
trk = sounds.get(soundName);
|
||||
}
|
||||
if(trk != null) {
|
||||
PlatformAudio.beginPlaybackStatic(trk, var2 * this.options.soundVolume, var3, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final IAudioCacheLoader browserResourceLoader = filename -> {
|
||||
try {
|
||||
return EaglerInputStream.inputStreamToBytesQuiet(EagRuntime.getRequiredResourceStream(filename));
|
||||
} catch (Throwable t) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -8,14 +7,15 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.lax1dude.eaglercraft.opengl.ImageData;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TexturePackCustom extends TexturePackBase {
|
||||
private ZipFile texturePackZipFile;
|
||||
private int texturePackName = -1;
|
||||
private BufferedImage texturePackThumbnail;
|
||||
private ImageData texturePackThumbnail;
|
||||
private File texturePackFile;
|
||||
|
||||
public TexturePackCustom(File var1) {
|
||||
@ -50,7 +50,7 @@ public class TexturePackCustom extends TexturePackBase {
|
||||
|
||||
try {
|
||||
var3 = var2.getInputStream(var2.getEntry("pack.png"));
|
||||
this.texturePackThumbnail = ImageIO.read(var3);
|
||||
this.texturePackThumbnail = ImageData.loadImageFile(var3);
|
||||
var3.close();
|
||||
} catch (Exception var19) {
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user