Got it to compile with TeaVM!
This commit is contained in:
parent
df96c19eb1
commit
006ee708a2
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
|
@ -2,7 +2,6 @@ package net.PeytonPlayz585;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.Display;
|
import org.lwjgl.opengl.Display;
|
||||||
import org.teavm.jso.JSBody;
|
import org.teavm.jso.JSBody;
|
||||||
|
@ -13,7 +12,7 @@ import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
import net.minecraft.src.Minecraft;
|
import net.minecraft.src.Minecraft;
|
||||||
import net.minecraft.src.Session;
|
import net.minecraft.src.Session;
|
||||||
|
|
||||||
public class Main {
|
public class Client {
|
||||||
|
|
||||||
public static HTMLElement rootElement = null;
|
public static HTMLElement rootElement = null;
|
||||||
public static Minecraft instance = null;
|
public static Minecraft instance = null;
|
||||||
|
@ -41,8 +40,8 @@ public class Main {
|
||||||
|
|
||||||
public static void run0() {
|
public static void run0() {
|
||||||
instance = new Minecraft(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), false);
|
instance = new Minecraft(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), false);
|
||||||
instance.session = new Session("Player", UUID.randomUUID().toString());
|
instance.session = new Session("Player", UUID.randomUUID());
|
||||||
instance.session.mpPassParameter = UUID.randomUUID().toString();
|
instance.session.mpPassParameter = UUID.randomUUID();
|
||||||
mcThread = new Thread(instance, "Minecraft main thread");
|
mcThread = new Thread(instance, "Minecraft main thread");
|
||||||
mcThread.start();
|
mcThread.start();
|
||||||
}
|
}
|
22
src/main/java/net/PeytonPlayz585/UUID.java
Normal file
22
src/main/java/net/PeytonPlayz585/UUID.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package net.PeytonPlayz585;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class UUID {
|
||||||
|
private static final char[] HEX_CHARS = "0123456789abcdef".toCharArray();
|
||||||
|
private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
|
public static String randomUUID() {
|
||||||
|
char[] uuidChars = new char[36];
|
||||||
|
|
||||||
|
for (int i = 0; i < 36; i++) {
|
||||||
|
if (i == 8 || i == 13 || i == 18 || i == 23) {
|
||||||
|
uuidChars[i] = '-';
|
||||||
|
} else {
|
||||||
|
uuidChars[i] = HEX_CHARS[RANDOM.nextInt(16)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(uuidChars);
|
||||||
|
}
|
||||||
|
}
|
27
src/main/java/net/minecraft/src/FontAllowedCharacters.java
Normal file
27
src/main/java/net/minecraft/src/FontAllowedCharacters.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
public class FontAllowedCharacters {
|
||||||
|
|
||||||
|
public static int isAllowed(char c) {
|
||||||
|
int cc = (int) c;
|
||||||
|
for(int i = 0; i < allowedChars.length; ++i) {
|
||||||
|
if(cc == allowedChars[i]) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int[] allowedChars = new int[]{
|
||||||
|
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
|
||||||
|
59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
|
||||||
|
86,87,88,89,90,91,92,93,94,95,39,97,98,99,100,101,102,103,104,105,106,107,108,109,
|
||||||
|
110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,8962,199,252,
|
||||||
|
233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,
|
||||||
|
251,249,255,214,220,248,163,216,215,402,225,237,243,250,241,209,170,186,191,174,
|
||||||
|
172,189,188,161,171,187
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final char field_22286_b[] = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '"', ':' };
|
||||||
|
|
||||||
|
}
|
|
@ -1,177 +1,172 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
import net.PeytonPlayz585.opengl.MinecraftImageData;
|
||||||
|
|
||||||
public class FontRenderer {
|
public class FontRenderer {
|
||||||
private int[] charWidth = new int[256];
|
|
||||||
private int fontTextureName = 0;
|
|
||||||
private int fontDisplayLists;
|
|
||||||
private IntBuffer buffer = GLAllocation.createIntBuffer(1024);
|
|
||||||
|
|
||||||
public FontRenderer(GameSettings var1, String var2, RenderEngine var3) {
|
public FontRenderer(GameSettings gamesettings, String s, RenderEngine renderengine) {
|
||||||
BufferedImage var4;
|
charWidth = new int[256];
|
||||||
try {
|
fontTextureName = 0;
|
||||||
var4 = ImageIO.read(RenderEngine.class.getResourceAsStream(var2));
|
MinecraftImageData bufferedimage = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes(s));
|
||||||
} catch (IOException var18) {
|
int i = bufferedimage.w;
|
||||||
throw new RuntimeException(var18);
|
int j = bufferedimage.h;
|
||||||
|
int ai[] = bufferedimage.data;
|
||||||
|
for (int k = 0; k < 256; k++) {
|
||||||
|
int l = k % 16;
|
||||||
|
int k1 = k / 16;
|
||||||
|
int j2 = 7;
|
||||||
|
do {
|
||||||
|
if (j2 < 0) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
int i3 = l * 8 + j2;
|
||||||
int var5 = var4.getWidth();
|
boolean flag = true;
|
||||||
int var6 = var4.getHeight();
|
for (int l3 = 0; l3 < 8 && flag; l3++) {
|
||||||
int[] var7 = new int[var5 * var6];
|
int i4 = (k1 * 8 + l3) * i;
|
||||||
var4.getRGB(0, 0, var5, var6, var7, 0, var5);
|
int k4 = ai[i3 + i4] & 0xff;
|
||||||
|
if (k4 > 0) {
|
||||||
int var9;
|
flag = false;
|
||||||
int var10;
|
|
||||||
int var11;
|
|
||||||
int var13;
|
|
||||||
int var15;
|
|
||||||
int var16;
|
|
||||||
for(int var8 = 0; var8 < 128; ++var8) {
|
|
||||||
var9 = var8 % 16;
|
|
||||||
var10 = var8 / 16;
|
|
||||||
var11 = 0;
|
|
||||||
|
|
||||||
for(boolean var12 = false; var11 < 8 && !var12; ++var11) {
|
|
||||||
var13 = var9 * 8 + var11;
|
|
||||||
var12 = true;
|
|
||||||
|
|
||||||
for(int var14 = 0; var14 < 8 && var12; ++var14) {
|
|
||||||
var15 = (var10 * 8 + var14) * var5;
|
|
||||||
var16 = var7[var13 + var15] & 255;
|
|
||||||
if(var16 > 128) {
|
|
||||||
var12 = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!flag) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
j2--;
|
||||||
|
} while (true);
|
||||||
|
if (k == 32) {
|
||||||
|
j2 = 2;
|
||||||
|
}
|
||||||
|
charWidth[k] = j2 + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var8 == 32) {
|
fontTextureName = renderengine.allocateAndSetupTexture(bufferedimage);
|
||||||
var11 = 4;
|
fontDisplayLists = GLAllocation.generateDisplayLists(288);
|
||||||
}
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
for (int i1 = 0; i1 < 256; i1++) {
|
||||||
this.charWidth[var8] = var11;
|
GL11.glNewList(fontDisplayLists + i1, 4864 /* GL_COMPILE */);
|
||||||
}
|
tessellator.startDrawingQuads();
|
||||||
|
int l1 = (i1 % 16) * 8;
|
||||||
this.fontTextureName = var3.getTexture(var2);
|
int k2 = (i1 / 16) * 8;
|
||||||
this.fontDisplayLists = GLAllocation.generateDisplayLists(288);
|
float f = 7.99F;
|
||||||
Tessellator var19 = Tessellator.instance;
|
float f1 = 0.0F;
|
||||||
|
float f2 = 0.0F;
|
||||||
for(var9 = 0; var9 < 256; ++var9) {
|
tessellator.addVertexWithUV(0.0D, 0.0F + f, 0.0D, (float) l1 / 128F + f1, ((float) k2 + f) / 128F + f2);
|
||||||
GL11.glNewList(this.fontDisplayLists + var9, GL11.GL_COMPILE);
|
tessellator.addVertexWithUV(0.0F + f, 0.0F + f, 0.0D, ((float) l1 + f) / 128F + f1,
|
||||||
var19.startDrawingQuads();
|
((float) k2 + f) / 128F + f2);
|
||||||
var10 = var9 % 16 * 8;
|
tessellator.addVertexWithUV(0.0F + f, 0.0D, 0.0D, ((float) l1 + f) / 128F + f1, (float) k2 / 128F + f2);
|
||||||
var11 = var9 / 16 * 8;
|
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (float) l1 / 128F + f1, (float) k2 / 128F + f2);
|
||||||
float var20 = 7.99F;
|
tessellator.draw();
|
||||||
var19.addVertexWithUV(0.0D, (double)(0.0F + var20), 0.0D, (double)((float)var10 / 128.0F), (double)(((float)var11 + var20) / 128.0F));
|
|
||||||
var19.addVertexWithUV((double)(0.0F + var20), (double)(0.0F + var20), 0.0D, (double)(((float)var10 + var20) / 128.0F), (double)(((float)var11 + var20) / 128.0F));
|
|
||||||
var19.addVertexWithUV((double)(0.0F + var20), 0.0D, 0.0D, (double)(((float)var10 + var20) / 128.0F), (double)((float)var11 / 128.0F));
|
|
||||||
var19.addVertexWithUV(0.0D, 0.0D, 0.0D, (double)((float)var10 / 128.0F), (double)((float)var11 / 128.0F));
|
|
||||||
var19.draw();
|
|
||||||
GL11.glTranslatef((float)this.charWidth[var9], 0.0F, 0.0F);
|
|
||||||
GL11.glEndList();
|
GL11.glEndList();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var9 = 0; var9 < 32; ++var9) {
|
for (int j1 = 0; j1 < 32; j1++) {
|
||||||
var10 = (var9 & 8) * 8;
|
int i2 = (j1 >> 3 & 1) * 85;
|
||||||
var11 = (var9 & 1) * 191 + var10;
|
int l2 = (j1 >> 2 & 1) * 170 + i2;
|
||||||
int var21 = ((var9 & 2) >> 1) * 191 + var10;
|
int j3 = (j1 >> 1 & 1) * 170 + i2;
|
||||||
var13 = ((var9 & 4) >> 2) * 191 + var10;
|
int k3 = (j1 >> 0 & 1) * 170 + i2;
|
||||||
boolean var22 = var9 >= 16;
|
if (j1 == 6) {
|
||||||
if(var1.anaglyph) {
|
l2 += 85;
|
||||||
var15 = (var13 * 30 + var21 * 59 + var11 * 11) / 100;
|
|
||||||
var16 = (var13 * 30 + var21 * 70) / 100;
|
|
||||||
int var17 = (var13 * 30 + var11 * 70) / 100;
|
|
||||||
var13 = var15;
|
|
||||||
var21 = var16;
|
|
||||||
var11 = var17;
|
|
||||||
}
|
}
|
||||||
|
boolean flag1 = j1 >= 16;
|
||||||
var9 += 2;
|
if (gamesettings.anaglyph) {
|
||||||
if(var22) {
|
int j4 = (l2 * 30 + j3 * 59 + k3 * 11) / 100;
|
||||||
var13 /= 4;
|
int l4 = (l2 * 30 + j3 * 70) / 100;
|
||||||
var21 /= 4;
|
int i5 = (l2 * 30 + k3 * 70) / 100;
|
||||||
var11 /= 4;
|
l2 = j4;
|
||||||
|
j3 = l4;
|
||||||
|
k3 = i5;
|
||||||
}
|
}
|
||||||
|
if (flag1) {
|
||||||
GL11.glColor4f((float)var13 / 255.0F, (float)var21 / 255.0F, (float)var11 / 255.0F, 1.0F);
|
l2 /= 4;
|
||||||
|
j3 /= 4;
|
||||||
|
k3 /= 4;
|
||||||
|
}
|
||||||
|
GL11.glNewList(fontDisplayLists + 256 + j1, 4864 /* GL_COMPILE */);
|
||||||
|
GL11.glColor3f((float) l2 / 255F, (float) j3 / 255F, (float) k3 / 255F);
|
||||||
|
GL11.glEndList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawStringWithShadow(String var1, int var2, int var3, int var4) {
|
public void drawStringWithShadow(String s, int i, int j, int k) {
|
||||||
this.renderString(var1, var2 + 1, var3 + 1, var4, true);
|
renderString(s, i + 1, j + 1, k, true);
|
||||||
this.drawString(var1, var2, var3, var4);
|
drawString(s, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawString(String var1, int var2, int var3, int var4) {
|
public void drawString(String s, int i, int j, int k) {
|
||||||
this.renderString(var1, var2, var3, var4, false);
|
renderString(s, i, j, k, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderString(String var1, int var2, int var3, int var4, boolean var5) {
|
public void renderString(String s, int i, int j, int k, boolean flag) {
|
||||||
if(var1 != null) {
|
if (s == null) {
|
||||||
if(var5) {
|
return;
|
||||||
var4 = (var4 & 16579836) >> 2;
|
|
||||||
}
|
}
|
||||||
|
if (flag) {
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.fontTextureName);
|
int l = k & 0xff000000;
|
||||||
float var6 = (float)(var4 >> 16 & 255) / 255.0F;
|
k = (k & 0xfcfcfc) >> 2;
|
||||||
float var7 = (float)(var4 >> 8 & 255) / 255.0F;
|
k += l;
|
||||||
float var8 = (float)(var4 & 255) / 255.0F;
|
}
|
||||||
float var9 = (float)(var4 >> 24 & 255) / 255.0F;
|
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, fontTextureName);
|
||||||
var9 = 1.0F;
|
float f = (float) (k >> 16 & 0xff) / 255F;
|
||||||
GL11.glColor4f(var6, var7, var8, var9);
|
float f1 = (float) (k >> 8 & 0xff) / 255F;
|
||||||
this.buffer.clear();
|
float f2 = (float) (k & 0xff) / 255F;
|
||||||
|
float f3 = (float) (k >> 24 & 0xff) / 255F;
|
||||||
|
if (f3 == 0.0F) {
|
||||||
|
f3 = 1.0F;
|
||||||
|
}
|
||||||
|
GL11.glColor4f(f, f1, f2, f3);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float)var2, (float)var3, 0.0F);
|
GL11.glTranslatef(i, j, 0.0F);
|
||||||
|
for (int i1 = 0; i1 < s.length(); i1++) {
|
||||||
for(int var10 = 0; var10 < var1.length(); ++var10) {
|
for (; s.length() > i1 + 1 && s.charAt(i1) == '\247'; i1 += 2) {
|
||||||
for(; var1.charAt(var10) == 38 && var1.length() > var10 + 1; var10 += 2) {
|
int j1 = "0123456789abcdef".indexOf(s.toLowerCase().charAt(i1 + 1));
|
||||||
int var11 = "0123456789abcdef".indexOf(var1.charAt(var10 + 1));
|
if (j1 < 0 || j1 > 15) {
|
||||||
if(var11 < 0 || var11 > 15) {
|
j1 = 15;
|
||||||
var11 = 15;
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buffer.put(this.fontDisplayLists + 256 + var11 + (var5 ? 16 : 0));
|
if (i1 < s.length()) {
|
||||||
if(this.buffer.remaining() == 0) {
|
int k1 = FontAllowedCharacters.isAllowed(s.charAt(i1));
|
||||||
this.buffer.flip();
|
if (k1 >= 0) {
|
||||||
GL11.glCallLists(this.buffer);
|
GL11.glCallList(fontDisplayLists + k1 + 32);
|
||||||
this.buffer.clear();
|
GL11.glTranslatef(charWidth[k1 + 32], 0.0F, 0.0F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buffer.put(this.fontDisplayLists + var1.charAt(var10));
|
|
||||||
if(this.buffer.remaining() == 0) {
|
|
||||||
this.buffer.flip();
|
|
||||||
GL11.glCallLists(this.buffer);
|
|
||||||
this.buffer.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.buffer.flip();
|
|
||||||
GL11.glCallLists(this.buffer);
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public int getStringWidth(String var1) {
|
public int getStringWidth(String s) {
|
||||||
if(var1 == null) {
|
if (s == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
int var2 = 0;
|
int i = 0;
|
||||||
|
for (int j = 0; j < s.length(); j++) {
|
||||||
for(int var3 = 0; var3 < var1.length(); ++var3) {
|
if (s.charAt(j) == '\247') {
|
||||||
if(var1.charAt(var3) == 38) {
|
j++;
|
||||||
++var3;
|
continue;
|
||||||
} else {
|
}
|
||||||
var2 += this.charWidth[var1.charAt(var3)];
|
int k = FontAllowedCharacters.isAllowed(s.charAt(j));
|
||||||
|
if (k >= 0) {
|
||||||
|
i += charWidth[k + 32];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return var2;
|
return i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int charWidth[];
|
||||||
|
public int fontTextureName;
|
||||||
|
private int fontDisplayLists;
|
||||||
|
private IntBuffer buffer;
|
||||||
|
|
||||||
|
public static final char formatChar = '\247';
|
||||||
}
|
}
|
|
@ -6,6 +6,8 @@ import java.util.Random;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class GuiIngame extends Gui {
|
public class GuiIngame extends Gui {
|
||||||
private static RenderItem itemRenderer = new RenderItem();
|
private static RenderItem itemRenderer = new RenderItem();
|
||||||
private List chatMessageList = new ArrayList();
|
private List chatMessageList = new ArrayList();
|
||||||
|
@ -138,9 +140,9 @@ public class GuiIngame extends Gui {
|
||||||
var8.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
|
var8.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
|
||||||
var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
|
var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
|
||||||
var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
|
var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
|
||||||
long var22 = Runtime.getRuntime().maxMemory();
|
long var22 = LWJGLMain.maxMemory();
|
||||||
long var26 = Runtime.getRuntime().totalMemory();
|
long var26 = LWJGLMain.totalMemory();
|
||||||
long var27 = Runtime.getRuntime().freeMemory();
|
long var27 = LWJGLMain.freeMemory();
|
||||||
long var19 = var26 - var27;
|
long var19 = var26 - var27;
|
||||||
String var21 = "Used memory: " + var19 * 100L / var22 + "% (" + var19 / 1024L / 1024L + "MB) of " + var22 / 1024L / 1024L + "MB";
|
String var21 = "Used memory: " + var19 * 100L / var22 + "% (" + var19 / 1024L / 1024L + "MB) of " + var22 / 1024L / 1024L + "MB";
|
||||||
this.drawString(var8, var21, var6 - var8.getStringWidth(var21) - 2, 2, 14737632);
|
this.drawString(var8, var21, var6 - var8.getStringWidth(var21) - 2, 2, 14737632);
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.minecraft.src;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
|
|
||||||
public class GuiMainMenu extends GuiScreen {
|
public class GuiMainMenu extends GuiScreen {
|
||||||
private float updateCounter = 0.0F;
|
private float updateCounter = 0.0F;
|
||||||
private String[] splashes = new String[]{"Pre-beta!", "As seen on TV!", "Awesome!", "100% pure!", "May contain nuts!", "Better than Prey!", "More polygons!", "Sexy!", "Limited edition!", "Flashing letters!", "Made by Notch!", "Coming soon!", "Best in class!", "When it\'s finished!", "Absolutely dragon free!", "Excitement!", "More than 5000 sold!", "One of a kind!", "700+ hits on YouTube!", "Indev!", "Spiders everywhere!", "Check it out!", "Holy cow, man!", "It\'s a game!", "Made in Sweden!", "Uses LWJGL!", "Reticulating splines!", "Minecraft!", "Yaaay!", "Alpha version!", "Singleplayer!", "Keyboard compatible!", "Undocumented!", "Ingots!", "Exploding creepers!", "That\'s not a moon!", "l33t!", "Create!", "Survive!", "Dungeon!", "Exclusive!", "The bee\'s knees!", "Down with O.P.P.!", "Closed source!", "Classy!", "Wow!", "Not on steam!", "9.95 euro!", "Half price!", "Oh man!", "Check it out!", "Awesome community!", "Pixels!", "Teetsuuuuoooo!", "Kaaneeeedaaaa!", "Now with difficulty!", "Enhanced!", "90% bug free!", "Pretty!", "12 herbs and spices!", "Fat free!", "Absolutely no memes!", "Free dental!", "Ask your doctor!", "Minors welcome!", "Cloud computing!", "Legal in Finland!", "Hard to label!", "Technically good!", "Bringing home the bacon!", "Indie!", "GOTY!", "Ceci n\'est pas une title screen!", "Euclidian!", "Now in 3D!", "Inspirational!", "Herregud!", "Complex cellular automata!", "Yes, sir!", "Played by cowboys!", "OpenGL 1.1!", "Thousands of colors!", "Try it!", "Age of Wonders is better!", "Try the mushroom stew!", "Sensational!", "Hot tamale, hot hot tamale!", "Play him off, keyboard cat!", "Guaranteed!", "Macroscopic!", "Bring it on!", "Random splash!", "Call your mother!", "Monster infighting!", "Loved by millions!", "Ultimate edition!", "Freaky!", "You\'ve got a brand new key!", "Water proof!", "Uninflammable!", "Whoa, dude!", "All inclusive!", "Tell your friends!", "NP is not in P!", "Notch <3 Ez!", "Music by C418!"};
|
private String[] splashes = new String[]{"Pre-beta!", "As seen on TV!", "Awesome!", "100% pure!", "May contain nuts!", "Better than Prey!", "More polygons!", "Sexy!", "Limited edition!", "Flashing letters!", "Made by Notch!", "Coming soon!", "Best in class!", "When it\'s finished!", "Absolutely dragon free!", "Excitement!", "More than 5000 sold!", "One of a kind!", "700+ hits on YouTube!", "Indev!", "Spiders everywhere!", "Check it out!", "Holy cow, man!", "It\'s a game!", "Made in Sweden!", "Uses LWJGL!", "Reticulating splines!", "Minecraft!", "Yaaay!", "Alpha version!", "Singleplayer!", "Keyboard compatible!", "Undocumented!", "Ingots!", "Exploding creepers!", "That\'s not a moon!", "l33t!", "Create!", "Survive!", "Dungeon!", "Exclusive!", "The bee\'s knees!", "Down with O.P.P.!", "Closed source!", "Classy!", "Wow!", "Not on steam!", "9.95 euro!", "Half price!", "Oh man!", "Check it out!", "Awesome community!", "Pixels!", "Teetsuuuuoooo!", "Kaaneeeedaaaa!", "Now with difficulty!", "Enhanced!", "90% bug free!", "Pretty!", "12 herbs and spices!", "Fat free!", "Absolutely no memes!", "Free dental!", "Ask your doctor!", "Minors welcome!", "Cloud computing!", "Legal in Finland!", "Hard to label!", "Technically good!", "Bringing home the bacon!", "Indie!", "GOTY!", "Ceci n\'est pas une title screen!", "Euclidian!", "Now in 3D!", "Inspirational!", "Herregud!", "Complex cellular automata!", "Yes, sir!", "Played by cowboys!", "OpenGL 1.1!", "Thousands of colors!", "Try it!", "Age of Wonders is better!", "Try the mushroom stew!", "Sensational!", "Hot tamale, hot hot tamale!", "Play him off, keyboard cat!", "Guaranteed!", "Macroscopic!", "Bring it on!", "Random splash!", "Call your mother!", "Monster infighting!", "Loved by millions!", "Ultimate edition!", "Freaky!", "You\'ve got a brand new key!", "Water proof!", "Uninflammable!", "Whoa, dude!", "All inclusive!", "Tell your friends!", "NP is not in P!", "Notch <3 Ez!", "Music by C418!"};
|
||||||
|
@ -58,9 +60,9 @@ public class GuiMainMenu extends GuiScreen {
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
String var8 = "Copyright Mojang Specifications. Do not distribute.";
|
String var8 = "Copyright Mojang Specifications. Do not distribute.";
|
||||||
this.drawString(this.fontRenderer, var8, this.width - this.fontRenderer.getStringWidth(var8) - 2, this.height - 10, 16777215);
|
this.drawString(this.fontRenderer, var8, this.width - this.fontRenderer.getStringWidth(var8) - 2, this.height - 10, 16777215);
|
||||||
long var9 = Runtime.getRuntime().maxMemory();
|
long var9 = LWJGLMain.maxMemory();
|
||||||
long var11 = Runtime.getRuntime().totalMemory();
|
long var11 = LWJGLMain.totalMemory();
|
||||||
long var13 = Runtime.getRuntime().freeMemory();
|
long var13 = LWJGLMain.freeMemory();
|
||||||
long var15 = var9 - var13;
|
long var15 = var9 - var13;
|
||||||
var8 = "Free memory: " + var15 * 100L / var9 + "% of " + var9 / 1024L / 1024L + "MB";
|
var8 = "Free memory: " + var15 * 100L / var9 + "% of " + var9 / 1024L / 1024L + "MB";
|
||||||
this.drawString(this.fontRenderer, var8, this.width - this.fontRenderer.getStringWidth(var8) - 2, 2, 8421504);
|
this.drawString(this.fontRenderer, var8, this.width - this.fontRenderer.getStringWidth(var8) - 2, 2, 8421504);
|
||||||
|
|
|
@ -27,7 +27,6 @@ public class Minecraft implements Runnable {
|
||||||
public GuiScreen currentScreen = null;
|
public GuiScreen currentScreen = null;
|
||||||
public LoadingScreenRenderer loadingScreen = new LoadingScreenRenderer(this);
|
public LoadingScreenRenderer loadingScreen = new LoadingScreenRenderer(this);
|
||||||
public EntityRenderer entityRenderer = new EntityRenderer(this);
|
public EntityRenderer entityRenderer = new EntityRenderer(this);
|
||||||
private ThreadDownloadResources downloadResourcesThread;
|
|
||||||
private int ticksRan = 0;
|
private int ticksRan = 0;
|
||||||
private int leftClickCounter = 0;
|
private int leftClickCounter = 0;
|
||||||
private int tempDisplayWidth;
|
private int tempDisplayWidth;
|
||||||
|
@ -96,19 +95,10 @@ public class Minecraft implements Runnable {
|
||||||
this.renderEngine.registerTextureFX(new TextureLavaFlowFX());
|
this.renderEngine.registerTextureFX(new TextureLavaFlowFX());
|
||||||
this.renderEngine.registerTextureFX(new TextureFlamesFX(0));
|
this.renderEngine.registerTextureFX(new TextureFlamesFX(0));
|
||||||
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
|
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
|
||||||
this.renderEngine.registerTextureFX(new TextureGearsFX(0));
|
|
||||||
this.renderEngine.registerTextureFX(new TextureGearsFX(1));
|
|
||||||
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
|
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
|
||||||
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
||||||
this.displayGuiScreen(new GuiMainMenu());
|
this.displayGuiScreen(new GuiMainMenu());
|
||||||
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
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.checkGLError("Post startup");
|
||||||
this.ingameGUI = new GuiIngame(this);
|
this.ingameGUI = new GuiIngame(this);
|
||||||
this.playerController.init();
|
this.playerController.init();
|
||||||
|
@ -163,12 +153,7 @@ public class Minecraft implements Runnable {
|
||||||
var2 = new File(var1, '.' + var0 + '/');
|
var2 = new File(var1, '.' + var0 + '/');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
String var3 = System.getenv("APPDATA");
|
|
||||||
if(var3 != null) {
|
|
||||||
var2 = new File(var3, "." + var0 + '/');
|
|
||||||
} else {
|
|
||||||
var2 = new File(var1, '.' + var0 + '/');
|
var2 = new File(var1, '.' + var0 + '/');
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
var2 = new File(var1, "Library/Application Support/" + var0);
|
var2 = new File(var1, "Library/Application Support/" + var0);
|
||||||
|
@ -223,19 +208,11 @@ public class Minecraft implements Runnable {
|
||||||
System.out.println("########## GL ERROR ##########");
|
System.out.println("########## GL ERROR ##########");
|
||||||
System.out.println("@ " + var1);
|
System.out.println("@ " + var1);
|
||||||
System.out.println(var2 + ": " + var3);
|
System.out.println(var2 + ": " + var3);
|
||||||
System.exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdownMinecraftApplet() {
|
public void shutdownMinecraftApplet() {
|
||||||
try {
|
|
||||||
if(this.downloadResourcesThread != null) {
|
|
||||||
this.downloadResourcesThread.closeMinecraft();
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Stopping!");
|
System.out.println("Stopping!");
|
||||||
this.changeWorld1((World)null);
|
this.changeWorld1((World)null);
|
||||||
GLAllocation.deleteTexturesAndDisplayLists();
|
GLAllocation.deleteTexturesAndDisplayLists();
|
||||||
|
|
|
@ -1,214 +1,83 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
public class TerrainTextureManager {
|
public class TerrainTextureManager {
|
||||||
private float[] texCols = new float[768];
|
|
||||||
private int[] pixels = new int[5120];
|
|
||||||
private int[] zBuf = new int[5120];
|
|
||||||
private int[] waterBuf = new int[5120];
|
|
||||||
private int[] waterBr = new int[5120];
|
|
||||||
private int[] yBuf = new int[34];
|
|
||||||
private int[] textures = new int[768];
|
|
||||||
|
|
||||||
public TerrainTextureManager() {
|
public TerrainTextureManager() {
|
||||||
try {
|
field_1181_a = new float[768];
|
||||||
BufferedImage var1 = ImageIO.read(TerrainTextureManager.class.getResource("/terrain.png"));
|
field_1180_b = new int[5120];
|
||||||
int[] var2 = new int[65536];
|
field_1186_c = new int[5120];
|
||||||
var1.getRGB(0, 0, 256, 256, var2, 0, 256);
|
field_1185_d = new int[5120];
|
||||||
|
field_1184_e = new int[5120];
|
||||||
for(int var3 = 0; var3 < 256; ++var3) {
|
field_1183_f = new int[34];
|
||||||
int var4 = 0;
|
field_1182_g = new int[768];
|
||||||
int var5 = 0;
|
int ai[] = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes("/terrain.png")).data;
|
||||||
int var6 = 0;
|
for (int j = 0; j < 256; j++) {
|
||||||
int var7 = var3 % 16 * 16;
|
int k = 0;
|
||||||
int var8 = var3 / 16 * 16;
|
int l = 0;
|
||||||
int var9 = 0;
|
int i1 = 0;
|
||||||
|
int j1 = (j % 16) * 16;
|
||||||
for(int var10 = 0; var10 < 16; ++var10) {
|
int k1 = (j / 16) * 16;
|
||||||
for(int var11 = 0; var11 < 16; ++var11) {
|
int l1 = 0;
|
||||||
int var12 = var2[var11 + var7 + (var10 + var8) * 256];
|
for (int i2 = 0; i2 < 16; i2++) {
|
||||||
int var13 = var12 >> 24 & 255;
|
for (int j2 = 0; j2 < 16; j2++) {
|
||||||
if(var13 > 128) {
|
int k2 = ai[j2 + j1 + (i2 + k1) * 256];
|
||||||
var4 += var12 >> 16 & 255;
|
int l2 = k2 >> 24 & 0xff;
|
||||||
var5 += var12 >> 8 & 255;
|
if (l2 > 128) {
|
||||||
var6 += var12 & 255;
|
k += k2 >> 16 & 0xff;
|
||||||
++var9;
|
l += k2 >> 8 & 0xff;
|
||||||
|
i1 += k2 & 0xff;
|
||||||
|
l1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var9 == 0) {
|
if (l1 == 0) {
|
||||||
++var9;
|
l1++;
|
||||||
|
}
|
||||||
|
field_1181_a[j * 3 + 0] = k / l1;
|
||||||
|
field_1181_a[j * 3 + 1] = l / l1;
|
||||||
|
field_1181_a[j * 3 + 2] = i1 / l1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.texCols[var3 * 3 + 0] = (float)(var4 / var9);
|
|
||||||
this.texCols[var3 * 3 + 1] = (float)(var5 / var9);
|
|
||||||
this.texCols[var3 * 3 + 2] = (float)(var6 / var9);
|
|
||||||
}
|
}
|
||||||
}
|
for (int i = 0; i < 256; i++) {
|
||||||
} catch (IOException var14) {
|
if (Block.blocksList[i] != null) {
|
||||||
var14.printStackTrace();
|
field_1182_g[i * 3 + 0] = Block.blocksList[i].getBlockTextureFromSide(1);
|
||||||
}
|
field_1182_g[i * 3 + 1] = Block.blocksList[i].getBlockTextureFromSide(2);
|
||||||
|
field_1182_g[i * 3 + 2] = Block.blocksList[i].getBlockTextureFromSide(3);
|
||||||
for(int var15 = 0; var15 < 256; ++var15) {
|
|
||||||
if(Block.blocksList[var15] != null) {
|
|
||||||
this.textures[var15 * 3 + 0] = Block.blocksList[var15].getBlockTextureFromSide(1);
|
|
||||||
this.textures[var15 * 3 + 1] = Block.blocksList[var15].getBlockTextureFromSide(2);
|
|
||||||
this.textures[var15 * 3 + 2] = Block.blocksList[var15].getBlockTextureFromSide(3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(IsoImageBuffer var1) {
|
private void func_800_a() {
|
||||||
World var2 = var1.level;
|
for (int i = 0; i < 32; i++) {
|
||||||
if(var2 == null) {
|
for (int j = 0; j < 160; j++) {
|
||||||
var1.noContent = true;
|
int k = i + j * 32;
|
||||||
var1.rendered = true;
|
if (field_1186_c[k] == 0) {
|
||||||
|
field_1180_b[k] = 0;
|
||||||
|
}
|
||||||
|
if (field_1185_d[k] <= field_1186_c[k]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int l = field_1180_b[k] >> 24 & 0xff;
|
||||||
|
field_1180_b[k] = ((field_1180_b[k] & 0xfefefe) >> 1) + field_1184_e[k];
|
||||||
|
if (l < 128) {
|
||||||
|
field_1180_b[k] = 0x80000000 + field_1184_e[k] * 2;
|
||||||
} else {
|
} else {
|
||||||
int var3 = var1.chunkX * 16;
|
field_1180_b[k] |= 0xff000000;
|
||||||
int var4 = var1.chunkZ * 16;
|
|
||||||
int var5 = var3 + 16;
|
|
||||||
int var6 = var4 + 16;
|
|
||||||
Chunk var7 = var2.getChunkFromChunkCoords(var1.chunkX, var1.chunkZ);
|
|
||||||
if(var7.isChunkRendered) {
|
|
||||||
var1.noContent = true;
|
|
||||||
var1.rendered = true;
|
|
||||||
} else {
|
|
||||||
var1.noContent = false;
|
|
||||||
Arrays.fill(this.zBuf, 0);
|
|
||||||
Arrays.fill(this.waterBuf, 0);
|
|
||||||
Arrays.fill(this.yBuf, 160);
|
|
||||||
|
|
||||||
for(int var8 = var6 - 1; var8 >= var4; --var8) {
|
|
||||||
for(int var9 = var5 - 1; var9 >= var3; --var9) {
|
|
||||||
int var10 = var9 - var3;
|
|
||||||
int var11 = var8 - var4;
|
|
||||||
int var12 = var10 + var11;
|
|
||||||
boolean var13 = true;
|
|
||||||
|
|
||||||
for(int var14 = 0; var14 < 128; ++var14) {
|
|
||||||
int var15 = var11 - var10 - var14 + 160 - 16;
|
|
||||||
if(var15 < this.yBuf[var12] || var15 < this.yBuf[var12 + 1]) {
|
|
||||||
Block var16 = Block.blocksList[var2.getBlockId(var9, var14, var8)];
|
|
||||||
if(var16 == null) {
|
|
||||||
var13 = false;
|
|
||||||
} else if(var16.blockMaterial == Material.water) {
|
|
||||||
int var24 = var2.getBlockId(var9, var14 + 1, var8);
|
|
||||||
if(var24 == 0 || Block.blocksList[var24].blockMaterial != Material.water) {
|
|
||||||
float var25 = (float)var14 / 127.0F * 0.6F + 0.4F;
|
|
||||||
float var26 = var2.getBrightness(var9, var14 + 1, var8) * var25;
|
|
||||||
if(var15 >= 0 && var15 < 160) {
|
|
||||||
int var27 = var12 + var15 * 32;
|
|
||||||
if(var12 >= 0 && var12 <= 32 && this.waterBuf[var27] <= var14) {
|
|
||||||
this.waterBuf[var27] = var14;
|
|
||||||
this.waterBr[var27] = (int)(var26 * 127.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var12 >= -1 && var12 <= 31 && this.waterBuf[var27 + 1] <= var14) {
|
|
||||||
this.waterBuf[var27 + 1] = var14;
|
|
||||||
this.waterBr[var27 + 1] = (int)(var26 * 127.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
var13 = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(var13) {
|
|
||||||
if(var15 < this.yBuf[var12]) {
|
|
||||||
this.yBuf[var12] = var15;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var15 < this.yBuf[var12 + 1]) {
|
|
||||||
this.yBuf[var12 + 1] = var15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float var17 = (float)var14 / 127.0F * 0.6F + 0.4F;
|
|
||||||
int var18;
|
|
||||||
int var19;
|
|
||||||
float var20;
|
|
||||||
float var22;
|
|
||||||
if(var15 >= 0 && var15 < 160) {
|
|
||||||
var18 = var12 + var15 * 32;
|
|
||||||
var19 = this.textures[var16.blockID * 3 + 0];
|
|
||||||
var20 = (var2.getBrightness(var9, var14 + 1, var8) * 0.8F + 0.2F) * var17;
|
|
||||||
if(var12 >= 0 && this.zBuf[var18] <= var14) {
|
|
||||||
this.zBuf[var18] = var14;
|
|
||||||
this.pixels[var18] = -16777216 | (int)(this.texCols[var19 * 3 + 0] * var20) << 16 | (int)(this.texCols[var19 * 3 + 1] * var20) << 8 | (int)(this.texCols[var19 * 3 + 2] * var20);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var12 < 31) {
|
|
||||||
var22 = var20 * 0.9F;
|
|
||||||
if(this.zBuf[var18 + 1] <= var14) {
|
|
||||||
this.zBuf[var18 + 1] = var14;
|
|
||||||
this.pixels[var18 + 1] = -16777216 | (int)(this.texCols[var19 * 3 + 0] * var22) << 16 | (int)(this.texCols[var19 * 3 + 1] * var22) << 8 | (int)(this.texCols[var19 * 3 + 2] * var22);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var15 >= -1 && var15 < 159) {
|
|
||||||
var18 = var12 + (var15 + 1) * 32;
|
|
||||||
var19 = this.textures[var16.blockID * 3 + 1];
|
|
||||||
var20 = var2.getBrightness(var9 - 1, var14, var8) * 0.8F + 0.2F;
|
|
||||||
int var21 = this.textures[var16.blockID * 3 + 2];
|
|
||||||
var22 = var2.getBrightness(var9, var14, var8 + 1) * 0.8F + 0.2F;
|
|
||||||
float var23;
|
|
||||||
if(var12 >= 0) {
|
|
||||||
var23 = var20 * var17 * 0.6F;
|
|
||||||
if(this.zBuf[var18] <= var14 - 1) {
|
|
||||||
this.zBuf[var18] = var14 - 1;
|
|
||||||
this.pixels[var18] = -16777216 | (int)(this.texCols[var19 * 3 + 0] * var23) << 16 | (int)(this.texCols[var19 * 3 + 1] * var23) << 8 | (int)(this.texCols[var19 * 3 + 2] * var23);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var12 < 31) {
|
|
||||||
var23 = var22 * 0.9F * var17 * 0.4F;
|
|
||||||
if(this.zBuf[var18 + 1] <= var14 - 1) {
|
|
||||||
this.zBuf[var18 + 1] = var14 - 1;
|
|
||||||
this.pixels[var18 + 1] = -16777216 | (int)(this.texCols[var21 * 3 + 0] * var23) << 16 | (int)(this.texCols[var21 * 3 + 1] * var23) << 8 | (int)(this.texCols[var21 * 3 + 2] * var23);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.postProcess();
|
|
||||||
if(var1.image == null) {
|
|
||||||
var1.image = new BufferedImage(32, 160, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
var1.image.setRGB(0, 0, 32, 160, this.pixels, 0, 32);
|
|
||||||
var1.rendered = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void postProcess() {
|
|
||||||
for(int var1 = 0; var1 < 32; ++var1) {
|
|
||||||
for(int var2 = 0; var2 < 160; ++var2) {
|
|
||||||
int var3 = var1 + var2 * 32;
|
|
||||||
if(this.zBuf[var3] == 0) {
|
|
||||||
this.pixels[var3] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.waterBuf[var3] > this.zBuf[var3]) {
|
|
||||||
int var4 = this.pixels[var3] >> 24 & 255;
|
|
||||||
this.pixels[var3] = ((this.pixels[var3] & 16711422) >> 1) + this.waterBr[var3];
|
|
||||||
if(var4 < 128) {
|
|
||||||
this.pixels[var3] = Integer.MIN_VALUE + this.waterBr[var3] * 2;
|
|
||||||
} else {
|
|
||||||
this.pixels[var3] |= -16777216;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private float field_1181_a[];
|
||||||
|
private int field_1180_b[];
|
||||||
|
private int field_1186_c[];
|
||||||
|
private int field_1185_d[];
|
||||||
|
private int field_1184_e[];
|
||||||
|
private int field_1183_f[];
|
||||||
|
private int field_1182_g[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
public class TextureGearsFX extends TextureFX {
|
|
||||||
private int gearRotation = 0;
|
|
||||||
private int[] gearColor = new int[1024];
|
|
||||||
private int[] gearMiddleColor = new int[1024];
|
|
||||||
private int gearRotationDir;
|
|
||||||
|
|
||||||
public TextureGearsFX(int var1) {
|
|
||||||
super(Block.cog.blockIndexInTexture + var1);
|
|
||||||
this.gearRotationDir = var1 * 2 - 1;
|
|
||||||
this.gearRotation = 2;
|
|
||||||
|
|
||||||
try {
|
|
||||||
BufferedImage var2 = ImageIO.read(TextureGearsFX.class.getResource("/misc/gear.png"));
|
|
||||||
var2.getRGB(0, 0, 32, 32, this.gearColor, 0, 32);
|
|
||||||
var2 = ImageIO.read(TextureGearsFX.class.getResource("/misc/gearmiddle.png"));
|
|
||||||
var2.getRGB(0, 0, 16, 16, this.gearMiddleColor, 0, 16);
|
|
||||||
} catch (IOException var3) {
|
|
||||||
var3.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTick() {
|
|
||||||
this.gearRotation = this.gearRotation + this.gearRotationDir & 63;
|
|
||||||
float var1 = MathHelper.sin((float)this.gearRotation / 64.0F * (float)Math.PI * 2.0F);
|
|
||||||
float var2 = MathHelper.cos((float)this.gearRotation / 64.0F * (float)Math.PI * 2.0F);
|
|
||||||
|
|
||||||
for(int var3 = 0; var3 < 16; ++var3) {
|
|
||||||
for(int var4 = 0; var4 < 16; ++var4) {
|
|
||||||
float var5 = ((float)var3 / 15.0F - 0.5F) * 31.0F;
|
|
||||||
float var6 = ((float)var4 / 15.0F - 0.5F) * 31.0F;
|
|
||||||
float var7 = var2 * var5 - var1 * var6;
|
|
||||||
float var8 = var2 * var6 + var1 * var5;
|
|
||||||
int var9 = (int)(var7 + 16.0F);
|
|
||||||
int var10 = (int)(var8 + 16.0F);
|
|
||||||
int var11 = 0;
|
|
||||||
int var12;
|
|
||||||
if(var9 >= 0 && var10 >= 0 && var9 < 32 && var10 < 32) {
|
|
||||||
var11 = this.gearColor[var9 + var10 * 32];
|
|
||||||
var12 = this.gearMiddleColor[var3 + var4 * 16];
|
|
||||||
if((var12 >> 24 & 255) > 128) {
|
|
||||||
var11 = var12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var12 = var11 >> 16 & 255;
|
|
||||||
int var13 = var11 >> 8 & 255;
|
|
||||||
int var14 = var11 & 255;
|
|
||||||
int var15 = (var11 >> 24 & 255) > 128 ? 255 : 0;
|
|
||||||
int var16 = var3 + var4 * 16;
|
|
||||||
this.imageData[var16 * 4 + 0] = (byte)var12;
|
|
||||||
this.imageData[var16 * 4 + 1] = (byte)var13;
|
|
||||||
this.imageData[var16 * 4 + 2] = (byte)var14;
|
|
||||||
this.imageData[var16 * 4 + 3] = (byte)var15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
class ThreadDownloadImage extends Thread {
|
|
||||||
final String location;
|
|
||||||
final ImageBuffer buffer;
|
|
||||||
final ThreadDownloadImageData imageData;
|
|
||||||
|
|
||||||
ThreadDownloadImage(ThreadDownloadImageData var1, String var2, ImageBuffer var3) {
|
|
||||||
this.imageData = var1;
|
|
||||||
this.location = var2;
|
|
||||||
this.buffer = var3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
HttpURLConnection var1 = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
URL var2 = new URL(this.location);
|
|
||||||
var1 = (HttpURLConnection)var2.openConnection();
|
|
||||||
var1.setDoInput(true);
|
|
||||||
var1.setDoOutput(false);
|
|
||||||
var1.connect();
|
|
||||||
if(var1.getResponseCode() != 404) {
|
|
||||||
if(this.buffer == null) {
|
|
||||||
this.imageData.image = ImageIO.read(var1.getInputStream());
|
|
||||||
} else {
|
|
||||||
this.imageData.image = this.buffer.parseUserSkin(ImageIO.read(var1.getInputStream()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Exception var6) {
|
|
||||||
var6.printStackTrace();
|
|
||||||
return;
|
|
||||||
} finally {
|
|
||||||
var1.disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
|
|
||||||
public class ThreadDownloadImageData {
|
|
||||||
public BufferedImage image;
|
|
||||||
public int referenceCount = 1;
|
|
||||||
public int textureName = -1;
|
|
||||||
public boolean textureSetupComplete = false;
|
|
||||||
|
|
||||||
public ThreadDownloadImageData(String var1, ImageBuffer var2) {
|
|
||||||
(new ThreadDownloadImage(this, var1, var2)).start();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
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 {
|
|
||||||
ArrayList var1 = new ArrayList();
|
|
||||||
URL var2 = new URL("http://www.minecraft.net/resources/");
|
|
||||||
BufferedReader var3 = new BufferedReader(new InputStreamReader(var2.openStream()));
|
|
||||||
String var4 = "";
|
|
||||||
|
|
||||||
while(true) {
|
|
||||||
var4 = var3.readLine();
|
|
||||||
if(var4 == null) {
|
|
||||||
var3.close();
|
|
||||||
|
|
||||||
for(int var5 = 0; var5 < var1.size(); ++var5) {
|
|
||||||
this.downloadAndInstallResource(var2, (String)var1.get(var5));
|
|
||||||
if(this.closing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var1.add(var4);
|
|
||||||
}
|
|
||||||
} catch (IOException var6) {
|
|
||||||
this.loadResource(this.resourcesFolder, "");
|
|
||||||
var6.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
this.mc.installResource(var2 + var3[var4].getName(), var3[var4]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void downloadAndInstallResource(URL var1, String var2) {
|
|
||||||
try {
|
|
||||||
String[] var3 = var2.split(",");
|
|
||||||
String var4 = var3[0];
|
|
||||||
int var5 = Integer.parseInt(var3[1]);
|
|
||||||
long var6 = Long.parseLong(var3[2]);
|
|
||||||
var6 /= 2L;
|
|
||||||
File var8 = new File(this.resourcesFolder, var4);
|
|
||||||
if(!var8.exists() || var8.length() != (long)var5) {
|
|
||||||
var8.getParentFile().mkdirs();
|
|
||||||
String var9 = var4.replaceAll(" ", "%20");
|
|
||||||
this.downloadResource(new URL(var1, var9), var8, var5);
|
|
||||||
if(this.closing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mc.installResource(var4, var8);
|
|
||||||
} catch (Exception var10) {
|
|
||||||
var10.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void downloadResource(URL var1, File var2, int var3) throws IOException {
|
|
||||||
byte[] var4 = new byte[4096];
|
|
||||||
DataInputStream var5 = new DataInputStream(var1.openStream());
|
|
||||||
DataOutputStream var6 = new DataOutputStream(new FileOutputStream(var2));
|
|
||||||
boolean var7 = false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
int var8 = var5.read(var4);
|
|
||||||
if(var8 < 0) {
|
|
||||||
var5.close();
|
|
||||||
var6.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6.write(var4, 0, var8);
|
|
||||||
} while(!this.closing);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeMinecraft() {
|
|
||||||
this.closing = true;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user