mirror of
https://github.com/catfoolyou/Beta-1.4_01.git
synced 2025-05-31 19:00:57 -05:00
Compile
This commit is contained in:
parent
5c0fd89ae2
commit
95baa017a3
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.gradle/
|
||||
build/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
.idea/.name
generated
2
.idea/.name
generated
@ -1 +1 @@
|
||||
eaglercraft-workspace
|
||||
eaglercraft
|
9
.idea/Beta-1.4_01.iml
generated
Normal file
9
.idea/Beta-1.4_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>
|
3
.idea/compiler.xml
generated
3
.idea/compiler.xml
generated
@ -3,4 +3,7 @@
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="-Xmaxerrs 1000" />
|
||||
</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>
|
BIN
lwjgl-rundir/eaglercraft.jar
Normal file
BIN
lwjgl-rundir/eaglercraft.jar
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
rootProject.name = 'eaglercraft-workspace'
|
||||
rootProject.name = 'eaglercraft'
|
@ -64,7 +64,7 @@ public class LWJGLEntryPoint {
|
||||
|
||||
EagRuntime.create();
|
||||
|
||||
File[] f = new File("resources", "newsound").listFiles();
|
||||
File[] f = new File("resources", "sound").listFiles();
|
||||
|
||||
for(File f1 : f) {
|
||||
addSoundsToAudioMap(f1);
|
||||
|
@ -336,10 +336,10 @@ public class PlatformRuntime {
|
||||
b.append(message2);
|
||||
logger.error(b.toString());
|
||||
|
||||
StackTraceElement[] ex = new RuntimeException().getStackTrace();
|
||||
for (int i = 0; i < ex.length; ++i) {
|
||||
logger.error(" at {}", ex[i]);
|
||||
}
|
||||
// StackTraceElement[] ex = new RuntimeException().getStackTrace();
|
||||
// for (int i = 0; i < ex.length; ++i) {
|
||||
// logger.error(" at {}", ex[i]);
|
||||
// }
|
||||
}
|
||||
}, 0l);
|
||||
|
||||
|
@ -15,7 +15,7 @@ public class TextureNewClockFX extends TextureFX {
|
||||
|
||||
public TextureNewClockFX() {
|
||||
super(Item.pocketSundial.getIconIndex(null));
|
||||
field_1128_f = 1;
|
||||
tileImage = 1;
|
||||
this.clockSpriteSheet = ImageData.loadImageFile(EagRuntime.getRequiredResourceBytes("/sprite_sheet/clock.png")).swapRB().pixels;
|
||||
this.clockSpriteSheetLength = clockSpriteSheet.length / 256;
|
||||
}
|
||||
@ -62,10 +62,10 @@ public class TextureNewClockFX extends TextureFX {
|
||||
|
||||
int offset = var6 * 256;
|
||||
for(int i = 0; i < 256; ++i) {
|
||||
this.field_1127_a[i * 4] = (byte)((clockSpriteSheet[offset + i] >> 16) & 0xFF);
|
||||
this.field_1127_a[i * 4 + 1] = (byte)((clockSpriteSheet[offset + i] >> 8) & 0xFF);
|
||||
this.field_1127_a[i * 4 + 2] = (byte)(clockSpriteSheet[offset + i] & 0xFF);
|
||||
this.field_1127_a[i * 4 + 3] = (byte)((clockSpriteSheet[offset + i] >> 24) & 0xFF);
|
||||
this.imageData[i * 4] = (byte)((clockSpriteSheet[offset + i] >> 16) & 0xFF);
|
||||
this.imageData[i * 4 + 1] = (byte)((clockSpriteSheet[offset + i] >> 8) & 0xFF);
|
||||
this.imageData[i * 4 + 2] = (byte)(clockSpriteSheet[offset + i] & 0xFF);
|
||||
this.imageData[i * 4 + 3] = (byte)((clockSpriteSheet[offset + i] >> 24) & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class TextureNewCompassFX extends TextureFX {
|
||||
public TextureNewCompassFX() {
|
||||
super(Item.compass.getIconIndex(null));
|
||||
mc = Minecraft.getMinecraft();
|
||||
field_1128_f = 1;
|
||||
tileImage = 1;
|
||||
this.compassSpriteSheet = ImageData.loadImageFile(EagRuntime.getRequiredResourceBytes("/sprite_sheet/compass.png")).swapRB().pixels;
|
||||
this.compassSpriteSheetLength = compassSpriteSheet.length / 256;
|
||||
}
|
||||
@ -37,8 +37,8 @@ public class TextureNewCompassFX extends TextureFX {
|
||||
double var10 = 0.0D;
|
||||
|
||||
if (par1World != null && !par8) {
|
||||
double var13 = (double)par1World.spawnX - this.mc.thePlayer.posX;
|
||||
double var15 = (double)par1World.spawnZ - this.mc.thePlayer.posZ;
|
||||
double var13 = (double)par1World.getSpawnPoint().x - this.mc.thePlayer.posX;
|
||||
double var15 = (double)par1World.getSpawnPoint().y - this.mc.thePlayer.posZ;
|
||||
par6 %= 360.0D;
|
||||
var10 = -((par6 - 90.0D) * Math.PI / 180.0D - Math.atan2(var15, var13));
|
||||
|
||||
@ -81,10 +81,10 @@ public class TextureNewCompassFX extends TextureFX {
|
||||
|
||||
int offset = var18 * 256;
|
||||
for(int i = 0; i < 256; ++i) {
|
||||
this.field_1127_a[i * 4] = (byte)((compassSpriteSheet[offset + i] >> 16) & 0xFF);
|
||||
this.field_1127_a[i * 4 + 1] = (byte)((compassSpriteSheet[offset + i] >> 8) & 0xFF);
|
||||
this.field_1127_a[i * 4 + 2] = (byte)((compassSpriteSheet[offset + i]) & 0xFF);
|
||||
this.field_1127_a[i * 4 + 3] = (byte)((compassSpriteSheet[offset + i] >> 24) & 0xFF);
|
||||
this.imageData[i * 4] = (byte)((compassSpriteSheet[offset + i] >> 16) & 0xFF);
|
||||
this.imageData[i * 4 + 1] = (byte)((compassSpriteSheet[offset + i] >> 8) & 0xFF);
|
||||
this.imageData[i * 4 + 2] = (byte)((compassSpriteSheet[offset + i]) & 0xFF);
|
||||
this.imageData[i * 4 + 3] = (byte)((compassSpriteSheet[offset + i] >> 24) & 0xFF);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import net.lax1dude.eaglercraft.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.opengl.WorldRenderer;
|
||||
import net.minecraft.src.GameSettings;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
import net.peyton.eagler.minecraft.FontRenderer;
|
||||
import net.minecraft.src.FontRenderer;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
||||
|
@ -47,7 +47,6 @@ import net.minecraft.src.MouseHelper;
|
||||
import net.minecraft.src.MovementInputFromOptions;
|
||||
import net.minecraft.src.MovingObjectPosition;
|
||||
import net.minecraft.src.NetClientHandler;
|
||||
import net.minecraft.src.OpenGlCapsChecker;
|
||||
import net.minecraft.src.PlayerController;
|
||||
import net.minecraft.src.PlayerControllerTest;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
@ -91,7 +90,6 @@ public class Minecraft {
|
||||
public int displayWidth;
|
||||
public int displayHeight;
|
||||
public float dpi;
|
||||
private OpenGlCapsChecker glCapabilities;
|
||||
private Timer timer = new Timer(20.0F);
|
||||
public World theWorld;
|
||||
public RenderGlobal renderGlobal;
|
||||
@ -226,7 +224,7 @@ public class Minecraft {
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
this.checkGLError("Startup");
|
||||
this.glCapabilities = new OpenGlCapsChecker();
|
||||
// this.glCapabilities = new OpenGlCapsChecker();
|
||||
this.sndManager.loadSoundSettings(this.gameSettings);
|
||||
this.renderEngine.registerTextureFX(this.textureLavaFX);
|
||||
this.renderEngine.registerTextureFX(this.textureWaterFX);
|
||||
@ -1161,9 +1159,6 @@ public class Minecraft {
|
||||
this.theWorld.func_656_j();
|
||||
}
|
||||
|
||||
public OpenGlCapsChecker func_6251_l() {
|
||||
return this.glCapabilities;
|
||||
}
|
||||
|
||||
public String func_6241_m() {
|
||||
return this.renderGlobal.func_953_b();
|
||||
|
@ -1,14 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import net.lax1dude.eaglercraft.internal.buffer.FloatBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
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 {
|
||||
@ -639,9 +637,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);
|
||||
// }
|
||||
|
||||
if(this.mc.theWorld.worldProvider.field_4220_c) {
|
||||
GL11.glFogf(GL11.GL_FOG_START, 0.0F);
|
||||
|
9
src/main/java/net/minecraft/src/EnumOS.java
Normal file
9
src/main/java/net/minecraft/src/EnumOS.java
Normal file
@ -0,0 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public enum EnumOS {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
@ -1,203 +1,629 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.nio.IntBuffer;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class FontRenderer {
|
||||
private int[] charWidth = new int[256];
|
||||
public int fontTextureName = 0;
|
||||
private int fontDisplayLists;
|
||||
private IntBuffer buffer = GLAllocation.createDirectIntBuffer(1024);
|
||||
import net.lax1dude.eaglercraft.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.Random;
|
||||
|
||||
public FontRenderer(GameSettings var1, String var2, RenderEngine var3) {
|
||||
BufferedImage var4;
|
||||
try {
|
||||
var4 = ImageIO.read(RenderEngine.class.getResourceAsStream(var2));
|
||||
} catch (IOException var18) {
|
||||
throw new RuntimeException(var18);
|
||||
import net.lax1dude.eaglercraft.minecraft.FontMappingHelper;
|
||||
import net.lax1dude.eaglercraft.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.opengl.ImageData;
|
||||
import net.lax1dude.eaglercraft.opengl.RealOpenGLEnums;
|
||||
import net.lax1dude.eaglercraft.opengl.Tessellator;
|
||||
import net.lax1dude.eaglercraft.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.opengl.WorldRenderer;
|
||||
import net.minecraft.src.GameSettings;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2025 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class FontRenderer {
|
||||
/**+
|
||||
* Array of width of all the characters in default.png
|
||||
*/
|
||||
protected int[] charWidth = new int[256];
|
||||
/**+
|
||||
* the height in pixels of default text
|
||||
*/
|
||||
public int FONT_HEIGHT = 9;
|
||||
public Random fontRandom = new Random();
|
||||
/**+
|
||||
* Array of RGB triplets defining the 16 standard chat colors
|
||||
* followed by 16 darker version of the same colors for drop
|
||||
* shadows.
|
||||
*/
|
||||
protected int[] colorCode = new int[32];
|
||||
protected float posX;
|
||||
protected float posY;
|
||||
protected float red;
|
||||
protected float blue;
|
||||
protected float green;
|
||||
protected float alpha;
|
||||
protected int textColor;
|
||||
|
||||
protected RenderEngine renderEngine;
|
||||
protected String locationFontTexture;
|
||||
|
||||
protected static char[] codepointLookup = new char[] { 192, 193, 194, 200, 202, 203, 205, 211, 212, 213, 218, 223,
|
||||
227, 245, 287, 304, 305, 338, 339, 350, 351, 372, 373, 382, 519, 0, 0, 0, 0, 0, 0, 0, 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, 96, 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, 0, 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, 9617, 9618,
|
||||
9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500,
|
||||
9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554,
|
||||
9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 945, 946, 915, 960, 931, 963, 956, 964, 934,
|
||||
920, 937, 948, 8734, 8709, 8712, 8745, 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730,
|
||||
8319, 178, 9632, 0 };
|
||||
|
||||
public FontRenderer(GameSettings gameSettingsIn, String s, RenderEngine textureManagerIn) {
|
||||
this.locationFontTexture = s;
|
||||
this.renderEngine = textureManagerIn;
|
||||
GL11.glBindTexture(RealOpenGLEnums.GL_TEXTURE_2D, this.renderEngine.getTexture(s));
|
||||
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
int j = (i >> 3 & 1) * 85;
|
||||
int k = (i >> 2 & 1) * 170 + j;
|
||||
int l = (i >> 1 & 1) * 170 + j;
|
||||
int i1 = (i >> 0 & 1) * 170 + j;
|
||||
if (i == 6) {
|
||||
k += 85;
|
||||
}
|
||||
|
||||
if (gameSettingsIn.anaglyph) {
|
||||
int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
|
||||
int k1 = (k * 30 + l * 70) / 100;
|
||||
int l1 = (k * 30 + i1 * 70) / 100;
|
||||
k = j1;
|
||||
l = k1;
|
||||
i1 = l1;
|
||||
}
|
||||
|
||||
if (i >= 16) {
|
||||
k /= 4;
|
||||
l /= 4;
|
||||
i1 /= 4;
|
||||
}
|
||||
|
||||
this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255;
|
||||
}
|
||||
|
||||
int var5 = var4.getWidth();
|
||||
int var6 = var4.getHeight();
|
||||
int[] var7 = new int[var5 * var6];
|
||||
var4.getRGB(0, 0, var5, var6, var7, 0, var5);
|
||||
readFontTexture();
|
||||
}
|
||||
|
||||
int var9;
|
||||
int var10;
|
||||
int var11;
|
||||
int var12;
|
||||
int var15;
|
||||
int var16;
|
||||
for(int var8 = 0; var8 < 256; ++var8) {
|
||||
var9 = var8 % 16;
|
||||
var10 = var8 / 16;
|
||||
private void readFontTexture() {
|
||||
ImageData bufferedimage = ImageData.loadImageFile(EagRuntime.getResourceStream(this.locationFontTexture));
|
||||
|
||||
for(var11 = 7; var11 >= 0; --var11) {
|
||||
var12 = var9 * 8 + var11;
|
||||
boolean var13 = true;
|
||||
int i = bufferedimage.width;
|
||||
int j = bufferedimage.height;
|
||||
int[] aint = bufferedimage.pixels;
|
||||
int k = j / 16;
|
||||
int l = i / 16;
|
||||
byte b0 = 1;
|
||||
float f = 8.0F / (float) l;
|
||||
|
||||
for(int var14 = 0; var14 < 8 && var13; ++var14) {
|
||||
var15 = (var10 * 8 + var14) * var5;
|
||||
var16 = var7[var12 + var15] & 255;
|
||||
if(var16 > 0) {
|
||||
var13 = false;
|
||||
for (int i1 = 0; i1 < 256; ++i1) {
|
||||
int j1 = i1 % 16;
|
||||
int k1 = i1 / 16;
|
||||
if (i1 == 32) {
|
||||
this.charWidth[i1] = 3 + b0;
|
||||
}
|
||||
|
||||
int l1;
|
||||
for (l1 = l - 1; l1 >= 0; --l1) {
|
||||
int i2 = j1 * l + l1;
|
||||
boolean flag = true;
|
||||
|
||||
for (int j2 = 0; j2 < k && flag; ++j2) {
|
||||
int k2 = (k1 * l + j2) * i;
|
||||
if ((aint[i2 + k2] >> 24 & 255) != 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!var13) {
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(var8 == 32) {
|
||||
var11 = 2;
|
||||
}
|
||||
|
||||
this.charWidth[var8] = var11 + 2;
|
||||
}
|
||||
|
||||
this.fontTextureName = var3.allocateAndSetupTexture(var4);
|
||||
this.fontDisplayLists = GLAllocation.generateDisplayLists(288);
|
||||
Tessellator var19 = Tessellator.instance;
|
||||
|
||||
for(var9 = 0; var9 < 256; ++var9) {
|
||||
GL11.glNewList(this.fontDisplayLists + var9, GL11.GL_COMPILE);
|
||||
var19.startDrawingQuads();
|
||||
var10 = var9 % 16 * 8;
|
||||
var11 = var9 / 16 * 8;
|
||||
float var20 = 7.99F;
|
||||
float var21 = 0.0F;
|
||||
float var23 = 0.0F;
|
||||
var19.addVertexWithUV(0.0D, (double)(0.0F + var20), 0.0D, (double)((float)var10 / 128.0F + var21), (double)(((float)var11 + var20) / 128.0F + var23));
|
||||
var19.addVertexWithUV((double)(0.0F + var20), (double)(0.0F + var20), 0.0D, (double)(((float)var10 + var20) / 128.0F + var21), (double)(((float)var11 + var20) / 128.0F + var23));
|
||||
var19.addVertexWithUV((double)(0.0F + var20), 0.0D, 0.0D, (double)(((float)var10 + var20) / 128.0F + var21), (double)((float)var11 / 128.0F + var23));
|
||||
var19.addVertexWithUV(0.0D, 0.0D, 0.0D, (double)((float)var10 / 128.0F + var21), (double)((float)var11 / 128.0F + var23));
|
||||
var19.draw();
|
||||
GL11.glTranslatef((float)this.charWidth[var9], 0.0F, 0.0F);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
for(var9 = 0; var9 < 32; ++var9) {
|
||||
var10 = (var9 >> 3 & 1) * 85;
|
||||
var11 = (var9 >> 2 & 1) * 170 + var10;
|
||||
var12 = (var9 >> 1 & 1) * 170 + var10;
|
||||
int var22 = (var9 >> 0 & 1) * 170 + var10;
|
||||
if(var9 == 6) {
|
||||
var11 += 85;
|
||||
}
|
||||
|
||||
boolean var24 = var9 >= 16;
|
||||
if(var1.anaglyph) {
|
||||
var15 = (var11 * 30 + var12 * 59 + var22 * 11) / 100;
|
||||
var16 = (var11 * 30 + var12 * 70) / 100;
|
||||
int var17 = (var11 * 30 + var22 * 70) / 100;
|
||||
var11 = var15;
|
||||
var12 = var16;
|
||||
var22 = var17;
|
||||
}
|
||||
|
||||
if(var24) {
|
||||
var11 /= 4;
|
||||
var12 /= 4;
|
||||
var22 /= 4;
|
||||
}
|
||||
|
||||
GL11.glNewList(this.fontDisplayLists + 256 + var9, GL11.GL_COMPILE);
|
||||
GL11.glColor3f((float)var11 / 255.0F, (float)var12 / 255.0F, (float)var22 / 255.0F);
|
||||
GL11.glEndList();
|
||||
++l1;
|
||||
this.charWidth[i1] = (int) (0.5D + (double) ((float) l1 * f)) + b0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawStringWithShadow(String var1, int var2, int var3, int var4) {
|
||||
this.renderString(var1, var2 + 1, var3 + 1, var4, true);
|
||||
this.drawString(var1, var2, var3, var4);
|
||||
private float func_181559_a(char parChar1) {
|
||||
if (parChar1 == 32) {
|
||||
return 4.0F;
|
||||
} else {
|
||||
return this.renderDefaultChar(parChar1);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawString(String var1, int var2, int var3, int var4) {
|
||||
this.renderString(var1, var2, var3, var4, false);
|
||||
/**+
|
||||
* Render a single character with the default.png font at
|
||||
* current (posX,posY) location...
|
||||
*/
|
||||
private VertexFormat format = VertexFormat.createVertexFormat(true, false, false);
|
||||
private float renderDefaultChar(int parInt1) {
|
||||
int i = parInt1 % 16 * 8;
|
||||
int j = parInt1 / 16 * 8;
|
||||
int k = 0;
|
||||
GL11.glBindTexture(RealOpenGLEnums.GL_TEXTURE_2D, this.renderEngine.getTexture(this.locationFontTexture));
|
||||
int l = this.charWidth[parInt1];
|
||||
float f = (float) l - 0.01F;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
|
||||
worldrenderer.begin(Tessellator.GL_TRIANGLE_STRIP, format);
|
||||
|
||||
worldrenderer.pos(this.posX + (float) k, this.posY, 0.0F).tex((float) i / 128.0F, (float) j / 128.0F)
|
||||
.endVertex();
|
||||
|
||||
worldrenderer.pos(this.posX - (float) k, this.posY + 7.99F, 0.0F)
|
||||
.tex((float) i / 128.0F, ((float) j + 7.99F) / 128.0F).endVertex();
|
||||
|
||||
worldrenderer.pos(this.posX + f - 1.0F + (float) k, this.posY, 0.0F)
|
||||
.tex(((float) i + f - 1.0F) / 128.0F, (float) j / 128.0F).endVertex();
|
||||
|
||||
worldrenderer.pos(this.posX + f - 1.0F - (float) k, this.posY + 7.99F, 0.0F)
|
||||
.tex(((float) i + f - 1.0F) / 128.0F, ((float) j + 7.99F) / 128.0F).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
return (float) l;
|
||||
}
|
||||
|
||||
public void renderString(String var1, int var2, int var3, int var4, boolean var5) {
|
||||
if(var1 != null) {
|
||||
int var6;
|
||||
if(var5) {
|
||||
var6 = var4 & -16777216;
|
||||
var4 = (var4 & 16579836) >> 2;
|
||||
var4 += var6;
|
||||
}
|
||||
/**+
|
||||
* Draws the specified string with a shadow.
|
||||
*/
|
||||
public int drawStringWithShadow(String text, float x, float y, int color) {
|
||||
return this.drawString(text, x, y, color, true);
|
||||
}
|
||||
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.fontTextureName);
|
||||
float var10 = (float)(var4 >> 16 & 255) / 255.0F;
|
||||
float var7 = (float)(var4 >> 8 & 255) / 255.0F;
|
||||
float var8 = (float)(var4 & 255) / 255.0F;
|
||||
float var9 = (float)(var4 >> 24 & 255) / 255.0F;
|
||||
if(var9 == 0.0F) {
|
||||
var9 = 1.0F;
|
||||
}
|
||||
/**+
|
||||
* Draws the specified string.
|
||||
*/
|
||||
public int drawString(String text, int x, int y, int color) {
|
||||
return this.drawString(text, (float) x, (float) y, color, false);
|
||||
}
|
||||
|
||||
GL11.glColor4f(var10, var7, var8, var9);
|
||||
this.buffer.clear();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)var2, (float)var3, 0.0F);
|
||||
/**+
|
||||
* Draws the specified string.
|
||||
*/
|
||||
public int drawString(String text, float x, float y, int color, boolean dropShadow) {
|
||||
GlStateManager.enableAlpha();
|
||||
int i;
|
||||
if (dropShadow) {
|
||||
i = this.renderString(text, x + 1.0F, y + 1.0F, color, true);
|
||||
i = Math.max(i, this.renderString(text, x, y, color, false));
|
||||
} else {
|
||||
i = this.renderString(text, x, y, color, false);
|
||||
}
|
||||
|
||||
for(var6 = 0; var6 < var1.length(); ++var6) {
|
||||
int var11;
|
||||
for(; var1.length() > var6 + 1 && var1.charAt(var6) == 167; var6 += 2) {
|
||||
var11 = "0123456789abcdef".indexOf(var1.toLowerCase().charAt(var6 + 1));
|
||||
if(var11 < 0 || var11 > 15) {
|
||||
var11 = 15;
|
||||
return i;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Render a single line string at the current (posX,posY) and
|
||||
* update posX
|
||||
*/
|
||||
protected void renderStringAtPos(String parString1, boolean parFlag) {
|
||||
for (int i = 0; i < parString1.length(); ++i) {
|
||||
char c0 = parString1.charAt(i);
|
||||
if (c0 == 167 && i + 1 < parString1.length()) {
|
||||
int i1 = "0123456789abcdefklmnor".indexOf(Character.toLowerCase(parString1.charAt(i + 1)));
|
||||
if (i1 < 16) {
|
||||
if (i1 < 0 || i1 > 15) {
|
||||
i1 = 15;
|
||||
}
|
||||
|
||||
this.buffer.put(this.fontDisplayLists + 256 + var11 + (var5 ? 16 : 0));
|
||||
if(this.buffer.remaining() == 0) {
|
||||
this.buffer.flip();
|
||||
GL11.glCallLists(this.buffer);
|
||||
this.buffer.clear();
|
||||
if (parFlag) {
|
||||
i1 += 16;
|
||||
}
|
||||
|
||||
int j1 = this.colorCode[i1];
|
||||
this.textColor = j1;
|
||||
GlStateManager.color((float) (j1 >> 16) / 255.0F, (float) (j1 >> 8 & 255) / 255.0F,
|
||||
(float) (j1 & 255) / 255.0F, this.alpha);
|
||||
}else if (i1 == 21) {
|
||||
GlStateManager.color(this.red, this.blue, this.green, this.alpha);
|
||||
}
|
||||
|
||||
if(var6 < var1.length()) {
|
||||
var11 = FontAllowedCharacters.allowedCharacters.indexOf(var1.charAt(var6));
|
||||
if(var11 >= 0) {
|
||||
this.buffer.put(this.fontDisplayLists + var11 + 32);
|
||||
}
|
||||
++i;
|
||||
} else {
|
||||
int j = FontMappingHelper.lookupChar(c0, false);
|
||||
float f1 = 1.0F;
|
||||
boolean flag = (c0 == 0 || j == -1) && parFlag;
|
||||
if (flag) {
|
||||
this.posX -= f1;
|
||||
this.posY -= f1;
|
||||
}
|
||||
|
||||
if(this.buffer.remaining() == 0) {
|
||||
this.buffer.flip();
|
||||
GL11.glCallLists(this.buffer);
|
||||
this.buffer.clear();
|
||||
float f = this.func_181559_a(c0);
|
||||
if (flag) {
|
||||
this.posX += f1;
|
||||
this.posY += f1;
|
||||
}
|
||||
|
||||
this.posX += (float) ((int) f);
|
||||
}
|
||||
|
||||
this.buffer.flip();
|
||||
GL11.glCallLists(this.buffer);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getStringWidth(String var1) {
|
||||
if(var1 == null) {
|
||||
/**+
|
||||
* Render single line string by setting GL color, current
|
||||
* (posX,posY), and calling renderStringAtPos()
|
||||
*/
|
||||
private int renderString(String text, float x, float y, int color, boolean dropShadow) {
|
||||
if (text == null) {
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
} else {
|
||||
if ((color & -67108864) == 0) {
|
||||
color |= -16777216;
|
||||
}
|
||||
|
||||
if (dropShadow) {
|
||||
color = (color & 16579836) >> 2 | color & -16777216;
|
||||
}
|
||||
|
||||
this.red = (float) (color >> 16 & 255) / 255.0F;
|
||||
this.blue = (float) (color >> 8 & 255) / 255.0F;
|
||||
this.green = (float) (color & 255) / 255.0F;
|
||||
this.alpha = (float) (color >> 24 & 255) / 255.0F;
|
||||
GlStateManager.color(this.red, this.blue, this.green, this.alpha);
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.renderStringAtPos(text, dropShadow);
|
||||
}
|
||||
return (int) this.posX;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the width of this string. Equivalent of
|
||||
* FontMetrics.stringWidth(String s).
|
||||
*/
|
||||
public int getStringWidth(String text) {
|
||||
if (text == null) {
|
||||
return 0;
|
||||
} else {
|
||||
int var2 = 0;
|
||||
int i = 0;
|
||||
boolean flag = false;
|
||||
|
||||
for(int var3 = 0; var3 < var1.length(); ++var3) {
|
||||
if(var1.charAt(var3) == 167) {
|
||||
++var3;
|
||||
} else {
|
||||
int var4 = FontAllowedCharacters.allowedCharacters.indexOf(var1.charAt(var3));
|
||||
if(var4 >= 0) {
|
||||
var2 += this.charWidth[var4 + 32];
|
||||
for (int j = 0; j < text.length(); ++j) {
|
||||
char c0 = text.charAt(j);
|
||||
int k = this.getCharWidth(c0);
|
||||
if (k < 0 && j < text.length() - 1) {
|
||||
++j;
|
||||
c0 = text.charAt(j);
|
||||
if (c0 != 108 && c0 != 76) {
|
||||
if (c0 == 114 || c0 == 82) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
k = 0;
|
||||
}
|
||||
|
||||
i += k;
|
||||
if (flag && k > 0) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return var2;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the width of this character as rendered.
|
||||
*/
|
||||
public int getCharWidth(char character) {
|
||||
if (character == 167) {
|
||||
return -1;
|
||||
} else if (character == 32) {
|
||||
return 4;
|
||||
} else {
|
||||
int i = FontMappingHelper.lookupChar(character, false);
|
||||
if (character > 0 && i != -1) {
|
||||
return this.charWidth[i];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Trims a string to fit a specified Width.
|
||||
*/
|
||||
public String trimStringToWidth(String text, int width) {
|
||||
return this.trimStringToWidth(text, width, false);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Trims a string to fit a specified Width.
|
||||
*/
|
||||
public String trimStringToWidth(String text, int width, boolean reverse) {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
int j = reverse ? text.length() - 1 : 0;
|
||||
int k = reverse ? -1 : 1;
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
||||
for (int l = j; l >= 0 && l < text.length() && i < width; l += k) {
|
||||
char c0 = text.charAt(l);
|
||||
int i1 = this.getCharWidth(c0);
|
||||
if (flag) {
|
||||
flag = false;
|
||||
if (c0 != 108 && c0 != 76) {
|
||||
if (c0 == 114 || c0 == 82) {
|
||||
flag1 = false;
|
||||
}
|
||||
} else {
|
||||
flag1 = true;
|
||||
}
|
||||
} else if (i1 < 0) {
|
||||
flag = true;
|
||||
} else {
|
||||
i += i1;
|
||||
if (flag1) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > width) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
stringbuilder.insert(0, c0);
|
||||
} else {
|
||||
stringbuilder.append(c0);
|
||||
}
|
||||
}
|
||||
|
||||
return stringbuilder.toString();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the width of the wordwrapped String (maximum length
|
||||
* is parameter k)
|
||||
*/
|
||||
public int splitStringWidth(String parString1, int parInt1) {
|
||||
return this.FONT_HEIGHT * this.listFormattedStringToWidth(parString1, parInt1).size();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Breaks a string into a list of pieces that will fit a
|
||||
* specified width.
|
||||
*/
|
||||
public List<String> listFormattedStringToWidth(String str, int wrapWidth) {
|
||||
return Arrays.asList(this.wrapFormattedStringToWidth(str, wrapWidth, 0).split("\n"));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Inserts newline and formatting into a string to wrap it
|
||||
* within the specified width.
|
||||
*/
|
||||
String wrapFormattedStringToWidth(String str, int wrapWidth, int depthCheck) { // TODO: fix recursive
|
||||
if (depthCheck > 20) {
|
||||
return str;
|
||||
}
|
||||
int i = this.sizeStringToWidth(str, wrapWidth);
|
||||
if (str.length() <= i) {
|
||||
return str;
|
||||
} else {
|
||||
String s = str.substring(0, i);
|
||||
char c0 = str.charAt(i);
|
||||
boolean flag = c0 == 32 || c0 == 10;
|
||||
String s1 = getFormatFromString(s) + str.substring(i + (flag ? 1 : 0));
|
||||
return s + "\n" + this.wrapFormattedStringToWidth(s1, wrapWidth, ++depthCheck);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Determines how many characters from the string will fit into
|
||||
* the specified width.
|
||||
*/
|
||||
private int sizeStringToWidth(String str, int wrapWidth) {
|
||||
int i = str.length();
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int l = -1;
|
||||
|
||||
for (boolean flag = false; k < i; ++k) {
|
||||
char c0 = str.charAt(k);
|
||||
switch (c0) {
|
||||
case '\n':
|
||||
--k;
|
||||
break;
|
||||
case ' ':
|
||||
l = k;
|
||||
default:
|
||||
j += this.getCharWidth(c0);
|
||||
if (flag) {
|
||||
++j;
|
||||
}
|
||||
break;
|
||||
case '\u00a7':
|
||||
if (k < i - 1) {
|
||||
++k;
|
||||
char c1 = str.charAt(k);
|
||||
if (c1 != 108 && c1 != 76) {
|
||||
if (c1 == 114 || c1 == 82 || isFormatColor(c1)) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c0 == 10) {
|
||||
++k;
|
||||
l = k;
|
||||
break;
|
||||
}
|
||||
|
||||
if (j > wrapWidth) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return k != i && l != -1 && l < k ? l : k;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Checks if the char code is a hexadecimal character, used to
|
||||
* set colour.
|
||||
*/
|
||||
private static boolean isFormatColor(char colorChar) {
|
||||
return colorChar >= 48 && colorChar <= 57 || colorChar >= 97 && colorChar <= 102
|
||||
|| colorChar >= 65 && colorChar <= 70;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Checks if the char code is O-K...lLrRk-o... used to set
|
||||
* special formatting.
|
||||
*/
|
||||
private static boolean isFormatSpecial(char formatChar) {
|
||||
return formatChar >= 107 && formatChar <= 111 || formatChar >= 75 && formatChar <= 79 || formatChar == 114
|
||||
|| formatChar == 82;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Digests a string for nonprinting formatting characters then
|
||||
* returns a string containing only that formatting.
|
||||
*/
|
||||
public static String getFormatFromString(String text) {
|
||||
String s = "";
|
||||
int i = -1;
|
||||
int j = text.length();
|
||||
|
||||
while ((i = text.indexOf(167, i + 1)) != -1) {
|
||||
if (i < j - 1) {
|
||||
char c0 = text.charAt(i + 1);
|
||||
if (isFormatColor(c0)) {
|
||||
s = "\u00a7" + c0;
|
||||
} else if (isFormatSpecial(c0)) {
|
||||
s = s + "\u00a7" + c0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public int getColorCode(char character) {
|
||||
return this.colorCode["0123456789abcdef".indexOf(character)];
|
||||
}
|
||||
|
||||
public void func_27278_a(String var1, int var2, int var3, int var4, int var5) {
|
||||
String[] var6 = var1.split("\n");
|
||||
if(var6.length > 1) {
|
||||
for(int var11 = 0; var11 < var6.length; ++var11) {
|
||||
this.func_27278_a(var6[var11], var2, var3, var4, var5);
|
||||
var3 += this.func_27277_a(var6[var11], var4);
|
||||
}
|
||||
|
||||
} else {
|
||||
String[] var7 = var1.split(" ");
|
||||
int var8 = 0;
|
||||
|
||||
while(var8 < var7.length) {
|
||||
String var9;
|
||||
for(var9 = var7[var8++] + " "; var8 < var7.length && this.getStringWidth(var9 + var7[var8]) < var4; var9 = var9 + var7[var8++] + " ") {
|
||||
}
|
||||
|
||||
int var10;
|
||||
for(; this.getStringWidth(var9) > var4; var9 = var9.substring(var10)) {
|
||||
for(var10 = 0; this.getStringWidth(var9.substring(0, var10 + 1)) <= var4; ++var10) {
|
||||
}
|
||||
|
||||
if(var9.substring(0, var10).trim().length() > 0) {
|
||||
this.drawString(var9.substring(0, var10), var2, var3, var5);
|
||||
var3 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(var9.trim().length() > 0) {
|
||||
this.drawString(var9, var2, var3, var5);
|
||||
var3 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int func_27277_a(String var1, int var2) {
|
||||
String[] var3 = var1.split("\n");
|
||||
int var5;
|
||||
if(var3.length > 1) {
|
||||
int var9 = 0;
|
||||
|
||||
for(var5 = 0; var5 < var3.length; ++var5) {
|
||||
var9 += this.func_27277_a(var3[var5], var2);
|
||||
}
|
||||
|
||||
return var9;
|
||||
} else {
|
||||
String[] var4 = var1.split(" ");
|
||||
var5 = 0;
|
||||
int var6 = 0;
|
||||
|
||||
while(var5 < var4.length) {
|
||||
String var7;
|
||||
for(var7 = var4[var5++] + " "; var5 < var4.length && this.getStringWidth(var7 + var4[var5]) < var2; var7 = var7 + var4[var5++] + " ") {
|
||||
}
|
||||
|
||||
int var8;
|
||||
for(; this.getStringWidth(var7) > var2; var7 = var7.substring(var8)) {
|
||||
for(var8 = 0; this.getStringWidth(var7.substring(0, var8 + 1)) <= var2; ++var8) {
|
||||
}
|
||||
|
||||
if(var7.substring(0, var8).trim().length() > 0) {
|
||||
var6 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(var7.trim().length() > 0) {
|
||||
var6 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(var6 < 8) {
|
||||
var6 += 8;
|
||||
}
|
||||
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
|
||||
public class OpenGlCapsChecker {
|
||||
private static boolean tryCheckOcclusionCapable = false;
|
||||
|
||||
public boolean checkARBOcclusion() {
|
||||
return tryCheckOcclusionCapable && GLContext.getCapabilities().GL_ARB_occlusion_query;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
class OsMap {
|
||||
static final int[] field_1193_a = new int[EnumOS1.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
field_1193_a[EnumOS1.linux.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError var4) {
|
||||
}
|
||||
|
||||
try {
|
||||
field_1193_a[EnumOS1.solaris.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError var3) {
|
||||
}
|
||||
|
||||
try {
|
||||
field_1193_a[EnumOS1.windows.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError var2) {
|
||||
}
|
||||
|
||||
try {
|
||||
field_1193_a[EnumOS1.macos.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError var1) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||
private int renderChunksWide;
|
||||
private int renderChunksTall;
|
||||
private int renderChunksDeep;
|
||||
private int field_1440_s;
|
||||
private int glRenderListBase;
|
||||
private Minecraft mc;
|
||||
private RenderBlocks field_1438_u;
|
||||
private IntBuffer field_1437_v;
|
||||
@ -61,17 +61,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||
this.mc = var1;
|
||||
this.renderEngine = var2;
|
||||
byte var3 = 64;
|
||||
this.field_1440_s = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3);
|
||||
this.occlusionEnabled = var1.func_6251_l().checkARBOcclusion();
|
||||
if(this.occlusionEnabled) {
|
||||
this.field_1456_c.clear();
|
||||
this.field_1437_v = GLAllocation.createDirectIntBuffer(var3 * var3 * var3);
|
||||
this.field_1437_v.clear();
|
||||
this.field_1437_v.position(0);
|
||||
this.field_1437_v.limit(var3 * var3 * var3);
|
||||
//ARBOcclusionQuery.glGenQueriesARB(this.field_1437_v);
|
||||
}
|
||||
|
||||
this.glRenderListBase = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3);
|
||||
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
|
||||
@ -222,7 +212,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||
for(var4 = 0; var4 < this.renderChunksWide; ++var4) {
|
||||
for(int var5 = 0; var5 < this.renderChunksTall; ++var5) {
|
||||
for(int var6 = 0; var6 < this.renderChunksDeep; ++var6) {
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.worldObj, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.field_1440_s + var2);
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.worldObj, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.glRenderListBase + var2);
|
||||
if(this.occlusionEnabled) {
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].field_1732_z = this.field_1437_v.get(var3);
|
||||
}
|
||||
@ -1180,7 +1170,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||
this.mc.ingameGUI.setRecordPlayingMessage("C418 - " + var1);
|
||||
}
|
||||
|
||||
this.mc.sndManager.playStreaming(var1, (float)var2, (float)var3, (float)var4, 1.0F, 1.0F);
|
||||
this.mc.sndManager.playSound(var1, (float)var2, (float)var3, (float)var4, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void playSound(String var1, double var2, double var4, double var6, float var8, float var9) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import net.lax1dude.eaglercraft.internal.buffer.IntBuffer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderList {
|
||||
|
@ -55,7 +55,7 @@ public class SoundManager {
|
||||
|
||||
int var1 = rand.nextInt(newMusic.length);
|
||||
this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
|
||||
String name = "/newmusic/" + newMusic[var1];
|
||||
String name = "/music/" + newMusic[var1];
|
||||
|
||||
IAudioResource trk;
|
||||
if (!music.containsKey(name)) {
|
||||
|
@ -1,144 +1,41 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
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 boolean hasTexture = false;
|
||||
private boolean hasNormals = false;
|
||||
private int rawBufferIndex = 0;
|
||||
private int addedVertices = 0;
|
||||
private boolean isColorDisabled = false;
|
||||
private int drawMode;
|
||||
|
||||
private net.lax1dude.eaglercraft.opengl.WorldRenderer worldRenderer;
|
||||
public static final Tessellator instance = new Tessellator(524288);
|
||||
private VertexFormat format;
|
||||
|
||||
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 boolean renderingChunk;
|
||||
|
||||
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.renderingChunk = false;
|
||||
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;
|
||||
}
|
||||
|
||||
public void startDrawingQuads() {
|
||||
@ -146,23 +43,17 @@ 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 = VertexFormat.createVertexFormat(true, false, false);
|
||||
} else {
|
||||
this.format = VertexFormat.createVertexFormat(true, format.attribColorEnabled, format.attribNormalEnabled);
|
||||
}
|
||||
textureU = var1;
|
||||
textureV = var3;
|
||||
}
|
||||
|
||||
public void setColorOpaque_F(float var1, float var2, float var3) {
|
||||
@ -178,46 +69,16 @@ public class Tessellator {
|
||||
}
|
||||
|
||||
public void setColorRGBA(int var1, int var2, int var3, int var4) {
|
||||
if(!this.isColorDisabled) {
|
||||
if(var1 > 255) {
|
||||
var1 = 255;
|
||||
}
|
||||
|
||||
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;
|
||||
if(ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||
this.color = var4 << 24 | var3 << 16 | var2 << 8 | var1;
|
||||
if(!this.worldRenderer.needsUpdate) {
|
||||
if(this.format == null) {
|
||||
this.format = VertexFormat.createVertexFormat(false, true, false);
|
||||
} else {
|
||||
this.color = var1 << 24 | var2 << 16 | var3 << 8 | var4;
|
||||
this.format = VertexFormat.createVertexFormat(format.attribTextureEnabled, true, format.attribNormalEnabled);
|
||||
}
|
||||
|
||||
this.colorR = var1;
|
||||
this.colorG = var2;
|
||||
this.colorB = var3;
|
||||
this.colorA = var4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,50 +88,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 ? (format = VertexFormat.createVertexFormat(false, false, false)) : format);
|
||||
|
||||
if(this.hasColor) {
|
||||
this.rawBuffer[this.rawBufferIndex + 5] = this.rawBuffer[this.rawBufferIndex - var8 + 5];
|
||||
}
|
||||
worldRenderer.pos(var1 + this.xOffset, var3 + this.yOffset, var5 + this.zOffset);
|
||||
|
||||
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;
|
||||
}
|
||||
if(format.attribTextureEnabled) {
|
||||
worldRenderer.tex(this.textureU, this.textureV);
|
||||
}
|
||||
|
||||
if(this.hasTexture) {
|
||||
this.rawBuffer[this.rawBufferIndex + 3] = Float.floatToRawIntBits((float)this.textureU);
|
||||
this.rawBuffer[this.rawBufferIndex + 4] = Float.floatToRawIntBits((float)this.textureV);
|
||||
if(format.attribColorEnabled ) {
|
||||
worldRenderer.setColorRGBA(colorR, colorG, colorB, colorA);
|
||||
}
|
||||
|
||||
if(this.hasColor) {
|
||||
this.rawBuffer[this.rawBufferIndex + 5] = this.color;
|
||||
}
|
||||
|
||||
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(format.attribNormalEnabled) {
|
||||
worldRenderer.normal(this.normalX, this.normalY, this.normalZ);
|
||||
}
|
||||
|
||||
worldRenderer.endVertex();
|
||||
}
|
||||
|
||||
public void setColorOpaque_I(int var1) {
|
||||
@ -288,19 +122,18 @@ public class Tessellator {
|
||||
}
|
||||
|
||||
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 = VertexFormat.createVertexFormat(false, false, true);
|
||||
} else {
|
||||
this.format = VertexFormat.createVertexFormat(format.attribTextureEnabled, format.attribColorEnabled, true);
|
||||
}
|
||||
|
||||
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;
|
||||
normalX = var1;
|
||||
normalY = var2;
|
||||
normalZ = var3;
|
||||
}
|
||||
|
||||
public void setTranslationD(double var1, double var3, double var5) {
|
||||
@ -314,4 +147,12 @@ public class Tessellator {
|
||||
this.yOffset += (double)var2;
|
||||
this.zOffset += (double)var3;
|
||||
}
|
||||
|
||||
public boolean isRenderingChunk() {
|
||||
return this.renderingChunk;
|
||||
}
|
||||
|
||||
public void setRenderingChunk(boolean renderingChunk) {
|
||||
this.renderingChunk = renderingChunk;
|
||||
}
|
||||
}
|
||||
|
@ -1,629 +0,0 @@
|
||||
package net.peyton.eagler.minecraft;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.lax1dude.eaglercraft.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.Random;
|
||||
|
||||
import net.lax1dude.eaglercraft.minecraft.FontMappingHelper;
|
||||
import net.lax1dude.eaglercraft.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.opengl.ImageData;
|
||||
import net.lax1dude.eaglercraft.opengl.RealOpenGLEnums;
|
||||
import net.lax1dude.eaglercraft.opengl.Tessellator;
|
||||
import net.lax1dude.eaglercraft.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.opengl.WorldRenderer;
|
||||
import net.minecraft.src.GameSettings;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2025 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class FontRenderer {
|
||||
/**+
|
||||
* Array of width of all the characters in default.png
|
||||
*/
|
||||
protected int[] charWidth = new int[256];
|
||||
/**+
|
||||
* the height in pixels of default text
|
||||
*/
|
||||
public int FONT_HEIGHT = 9;
|
||||
public Random fontRandom = new Random();
|
||||
/**+
|
||||
* Array of RGB triplets defining the 16 standard chat colors
|
||||
* followed by 16 darker version of the same colors for drop
|
||||
* shadows.
|
||||
*/
|
||||
protected int[] colorCode = new int[32];
|
||||
protected float posX;
|
||||
protected float posY;
|
||||
protected float red;
|
||||
protected float blue;
|
||||
protected float green;
|
||||
protected float alpha;
|
||||
protected int textColor;
|
||||
|
||||
protected RenderEngine renderEngine;
|
||||
protected String locationFontTexture;
|
||||
|
||||
protected static char[] codepointLookup = new char[] { 192, 193, 194, 200, 202, 203, 205, 211, 212, 213, 218, 223,
|
||||
227, 245, 287, 304, 305, 338, 339, 350, 351, 372, 373, 382, 519, 0, 0, 0, 0, 0, 0, 0, 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, 96, 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, 0, 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, 9617, 9618,
|
||||
9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500,
|
||||
9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554,
|
||||
9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 945, 946, 915, 960, 931, 963, 956, 964, 934,
|
||||
920, 937, 948, 8734, 8709, 8712, 8745, 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730,
|
||||
8319, 178, 9632, 0 };
|
||||
|
||||
public FontRenderer(GameSettings gameSettingsIn, String s, RenderEngine textureManagerIn) {
|
||||
this.locationFontTexture = s;
|
||||
this.renderEngine = textureManagerIn;
|
||||
GL11.glBindTexture(RealOpenGLEnums.GL_TEXTURE_2D, this.renderEngine.getTexture(s));
|
||||
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
int j = (i >> 3 & 1) * 85;
|
||||
int k = (i >> 2 & 1) * 170 + j;
|
||||
int l = (i >> 1 & 1) * 170 + j;
|
||||
int i1 = (i >> 0 & 1) * 170 + j;
|
||||
if (i == 6) {
|
||||
k += 85;
|
||||
}
|
||||
|
||||
if (gameSettingsIn.anaglyph) {
|
||||
int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
|
||||
int k1 = (k * 30 + l * 70) / 100;
|
||||
int l1 = (k * 30 + i1 * 70) / 100;
|
||||
k = j1;
|
||||
l = k1;
|
||||
i1 = l1;
|
||||
}
|
||||
|
||||
if (i >= 16) {
|
||||
k /= 4;
|
||||
l /= 4;
|
||||
i1 /= 4;
|
||||
}
|
||||
|
||||
this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255;
|
||||
}
|
||||
|
||||
readFontTexture();
|
||||
}
|
||||
|
||||
private void readFontTexture() {
|
||||
ImageData bufferedimage = ImageData.loadImageFile(EagRuntime.getResourceStream(this.locationFontTexture));
|
||||
|
||||
int i = bufferedimage.width;
|
||||
int j = bufferedimage.height;
|
||||
int[] aint = bufferedimage.pixels;
|
||||
int k = j / 16;
|
||||
int l = i / 16;
|
||||
byte b0 = 1;
|
||||
float f = 8.0F / (float) l;
|
||||
|
||||
for (int i1 = 0; i1 < 256; ++i1) {
|
||||
int j1 = i1 % 16;
|
||||
int k1 = i1 / 16;
|
||||
if (i1 == 32) {
|
||||
this.charWidth[i1] = 3 + b0;
|
||||
}
|
||||
|
||||
int l1;
|
||||
for (l1 = l - 1; l1 >= 0; --l1) {
|
||||
int i2 = j1 * l + l1;
|
||||
boolean flag = true;
|
||||
|
||||
for (int j2 = 0; j2 < k && flag; ++j2) {
|
||||
int k2 = (k1 * l + j2) * i;
|
||||
if ((aint[i2 + k2] >> 24 & 255) != 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
++l1;
|
||||
this.charWidth[i1] = (int) (0.5D + (double) ((float) l1 * f)) + b0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private float func_181559_a(char parChar1) {
|
||||
if (parChar1 == 32) {
|
||||
return 4.0F;
|
||||
} else {
|
||||
return this.renderDefaultChar(parChar1);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Render a single character with the default.png font at
|
||||
* current (posX,posY) location...
|
||||
*/
|
||||
private VertexFormat format = VertexFormat.createVertexFormat(true, false, false);
|
||||
private float renderDefaultChar(int parInt1) {
|
||||
int i = parInt1 % 16 * 8;
|
||||
int j = parInt1 / 16 * 8;
|
||||
int k = 0;
|
||||
GL11.glBindTexture(RealOpenGLEnums.GL_TEXTURE_2D, this.renderEngine.getTexture(this.locationFontTexture));
|
||||
int l = this.charWidth[parInt1];
|
||||
float f = (float) l - 0.01F;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
|
||||
worldrenderer.begin(Tessellator.GL_TRIANGLE_STRIP, format);
|
||||
|
||||
worldrenderer.pos(this.posX + (float) k, this.posY, 0.0F).tex((float) i / 128.0F, (float) j / 128.0F)
|
||||
.endVertex();
|
||||
|
||||
worldrenderer.pos(this.posX - (float) k, this.posY + 7.99F, 0.0F)
|
||||
.tex((float) i / 128.0F, ((float) j + 7.99F) / 128.0F).endVertex();
|
||||
|
||||
worldrenderer.pos(this.posX + f - 1.0F + (float) k, this.posY, 0.0F)
|
||||
.tex(((float) i + f - 1.0F) / 128.0F, (float) j / 128.0F).endVertex();
|
||||
|
||||
worldrenderer.pos(this.posX + f - 1.0F - (float) k, this.posY + 7.99F, 0.0F)
|
||||
.tex(((float) i + f - 1.0F) / 128.0F, ((float) j + 7.99F) / 128.0F).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
return (float) l;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Draws the specified string with a shadow.
|
||||
*/
|
||||
public int drawStringWithShadow(String text, float x, float y, int color) {
|
||||
return this.drawString(text, x, y, color, true);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Draws the specified string.
|
||||
*/
|
||||
public int drawString(String text, int x, int y, int color) {
|
||||
return this.drawString(text, (float) x, (float) y, color, false);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Draws the specified string.
|
||||
*/
|
||||
public int drawString(String text, float x, float y, int color, boolean dropShadow) {
|
||||
GlStateManager.enableAlpha();
|
||||
int i;
|
||||
if (dropShadow) {
|
||||
i = this.renderString(text, x + 1.0F, y + 1.0F, color, true);
|
||||
i = Math.max(i, this.renderString(text, x, y, color, false));
|
||||
} else {
|
||||
i = this.renderString(text, x, y, color, false);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Render a single line string at the current (posX,posY) and
|
||||
* update posX
|
||||
*/
|
||||
protected void renderStringAtPos(String parString1, boolean parFlag) {
|
||||
for (int i = 0; i < parString1.length(); ++i) {
|
||||
char c0 = parString1.charAt(i);
|
||||
if (c0 == 167 && i + 1 < parString1.length()) {
|
||||
int i1 = "0123456789abcdefklmnor".indexOf(Character.toLowerCase(parString1.charAt(i + 1)));
|
||||
if (i1 < 16) {
|
||||
if (i1 < 0 || i1 > 15) {
|
||||
i1 = 15;
|
||||
}
|
||||
|
||||
if (parFlag) {
|
||||
i1 += 16;
|
||||
}
|
||||
|
||||
int j1 = this.colorCode[i1];
|
||||
this.textColor = j1;
|
||||
GlStateManager.color((float) (j1 >> 16) / 255.0F, (float) (j1 >> 8 & 255) / 255.0F,
|
||||
(float) (j1 & 255) / 255.0F, this.alpha);
|
||||
}else if (i1 == 21) {
|
||||
GlStateManager.color(this.red, this.blue, this.green, this.alpha);
|
||||
}
|
||||
|
||||
++i;
|
||||
} else {
|
||||
int j = FontMappingHelper.lookupChar(c0, false);
|
||||
float f1 = 1.0F;
|
||||
boolean flag = (c0 == 0 || j == -1) && parFlag;
|
||||
if (flag) {
|
||||
this.posX -= f1;
|
||||
this.posY -= f1;
|
||||
}
|
||||
|
||||
float f = this.func_181559_a(c0);
|
||||
if (flag) {
|
||||
this.posX += f1;
|
||||
this.posY += f1;
|
||||
}
|
||||
|
||||
this.posX += (float) ((int) f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**+
|
||||
* Render single line string by setting GL color, current
|
||||
* (posX,posY), and calling renderStringAtPos()
|
||||
*/
|
||||
private int renderString(String text, float x, float y, int color, boolean dropShadow) {
|
||||
if (text == null) {
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
} else {
|
||||
if ((color & -67108864) == 0) {
|
||||
color |= -16777216;
|
||||
}
|
||||
|
||||
if (dropShadow) {
|
||||
color = (color & 16579836) >> 2 | color & -16777216;
|
||||
}
|
||||
|
||||
this.red = (float) (color >> 16 & 255) / 255.0F;
|
||||
this.blue = (float) (color >> 8 & 255) / 255.0F;
|
||||
this.green = (float) (color & 255) / 255.0F;
|
||||
this.alpha = (float) (color >> 24 & 255) / 255.0F;
|
||||
GlStateManager.color(this.red, this.blue, this.green, this.alpha);
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.renderStringAtPos(text, dropShadow);
|
||||
}
|
||||
return (int) this.posX;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the width of this string. Equivalent of
|
||||
* FontMetrics.stringWidth(String s).
|
||||
*/
|
||||
public int getStringWidth(String text) {
|
||||
if (text == null) {
|
||||
return 0;
|
||||
} else {
|
||||
int i = 0;
|
||||
boolean flag = false;
|
||||
|
||||
for (int j = 0; j < text.length(); ++j) {
|
||||
char c0 = text.charAt(j);
|
||||
int k = this.getCharWidth(c0);
|
||||
if (k < 0 && j < text.length() - 1) {
|
||||
++j;
|
||||
c0 = text.charAt(j);
|
||||
if (c0 != 108 && c0 != 76) {
|
||||
if (c0 == 114 || c0 == 82) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
k = 0;
|
||||
}
|
||||
|
||||
i += k;
|
||||
if (flag && k > 0) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the width of this character as rendered.
|
||||
*/
|
||||
public int getCharWidth(char character) {
|
||||
if (character == 167) {
|
||||
return -1;
|
||||
} else if (character == 32) {
|
||||
return 4;
|
||||
} else {
|
||||
int i = FontMappingHelper.lookupChar(character, false);
|
||||
if (character > 0 && i != -1) {
|
||||
return this.charWidth[i];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Trims a string to fit a specified Width.
|
||||
*/
|
||||
public String trimStringToWidth(String text, int width) {
|
||||
return this.trimStringToWidth(text, width, false);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Trims a string to fit a specified Width.
|
||||
*/
|
||||
public String trimStringToWidth(String text, int width, boolean reverse) {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
int j = reverse ? text.length() - 1 : 0;
|
||||
int k = reverse ? -1 : 1;
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
||||
for (int l = j; l >= 0 && l < text.length() && i < width; l += k) {
|
||||
char c0 = text.charAt(l);
|
||||
int i1 = this.getCharWidth(c0);
|
||||
if (flag) {
|
||||
flag = false;
|
||||
if (c0 != 108 && c0 != 76) {
|
||||
if (c0 == 114 || c0 == 82) {
|
||||
flag1 = false;
|
||||
}
|
||||
} else {
|
||||
flag1 = true;
|
||||
}
|
||||
} else if (i1 < 0) {
|
||||
flag = true;
|
||||
} else {
|
||||
i += i1;
|
||||
if (flag1) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > width) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
stringbuilder.insert(0, c0);
|
||||
} else {
|
||||
stringbuilder.append(c0);
|
||||
}
|
||||
}
|
||||
|
||||
return stringbuilder.toString();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the width of the wordwrapped String (maximum length
|
||||
* is parameter k)
|
||||
*/
|
||||
public int splitStringWidth(String parString1, int parInt1) {
|
||||
return this.FONT_HEIGHT * this.listFormattedStringToWidth(parString1, parInt1).size();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Breaks a string into a list of pieces that will fit a
|
||||
* specified width.
|
||||
*/
|
||||
public List<String> listFormattedStringToWidth(String str, int wrapWidth) {
|
||||
return Arrays.asList(this.wrapFormattedStringToWidth(str, wrapWidth, 0).split("\n"));
|
||||
}
|
||||
|
||||
/**+
|
||||
* Inserts newline and formatting into a string to wrap it
|
||||
* within the specified width.
|
||||
*/
|
||||
String wrapFormattedStringToWidth(String str, int wrapWidth, int depthCheck) { // TODO: fix recursive
|
||||
if (depthCheck > 20) {
|
||||
return str;
|
||||
}
|
||||
int i = this.sizeStringToWidth(str, wrapWidth);
|
||||
if (str.length() <= i) {
|
||||
return str;
|
||||
} else {
|
||||
String s = str.substring(0, i);
|
||||
char c0 = str.charAt(i);
|
||||
boolean flag = c0 == 32 || c0 == 10;
|
||||
String s1 = getFormatFromString(s) + str.substring(i + (flag ? 1 : 0));
|
||||
return s + "\n" + this.wrapFormattedStringToWidth(s1, wrapWidth, ++depthCheck);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Determines how many characters from the string will fit into
|
||||
* the specified width.
|
||||
*/
|
||||
private int sizeStringToWidth(String str, int wrapWidth) {
|
||||
int i = str.length();
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int l = -1;
|
||||
|
||||
for (boolean flag = false; k < i; ++k) {
|
||||
char c0 = str.charAt(k);
|
||||
switch (c0) {
|
||||
case '\n':
|
||||
--k;
|
||||
break;
|
||||
case ' ':
|
||||
l = k;
|
||||
default:
|
||||
j += this.getCharWidth(c0);
|
||||
if (flag) {
|
||||
++j;
|
||||
}
|
||||
break;
|
||||
case '\u00a7':
|
||||
if (k < i - 1) {
|
||||
++k;
|
||||
char c1 = str.charAt(k);
|
||||
if (c1 != 108 && c1 != 76) {
|
||||
if (c1 == 114 || c1 == 82 || isFormatColor(c1)) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c0 == 10) {
|
||||
++k;
|
||||
l = k;
|
||||
break;
|
||||
}
|
||||
|
||||
if (j > wrapWidth) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return k != i && l != -1 && l < k ? l : k;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Checks if the char code is a hexadecimal character, used to
|
||||
* set colour.
|
||||
*/
|
||||
private static boolean isFormatColor(char colorChar) {
|
||||
return colorChar >= 48 && colorChar <= 57 || colorChar >= 97 && colorChar <= 102
|
||||
|| colorChar >= 65 && colorChar <= 70;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Checks if the char code is O-K...lLrRk-o... used to set
|
||||
* special formatting.
|
||||
*/
|
||||
private static boolean isFormatSpecial(char formatChar) {
|
||||
return formatChar >= 107 && formatChar <= 111 || formatChar >= 75 && formatChar <= 79 || formatChar == 114
|
||||
|| formatChar == 82;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Digests a string for nonprinting formatting characters then
|
||||
* returns a string containing only that formatting.
|
||||
*/
|
||||
public static String getFormatFromString(String text) {
|
||||
String s = "";
|
||||
int i = -1;
|
||||
int j = text.length();
|
||||
|
||||
while ((i = text.indexOf(167, i + 1)) != -1) {
|
||||
if (i < j - 1) {
|
||||
char c0 = text.charAt(i + 1);
|
||||
if (isFormatColor(c0)) {
|
||||
s = "\u00a7" + c0;
|
||||
} else if (isFormatSpecial(c0)) {
|
||||
s = s + "\u00a7" + c0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public int getColorCode(char character) {
|
||||
return this.colorCode["0123456789abcdef".indexOf(character)];
|
||||
}
|
||||
|
||||
public void func_27278_a(String var1, int var2, int var3, int var4, int var5) {
|
||||
String[] var6 = var1.split("\n");
|
||||
if(var6.length > 1) {
|
||||
for(int var11 = 0; var11 < var6.length; ++var11) {
|
||||
this.func_27278_a(var6[var11], var2, var3, var4, var5);
|
||||
var3 += this.func_27277_a(var6[var11], var4);
|
||||
}
|
||||
|
||||
} else {
|
||||
String[] var7 = var1.split(" ");
|
||||
int var8 = 0;
|
||||
|
||||
while(var8 < var7.length) {
|
||||
String var9;
|
||||
for(var9 = var7[var8++] + " "; var8 < var7.length && this.getStringWidth(var9 + var7[var8]) < var4; var9 = var9 + var7[var8++] + " ") {
|
||||
}
|
||||
|
||||
int var10;
|
||||
for(; this.getStringWidth(var9) > var4; var9 = var9.substring(var10)) {
|
||||
for(var10 = 0; this.getStringWidth(var9.substring(0, var10 + 1)) <= var4; ++var10) {
|
||||
}
|
||||
|
||||
if(var9.substring(0, var10).trim().length() > 0) {
|
||||
this.drawString(var9.substring(0, var10), var2, var3, var5);
|
||||
var3 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(var9.trim().length() > 0) {
|
||||
this.drawString(var9, var2, var3, var5);
|
||||
var3 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int func_27277_a(String var1, int var2) {
|
||||
String[] var3 = var1.split("\n");
|
||||
int var5;
|
||||
if(var3.length > 1) {
|
||||
int var9 = 0;
|
||||
|
||||
for(var5 = 0; var5 < var3.length; ++var5) {
|
||||
var9 += this.func_27277_a(var3[var5], var2);
|
||||
}
|
||||
|
||||
return var9;
|
||||
} else {
|
||||
String[] var4 = var1.split(" ");
|
||||
var5 = 0;
|
||||
int var6 = 0;
|
||||
|
||||
while(var5 < var4.length) {
|
||||
String var7;
|
||||
for(var7 = var4[var5++] + " "; var5 < var4.length && this.getStringWidth(var7 + var4[var5]) < var2; var7 = var7 + var4[var5++] + " ") {
|
||||
}
|
||||
|
||||
int var8;
|
||||
for(; this.getStringWidth(var7) > var2; var7 = var7.substring(var8)) {
|
||||
for(var8 = 0; this.getStringWidth(var7.substring(0, var8 + 1)) <= var2; ++var8) {
|
||||
}
|
||||
|
||||
if(var7.substring(0, var8).trim().length() > 0) {
|
||||
var6 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(var7.trim().length() > 0) {
|
||||
var6 += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(var6 < 8) {
|
||||
var6 += 8;
|
||||
}
|
||||
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
package net.peyton.eagler.minecraft;
|
||||
|
||||
import net.lax1dude.eaglercraft.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.opengl.WorldVertexBufferUploader;
|
||||
|
||||
public class Tessellator {
|
||||
|
||||
private net.lax1dude.eaglercraft.opengl.WorldRenderer worldRenderer;
|
||||
public static final Tessellator instance = new Tessellator(524288);
|
||||
private VertexFormat format;
|
||||
|
||||
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 boolean renderingChunk;
|
||||
|
||||
private Tessellator(int var1) {
|
||||
this.renderingChunk = false;
|
||||
this.worldRenderer = new net.lax1dude.eaglercraft.opengl.WorldRenderer(var1);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
this.worldRenderer.finishDrawing();
|
||||
WorldVertexBufferUploader.func_181679_a(this.worldRenderer);
|
||||
format = null;
|
||||
}
|
||||
|
||||
public void startDrawingQuads() {
|
||||
this.startDrawing(7);
|
||||
}
|
||||
|
||||
public void startDrawing(int var1) {
|
||||
this.worldRenderer.begin(var1);
|
||||
}
|
||||
|
||||
public void setTextureUV(double var1, double var3) {
|
||||
if(this.format == null) {
|
||||
this.format = VertexFormat.createVertexFormat(true, false, false);
|
||||
} else {
|
||||
this.format = VertexFormat.createVertexFormat(true, format.attribColorEnabled, format.attribNormalEnabled);
|
||||
}
|
||||
textureU = var1;
|
||||
textureV = var3;
|
||||
}
|
||||
|
||||
public void setColorOpaque_F(float var1, float var2, float var3) {
|
||||
this.setColorOpaque((int)(var1 * 255.0F), (int)(var2 * 255.0F), (int)(var3 * 255.0F));
|
||||
}
|
||||
|
||||
public void setColorRGBA_F(float var1, float var2, float var3, float var4) {
|
||||
this.setColorRGBA((int)(var1 * 255.0F), (int)(var2 * 255.0F), (int)(var3 * 255.0F), (int)(var4 * 255.0F));
|
||||
}
|
||||
|
||||
public void setColorOpaque(int var1, int var2, int var3) {
|
||||
this.setColorRGBA(var1, var2, var3, 255);
|
||||
}
|
||||
|
||||
public void setColorRGBA(int var1, int var2, int var3, int var4) {
|
||||
if(!this.worldRenderer.needsUpdate) {
|
||||
if(this.format == null) {
|
||||
this.format = VertexFormat.createVertexFormat(false, true, false);
|
||||
} else {
|
||||
this.format = VertexFormat.createVertexFormat(format.attribTextureEnabled, true, format.attribNormalEnabled);
|
||||
}
|
||||
this.colorR = var1;
|
||||
this.colorG = var2;
|
||||
this.colorB = var3;
|
||||
this.colorA = var4;
|
||||
}
|
||||
}
|
||||
|
||||
public void addVertexWithUV(double var1, double var3, double var5, double var7, double var9) {
|
||||
this.setTextureUV(var7, var9);
|
||||
this.addVertex(var1, var3, var5);
|
||||
}
|
||||
|
||||
public void addVertex(double var1, double var3, double var5) {
|
||||
worldRenderer.setVertexFormat(format == null ? (format = VertexFormat.createVertexFormat(false, false, false)) : format);
|
||||
|
||||
worldRenderer.pos(var1 + this.xOffset, var3 + this.yOffset, var5 + this.zOffset);
|
||||
|
||||
if(format.attribTextureEnabled) {
|
||||
worldRenderer.tex(this.textureU, this.textureV);
|
||||
}
|
||||
|
||||
if(format.attribColorEnabled ) {
|
||||
worldRenderer.setColorRGBA(colorR, colorG, colorB, colorA);
|
||||
}
|
||||
|
||||
if(format.attribNormalEnabled) {
|
||||
worldRenderer.normal(this.normalX, this.normalY, this.normalZ);
|
||||
}
|
||||
|
||||
worldRenderer.endVertex();
|
||||
}
|
||||
|
||||
public void setColorOpaque_I(int var1) {
|
||||
int var2 = var1 >> 16 & 255;
|
||||
int var3 = var1 >> 8 & 255;
|
||||
int var4 = var1 & 255;
|
||||
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() {
|
||||
worldRenderer.markDirty();
|
||||
}
|
||||
|
||||
public void setNormal(float var1, float var2, float var3) {
|
||||
if(this.format == null) {
|
||||
this.format = VertexFormat.createVertexFormat(false, false, true);
|
||||
} else {
|
||||
this.format = VertexFormat.createVertexFormat(format.attribTextureEnabled, format.attribColorEnabled, true);
|
||||
}
|
||||
normalX = var1;
|
||||
normalY = var2;
|
||||
normalZ = var3;
|
||||
}
|
||||
|
||||
public void setTranslationD(double var1, double var3, double var5) {
|
||||
this.xOffset = var1;
|
||||
this.yOffset = var3;
|
||||
this.zOffset = var5;
|
||||
}
|
||||
|
||||
public void setTranslationF(float var1, float var2, float var3) {
|
||||
this.xOffset += (double)var1;
|
||||
this.yOffset += (double)var2;
|
||||
this.zOffset += (double)var3;
|
||||
}
|
||||
|
||||
public boolean isRenderingChunk() {
|
||||
return this.renderingChunk;
|
||||
}
|
||||
|
||||
public void setRenderingChunk(boolean renderingChunk) {
|
||||
this.renderingChunk = renderingChunk;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user