FIRST RELEASE 22w17a fixed animated texture lag

This commit is contained in:
LAX1DUDE 2022-05-01 19:50:10 -07:00
parent a9881a5a73
commit 26e026c31c
44 changed files with 9884 additions and 10410 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@ menu.mods=Mods and Texture Packs
menu.options=Options...
menu.quit=Quit Game
menu.editProfile=Edit Profile
menu.exitChat=Exit Chat
selectWorld.title=Select World
selectWorld.empty=empty

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1 @@
8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1 @@
0*2,1*2,2*2,3*2,4*2,5*2,6*2,7*2,8*2,9*2,10*2,11*2,12*2,13*2,14*2,15*2,16*2,17*2,18*2,19*2,18*2,17*2,16*2,15*2,14*2,13*2,12*2,11*2,10*2,9*2,8*2,7*2,6*2,5*2,4*2,3*2,2*2,1*2

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1 @@
0*3,1*3,2*3,3*3,4*3,5*3,6*3,7*3,8*3,9*3,10*3,11*3,12*3,13*3,14*3,15*3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1 @@
0*2,1*2,2*2,3*2,4*2,5*2,6*2,7*2,8*2,9*2,10*2,11*2,12*2,13*2,14*2,15*2,16*2,17*2,18*2,19*2,20*2,21*2,22*2,23*2,24*2,25*2,26*2,27*2,28*2,29*2,30*2,31*2

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -996,10 +996,15 @@ public class EaglerAdapterImpl2 {
}
public static final boolean isFunctionKeyDown(boolean mod, int p1) {
return Keyboard.isKeyDown(p1) || (mod && p1 >= Keyboard.KEY_F1 && p1 <= Keyboard.KEY_F9 && Keyboard.isKeyDown(Keyboard.KEY_1 + (p1 - Keyboard.KEY_F1)));
return Keyboard.getEventKey() == p1 || (mod && p1 >= Keyboard.KEY_F1 && p1 <= Keyboard.KEY_F9 && Keyboard.getEventKey() == (Keyboard.KEY_1 + (p1 - Keyboard.KEY_F1)));
}
public static final boolean isFunctionKeyDown(int mod, int p1) {
return Keyboard.getEventKey() == p1 || (Keyboard.isKeyDown(mod) && p1 >= Keyboard.KEY_F1 && p1 <= Keyboard.KEY_F9 &
Keyboard.getEventKey() == (Keyboard.KEY_1 + (p1 - Keyboard.KEY_F1)));
}
public static final boolean isFunctionKeyHeldDown(int mod, int p1) {
return Keyboard.isKeyDown(p1) || (Keyboard.isKeyDown(mod) && p1 >= Keyboard.KEY_F1 && p1 <= Keyboard.KEY_F9 &
Keyboard.isKeyDown(Keyboard.KEY_1 + (p1 - Keyboard.KEY_F1)));
}

View File

@ -4,8 +4,8 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w15d";
public static final String mainMenuString = "eaglercraft " + version;
public static final String version = "22w17a";
public static final String mainMenuString = "eaglercraft beta-" + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -21,7 +21,12 @@ public class ImportExport {
private static long lastProgressUpdate = 0l;
private static String formatFloat(float f) {
return String.format("%.2f", f);
String ret = Float.toString(f);
int idx = ret.indexOf('.');
if(ret.length() >= (idx + 3)) {
ret = ret.substring(0, idx + 3);
}
return ret;
}
private static void progress(int p) {

View File

@ -0,0 +1,155 @@
package net.lax1dude.eaglercraft.beta;
import java.nio.IntBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage;
import net.minecraft.src.GLAllocation;
public class SpriteSheetTexture {
public final String name;
public final int iconIndex;
public final int iconTileSize;
private IntBuffer buffer = null;
private int dataFrameCount = 0;
private int[] frameSet = null;
public int ticks = 0;
private int[] mipmapOffsets = new int[5];
public SpriteSheetTexture(String name, int iconIndex, int iconTileSize) {
this.name = name;
this.iconIndex = iconIndex;
this.iconTileSize = iconTileSize;
reloadData();
}
public void update() {
ticks = (ticks + 1) % frameSet.length;
}
public IntBuffer grabFrame(int lvl) {
int offWidth = 16 >> lvl;
int step = offWidth * offWidth * iconTileSize * iconTileSize;
int startIndex = mipmapOffsets[lvl] + step * frameSet[ticks];
buffer.limit(startIndex + step);
buffer.position(startIndex);
return buffer;
}
public void reloadData() {
ticks = 0;
buffer = null;
frameSet = null;
byte[] imgBytes = EaglerAdapter.loadResourceBytes("/sprite_sheet/" + name + ".png");
if(imgBytes == null) {
return;
}
int dim = iconTileSize * iconTileSize * 256;
EaglerImage img = EaglerImage.loadImage(imgBytes);
dataFrameCount = img.data.length / dim;
ArrayList<Integer> loadedFrameSet = new ArrayList();
byte[] metaBytes = EaglerAdapter.loadResourceBytes("/sprite_sheet/" + name + ".txt");
if(metaBytes == null) {
for(int i = 0; i < dataFrameCount; ++i) {
loadedFrameSet.add(i);
}
}else {
String str = new String(metaBytes, StandardCharsets.UTF_8);
String[] splitted = str.split("\\s*,\\s*");
for(int i = 0; i < splitted.length; ++i) {
String idxStr = splitted[i];
int z = idxStr.indexOf('*');
if(z != -1) {
int idx = Integer.parseInt(idxStr.substring(0, z));
int c = Integer.parseInt(idxStr.substring(z + 1));
for(int j = 0; j < c; ++j) {
loadedFrameSet.add(idx);
}
}else {
loadedFrameSet.add(Integer.parseInt(idxStr));
}
}
}
frameSet = new int[loadedFrameSet.size()];
for(int i = 0; i < frameSet.length; ++i) {
frameSet[i] = loadedFrameSet.get(i).intValue();
}
buffer = GLAllocation.createDirectIntBuffer(
16 * 16 * dataFrameCount * iconTileSize * iconTileSize +
8 * 8 * dataFrameCount * iconTileSize * iconTileSize +
4 * 4 * dataFrameCount * iconTileSize * iconTileSize +
2 * 2 * dataFrameCount * iconTileSize * iconTileSize +
dataFrameCount * iconTileSize * iconTileSize
);
int[] texData = swapRB(img.data);
mipmapOffsets[0] = 0;
buffer.put(texData);
mipmapOffsets[1] = buffer.position();
texData = downscale(texData, 16 * iconTileSize, 16 * iconTileSize * dataFrameCount);
buffer.put(texData);
mipmapOffsets[2] = buffer.position();
texData = downscale(texData, 8 * iconTileSize, 8 * iconTileSize * dataFrameCount);
buffer.put(texData);
mipmapOffsets[3] = buffer.position();
texData = downscale(texData, 4 * iconTileSize, 4 * iconTileSize * dataFrameCount);
buffer.put(texData);
mipmapOffsets[4] = buffer.position();
texData = downscale(texData, 2 * iconTileSize, 2 * iconTileSize * dataFrameCount);
buffer.put(texData);
}
private static int[] downscale(int[] in, int sw, int sh) {
int dw = sw / 2;
int dh = sh / 2;
int[] ret = new int[dw * dh];
for(int y = 0; y < dh; ++y) {
for(int x = 0; x < dw; ++x) {
int a = in[((x * 2) + (y * 2) * sw)];
int b = in[((x * 2 + 1) + (y * 2) * sw)];
int c = in[((x * 2 + 1) + (y * 2 + 1) * sw)];
int d = in[((x * 2) + (y * 2 + 1) * sw)];
int b1= (((a >> 26) & 0x3F)) +
(((b >> 26) & 0x3F)) +
(((c >> 26) & 0x3F)) +
(((d >> 26) & 0x3F));
int b2= (((a >> 18) & 0x3F)) +
(((b >> 18) & 0x3F)) +
(((c >> 18) & 0x3F)) +
(((d >> 18) & 0x3F));
int b3= (((a >> 10) & 0x3F)) +
(((b >> 10) & 0x3F)) +
(((c >> 10) & 0x3F)) +
(((d >> 10) & 0x3F));
int b4= (((a >> 2) & 0x3F)) +
(((b >> 2) & 0x3F)) +
(((c >> 2) & 0x3F)) +
(((d >> 2) & 0x3F));
ret[y * dw + x] = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
}
}
return ret;
}
private static int[] swapRB(int[] in) {
int[] out = new int[in.length];
for(int i = 0; i < in.length; ++i) {
int r = (in[i] >> 16) & 0xFF;
int b = in[i] & 0xFF;
out[i] = (in[i] & 0xFF00FF00) | (b << 16) | r;
}
return out;
}
}

View File

@ -0,0 +1,72 @@
package net.lax1dude.eaglercraft.beta;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Item;
import net.minecraft.src.TextureFX;
public class TextureNewClockFX extends TextureFX {
private final int[] clockSpriteSheet;
private final int clockSpriteSheetLength;
private float field_94239_h;
private float field_94240_i;
public TextureNewClockFX() {
super(Item.pocketSundial.getIconIndex(null));
tileImage = 1;
this.clockSpriteSheet = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/sprite_sheet/clock.png")).data;
this.clockSpriteSheetLength = clockSpriteSheet.length / 256;
}
public void onTick() {
Minecraft var1 = Minecraft.getMinecraft();
double var2 = 0.0D;
if (var1.theWorld != null && var1.thePlayer != null) {
float var4 = var1.theWorld.getCelestialAngle(1.0F);
var2 = (double) var4;
if (!var1.theWorld.worldProvider.isSurfaceWorld()) {
var2 = Math.random();
}
}
double var7;
for (var7 = var2 - this.field_94239_h; var7 < -0.5D; ++var7) {
;
}
while (var7 >= 0.5D) {
--var7;
}
if (var7 < -1.0D) {
var7 = -1.0D;
}
if (var7 > 1.0D) {
var7 = 1.0D;
}
this.field_94240_i += var7 * 0.1D;
this.field_94240_i *= 0.8D;
this.field_94239_h += this.field_94240_i;
int var6;
for (var6 = (int) ((this.field_94239_h + 1.0D) * (double) clockSpriteSheetLength) % clockSpriteSheetLength; var6 < 0; var6 = (var6 + clockSpriteSheetLength) % clockSpriteSheetLength) {
;
}
int offset = var6 * 256;
for(int i = 0; i < 256; ++i) {
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);
}
}
}

View File

@ -0,0 +1,96 @@
package net.lax1dude.eaglercraft.beta;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage;
import net.minecraft.client.Minecraft;
import net.minecraft.src.ChunkCoordinates;
import net.minecraft.src.Item;
import net.minecraft.src.TextureFX;
import net.minecraft.src.World;
public class TextureNewCompassFX extends TextureFX {
private final int[] compassSpriteSheet;
private final int compassSpriteSheetLength;
private float angleDelta = 0.0f;
private float currentAngle = 0.0f;
public TextureNewCompassFX() {
super(Item.compass.getIconIndex(null));
tileImage = 1;
this.compassSpriteSheet = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/sprite_sheet/compass.png")).data;
this.compassSpriteSheetLength = compassSpriteSheet.length / 256;
}
public void onTick() {
Minecraft var1 = Minecraft.getMinecraft();
if (var1.theWorld != null && var1.thePlayer != null) {
this.updateCompass(var1.theWorld, var1.thePlayer.posX, var1.thePlayer.posZ, (double) var1.thePlayer.rotationYaw, false, false);
} else {
this.updateCompass((World) null, 0.0D, 0.0D, 0.0D, true, false);
}
}
public void updateCompass(World par1World, double par2, double par4, double par6, boolean par8, boolean par9) {
double var10 = 0.0D;
if (par1World != null && !par8) {
ChunkCoordinates var12 = par1World.func_22137_s();
double var13 = (double) var12.field_22395_a - par2;
double var15 = (double) var12.field_22396_c - par4;
par6 %= 360.0D;
var10 = -((par6 - 90.0D) * Math.PI / 180.0D - Math.atan2(var15, var13));
if (!par1World.worldProvider.isSurfaceWorld()) {
var10 = Math.random() * Math.PI * 2.0D;
}
}
if (par9) {
this.currentAngle = (float) var10;
} else {
double var17;
for (var17 = var10 - this.currentAngle; var17 < -Math.PI; var17 += (Math.PI * 2D)) {
;
}
while (var17 >= Math.PI) {
var17 -= (Math.PI * 2D);
}
if (var17 < -1.0D) {
var17 = -1.0D;
}
if (var17 > 1.0D) {
var17 = 1.0D;
}
this.angleDelta += var17 * 0.1D;
this.angleDelta *= 0.8D;
this.currentAngle += this.angleDelta;
}
int var18;
for (var18 = (int) ((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double) compassSpriteSheetLength) % compassSpriteSheetLength; var18 < 0; var18 = (var18 + compassSpriteSheetLength) % compassSpriteSheetLength) {
;
}
int offset = var18 * 256;
for(int i = 0; i < 256; ++i) {
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);
}
//if (var18 != this.frameCounter) {
// this.frameCounter = var18;
// this.textureSheet.func_104062_b(this.originX, this.originY, (Texture) this.textureList.get(this.frameCounter));
//}
}
}

View File

@ -9,6 +9,8 @@ import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.lax1dude.eaglercraft.beta.EaglercraftSaveManager;
import net.lax1dude.eaglercraft.beta.SingleplayerCommands;
import net.lax1dude.eaglercraft.beta.TextureNewClockFX;
import net.lax1dude.eaglercraft.beta.TextureNewCompassFX;
import net.minecraft.src.*;
public abstract class Minecraft implements Runnable {
@ -32,8 +34,6 @@ public abstract class Minecraft implements Runnable {
field_9242_w = new ModelBiped(0.0F);
objectMouseOver = null;
sndManager = new SoundManager();
textureWaterFX = new TextureWaterFX();
textureLavaFX = new TextureLavaFX();
running = true;
debug = "";
isTakingScreenshot = false;
@ -83,15 +83,30 @@ public abstract class Minecraft implements Runnable {
checkGLError("Startup");
glCapabilities = new OpenGlCapsChecker();
sndManager.loadSoundSettings(gameSettings);
renderEngine.registerTextureFX(textureLavaFX);
renderEngine.registerTextureFX(textureWaterFX);
renderEngine.registerTextureFX(new TexturePortalFX());
renderEngine.registerTextureFX(new TextureCompassFX(this));
renderEngine.registerTextureFX(new TextureWatchFX(this));
renderEngine.registerTextureFX(new TextureWaterFlowFX());
renderEngine.registerTextureFX(new TextureLavaFlowFX());
renderEngine.registerTextureFX(new TextureFlamesFX(0));
renderEngine.registerTextureFX(new TextureFlamesFX(1));
renderEngine.registerTextureFX(new TextureNewCompassFX());
renderEngine.registerTextureFX(new TextureNewClockFX());
renderEngine.registerSpriteSheet("portal", Block.portal.blockIndexInTexture, 1);
renderEngine.registerSpriteSheet("water", Block.waterStill.blockIndexInTexture, 1);
renderEngine.registerSpriteSheet("water_flow", Block.waterMoving.blockIndexInTexture + 1, 2);
renderEngine.registerSpriteSheet("lava", Block.lavaStill.blockIndexInTexture, 1);
renderEngine.registerSpriteSheet("lava_flow", Block.lavaMoving.blockIndexInTexture + 1, 2);
renderEngine.registerSpriteSheet("fire_0", Block.fire.blockIndexInTexture, 1);
renderEngine.registerSpriteSheet("fire_1", Block.fire.blockIndexInTexture + 16, 1);
/*
renderEngine.registerPXSpriteSheet("/sprite_sheet/portal.png.px", Block.portal.blockIndexInTexture, 1);
renderEngine.registerPXSpriteSheet("/sprite_sheet/water.px", Block.waterStill.blockIndexInTexture, 1);
renderEngine.registerPXSpriteSheet("/sprite_sheet/water_flow.px", Block.waterMoving.blockIndexInTexture, 2);
renderEngine.registerPXSpriteSheet("/sprite_sheet/lava.px", Block.lavaStill.blockIndexInTexture, 1);
renderEngine.registerPXSpriteSheet("/sprite_sheet/lava_flow.px", Block.lavaMoving.blockIndexInTexture, 2);
renderEngine.registerPXSpriteSheet("/sprite_sheet/fire.px", Block.fire.blockIndexInTexture, 1);
renderEngine.registerPXOffsetSpriteSheet("/sprite_sheet/fire.px", Block.fire.blockIndexInTexture + 16, 23);
*/
//renderEngine.registerTextureFX(new TexturePortalFX());
//renderEngine.registerTextureFX(new TextureWaterFlowFX());
//renderEngine.registerTextureFX(new TextureLavaFlowFX());
//renderEngine.registerTextureFX(new TextureFlamesFX(0));
//renderEngine.registerTextureFX(new TextureFlamesFX(1));
renderGlobal = new RenderGlobal(this, renderEngine);
EaglerAdapter.glViewport(0, 0, displayWidth, displayHeight);
effectRenderer = new EffectRenderer(theWorld, renderEngine);
@ -563,6 +578,12 @@ public abstract class Minecraft implements Runnable {
}
if (!isWorldLoaded && theWorld != null) {
playerController.updateController();
if(++holdStillTimer == 150) {
if (thePlayer != null) {
ingameGUI.addChatMessage("Note, the game can lag when chunks are generated");
ingameGUI.addChatMessage("hold still for a few moments and the lag will stop");
}
}
}
terrainTexture.bindTexture();
if (!isWorldLoaded) {
@ -636,35 +657,44 @@ public abstract class Minecraft implements Runnable {
}
thePlayer.handleKeyPress(EaglerAdapter.getEventKey(), EaglerAdapter.getEventKeyState());
if (EaglerAdapter.getEventKeyState()) {
if (EaglerAdapter.getEventKey() == 31 && EaglerAdapter.isFunctionKeyHeldDown(gameSettings.keyBindFunction.keyCode, 61)) {
forceReload();
continue;
}
if (currentScreen != null) {
currentScreen.handleKeyboardInput();
} else {
if (EaglerAdapter.getEventKey() == 1) {
func_6252_g();
}
if (EaglerAdapter.getEventKey() == 31 && EaglerAdapter.isFunctionKeyDown(gameSettings.keyBindFunction.keyCode, 61)) {
forceReload();
continue;
}
if (EaglerAdapter.isFunctionKeyDown(gameSettings.keyBindFunction.keyCode, 59)) {
gameSettings.field_22277_y = !gameSettings.field_22277_y;
continue;
}
if (EaglerAdapter.isFunctionKeyDown(gameSettings.keyBindFunction.keyCode, 61)) {
gameSettings.showDebugInfo = !gameSettings.showDebugInfo;
continue;
}
if (EaglerAdapter.isFunctionKeyDown(gameSettings.keyBindFunction.keyCode, 63)) {
gameSettings.thirdPersonView = !gameSettings.thirdPersonView;
continue;
}
if (EaglerAdapter.isFunctionKeyDown(gameSettings.keyBindFunction.keyCode, 66)) {
gameSettings.field_22274_D = !gameSettings.field_22274_D;
continue;
}
if (EaglerAdapter.getEventKey() == gameSettings.keyBindInventory.keyCode) {
displayGuiScreen(new GuiInventory(thePlayer));
continue;
}
if (EaglerAdapter.getEventKey() == gameSettings.keyBindDrop.keyCode) {
thePlayer.dropCurrentItem();
continue;
}
if (EaglerAdapter.getEventKey() == gameSettings.keyBindChat.keyCode) {
displayGuiScreen(new GuiChat());
continue;
}
}
for (int i = 0; i < 9; i++) {
@ -734,6 +764,8 @@ public abstract class Minecraft implements Runnable {
System.out.println("FORCING RELOAD!");
sndManager = new SoundManager();
sndManager.loadSoundSettings(gameSettings);
renderEngine.refreshTextures();
renderGlobal.loadRenderers();
}
public boolean isMultiplayerWorld() {
@ -749,6 +781,7 @@ public abstract class Minecraft implements Runnable {
}
public void startWorld(String s, String s1, long l) {
holdStillTimer = 0;
changeWorld1(null);
System.gc();
if (field_22008_V.worldNeedsConvert_maybe(s)) {
@ -1030,8 +1063,6 @@ public abstract class Minecraft implements Runnable {
public static int numRecordedFrameTimes = 0;
private String serverName;
private int serverPort;
private TextureWaterFX textureWaterFX;
private TextureLavaFX textureLavaFX;
public volatile boolean running;
public String debug;
boolean isTakingScreenshot;
@ -1042,6 +1073,7 @@ public abstract class Minecraft implements Runnable {
long systemTime;
private int field_6300_ab;
private boolean awaitPointerLock;
public int holdStillTimer = 0;
private static Minecraft instance = null;

View File

@ -46,17 +46,16 @@ public class GLAllocation {
textureNames.clear();
}
public static synchronized ByteBuffer createDirectByteBuffer(int i) {
ByteBuffer bytebuffer = ByteBuffer.allocateDirect(i).order(ByteOrder.nativeOrder());
return bytebuffer;
public static ByteBuffer createDirectByteBuffer(int par0) {
return EaglerAdapter.isWebGL ? ByteBuffer.wrap(new byte[par0]).order(ByteOrder.nativeOrder()) : ByteBuffer.allocateDirect(par0).order(ByteOrder.nativeOrder());
}
public static IntBuffer createDirectIntBuffer(int i) {
return createDirectByteBuffer(i << 2).asIntBuffer();
public static IntBuffer createDirectIntBuffer(int par0) {
return EaglerAdapter.isWebGL ? IntBuffer.wrap(new int[par0]) : createDirectByteBuffer(par0 << 2).asIntBuffer();
}
public static FloatBuffer createDirectFloatBuffer(int i) {
return createDirectByteBuffer(i << 2).asFloatBuffer();
public static FloatBuffer createDirectFloatBuffer(int par0) {
return EaglerAdapter.isWebGL ? FloatBuffer.wrap(new float[par0]) : createDirectByteBuffer(par0 << 2).asFloatBuffer();
}
private static List displayLists = new ArrayList();

View File

@ -10,6 +10,7 @@ public class GuiChat extends GuiScreen {
public void initGui() {
EaglerAdapter.enableRepeatEvents(true);
controlList.add(new GuiButton(0, width - 110, 10, 100, 20, StringTranslate.getInstance().translateKey("menu.exitChat")));
}
public void onGuiClosed() {
@ -38,6 +39,17 @@ public class GuiChat extends GuiScreen {
this.mc.displayGuiScreen(null);
return;
}
if((int)c == 16 || (GuiScreen.isCtrlKeyDown() && n == 47)) {
String string = GuiScreen.getClipboardString();
if (string == null) {
string = "";
}
this.field_985_a = this.field_985_a + string;
if(this.field_985_a.length() > 100) {
this.field_985_a = this.field_985_a.substring(0, 100);
}
return;
}
if (n == 14 && this.field_985_a.length() > 0) {
this.field_985_a = this.field_985_a.substring(0, this.field_985_a.length() - 1);
}
@ -51,6 +63,13 @@ public class GuiChat extends GuiScreen {
this.drawString(this.fontRenderer, "> " + this.field_985_a + (this.field_986_h / 6 % 2 == 0 ? "_" : ""), 4,
this.height - 12, 0xE0E0E0);
super.drawScreen(n, n2, f);
// debug code that displays the block texture map:
//EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
//TextureFX.terrainTexture.bindTexture();
//this.drawTexturedModalRect(0, 0, 0, 0, 256, 256);
//EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
}
protected void mouseClicked(int n, int n2, int n3) {
@ -70,6 +89,12 @@ public class GuiChat extends GuiScreen {
}
}
protected void actionPerformed(GuiButton bnt) {
if(bnt.id == 0) {
mc.displayGuiScreen(null);
}
}
public boolean doesGuiPauseGame() {
return false;
}

View File

@ -1,5 +1,7 @@
package net.minecraft.src;
import net.lax1dude.eaglercraft.EaglerAdapter;
// Decompiled with: CFR 0.152
// Class Version: 5
public class GuiDisableButton extends Gui {
@ -40,7 +42,7 @@ public class GuiDisableButton extends Gui {
return;
}
if ((int)c == 16) {
if ((int)c == 16 || (GuiScreen.isCtrlKeyDown() && n == 47)) {
int n2;
String string = GuiScreen.getClipboardString();
if (string == null) {

View File

@ -1,6 +1,8 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
import net.lax1dude.eaglercraft.ConfigConstants;
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
@ -19,26 +21,6 @@ public class GuiMainMenu extends GuiScreen {
public GuiMainMenu() {
updateCounter = 0.0F;
splashText = "Singleplayer!";
/*
try {
ArrayList arraylist = new ArrayList();
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(
(GuiMainMenu.class).getResourceAsStream("/title/splashes.txt"), Charset.forName("UTF-8")));
String s = "";
do {
String s1;
if ((s1 = bufferedreader.readLine()) == null) {
break;
}
s1 = s1.trim();
if (s1.length() > 0) {
arraylist.add(s1);
}
} while (true);
splashText = (String) arraylist.get(rand.nextInt(arraylist.size()));
} catch (Exception exception) {
}
*/
}
public void updateScreen() {
@ -111,6 +93,22 @@ public class GuiMainMenu extends GuiScreen {
//String s = "Copyright Mojang AB. Do not distribute.";
String s = "site resources - Copyright Mojang AB.";
drawString(fontRenderer, s, width - fontRenderer.getStringWidth(s) - 2, height - 10, 0xffffff);
drawString(fontRenderer, ConfigConstants.mainMenuString, 2, height - 10, 0xffffff);
EaglerAdapter.glPushMatrix();
float ff = 0.75f;
EaglerAdapter.glScalef(ff, ff, ff);
String str = "DO NOT DM LAX1DUDE WITH QUESTIONS/COMPLAINTS";
int w = fontRenderer.getStringWidth(str);
drawString(fontRenderer, str, (int)(((width / ff) - w) / 2), (int)((height / 4 + 102) / ff), 0xffeeee);
str = "HE IS BUSY, HE WILL NOT ANSWER";
w = fontRenderer.getStringWidth(str);
drawString(fontRenderer, str, (int)(((width / ff) - w) / 2), (int)((height / 4 + 112) / ff), 0xffeeee);
EaglerAdapter.glPopMatrix();
super.drawScreen(i, j, f);
}

View File

@ -151,6 +151,14 @@ public class GuiScreen extends Gui {
public void confirmClicked(boolean flag, int i) {
}
public static boolean isCtrlKeyDown() {
return EaglerAdapter.isKeyDown(29) || EaglerAdapter.isKeyDown(157);
}
public static boolean isShiftKeyDown() {
return EaglerAdapter.isKeyDown(42) || EaglerAdapter.isKeyDown(54);
}
protected Minecraft mc;
public int width;
public int height;

View File

@ -20,8 +20,13 @@ public class MouseHelper {
}
public void mouseXYChange() {
deltaX = EaglerAdapter.mouseGetDX();
deltaY = EaglerAdapter.mouseGetDY();
if(EaglerAdapter.isPointerLocked()) {
deltaX = EaglerAdapter.mouseGetDX();
deltaY = EaglerAdapter.mouseGetDY();
}else {
deltaX = 0;
deltaY = 0;
}
}
public int deltaX;

View File

@ -171,7 +171,7 @@ public class NBTTagCompound extends NBTBase {
}
public boolean hasNoTags() {
return tagMap.size() >= 0;
return tagMap.size() == 0;
}
private Map tagMap;

View File

@ -10,11 +10,13 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.beta.SpriteSheetTexture;
public class RenderEngine {
@ -22,11 +24,11 @@ public class RenderEngine {
textureMap = new HashMap();
textureNameToImageMap = new HashMap();
singleIntBuffer = GLAllocation.createDirectIntBuffer(1);
imageDataA = GLAllocation.createDirectByteBuffer(0x100000);
imageDataB1 = GLAllocation.createDirectByteBuffer(0x100000);
imageDataB2 = GLAllocation.createDirectByteBuffer(0x100000);
//imageDataInt = GLAllocation.createDirectIntBuffer(0x40000);
textureList = new ArrayList();
urlToImageDataMap = new HashMap();
textureSpriteList = new ArrayList();
clampTexture = false;
blurTexture = false;
field_6527_k = texturepacklist;
@ -67,19 +69,7 @@ public class RenderEngine {
throw new RuntimeException("!!");
}
}
/*
private BufferedImage unwrapImageByColumns(BufferedImage bufferedimage) {
int i = bufferedimage.getWidth() / 16;
BufferedImage bufferedimage1 = new BufferedImage(16, bufferedimage.getHeight() * i, 2);
Graphics g = bufferedimage1.getGraphics();
for (int j = 0; j < i; j++) {
g.drawImage(bufferedimage, -j * 16, j * bufferedimage.getHeight(), null);
}
g.dispose();
return bufferedimage1;
}
*/
public int allocateAndSetupTexture(EaglerImage bufferedimage) {
singleIntBuffer.clear();
GLAllocation.generateTextureNames(singleIntBuffer);
@ -170,125 +160,99 @@ public class RenderEngine {
}
public int getTextureForDownloadableImage(String s, String s1) {
/*
ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) urlToImageDataMap.get(s);
if (threaddownloadimagedata != null && threaddownloadimagedata.image != null
&& !threaddownloadimagedata.textureSetupComplete) {
if (threaddownloadimagedata.textureName < 0) {
threaddownloadimagedata.textureName = allocateAndSetupTexture(threaddownloadimagedata.image);
} else {
setupTexture(threaddownloadimagedata.image, threaddownloadimagedata.textureName);
}
threaddownloadimagedata.textureSetupComplete = true;
}
if (threaddownloadimagedata == null || threaddownloadimagedata.textureName < 0) {
if (s1 == null) {
return getTexture("/mob/char.png");
} else {
return getTexture(s1);
}
} else {
return threaddownloadimagedata.textureName;
}
*/
return getTexture("/mob/char.png");
}
/*
public ThreadDownloadImageData obtainImageData(String s, ImageBuffer imagebuffer) {
ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) urlToImageDataMap.get(s);
if (threaddownloadimagedata == null) {
urlToImageDataMap.put(s, new ThreadDownloadImageData(s, imagebuffer));
} else {
threaddownloadimagedata.referenceCount++;
}
return threaddownloadimagedata;
}
public void releaseImageData(String s) {
ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) urlToImageDataMap.get(s);
if (threaddownloadimagedata != null) {
threaddownloadimagedata.referenceCount--;
if (threaddownloadimagedata.referenceCount == 0) {
if (threaddownloadimagedata.textureName >= 0) {
deleteTexture(threaddownloadimagedata.textureName);
}
urlToImageDataMap.remove(s);
}
}
}
*/
public void registerTextureFX(TextureFX texturefx) {
textureList.add(texturefx);
texturefx.onTick();
}
public void updateTerrainTextures() {
for (int i = 0; i < textureList.size(); i++) {
TextureFX texturefx = (TextureFX) textureList.get(i);
texturefx.anaglyphEnabled = options.anaglyph;
texturefx.onTick();
int tileSize = 16 * 16 * 4;
imageDataA.clear();
imageDataA.put(texturefx.imageData);
imageDataA.position(0).limit(tileSize);
texturefx.bindImage(this);
imageDataA.position(0).limit(tileSize);
for (int k = 0; k < texturefx.tileSize; k++) {
for (int i1 = 0; i1 < texturefx.tileSize; i1++) {
int idx = texturefx.iconIndex + k + i1 * 16;
imageDataA.mark();
EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 0, (idx % 16) * 16, (idx / 16) * 16, 16, 16, 6408 /* GL_RGBA */,
5121 /* GL_UNSIGNED_BYTE */, imageDataA);
imageDataA.rewind();
}
}
if(texturefx.tileImage == 0) {
imageDataA.position(0).limit(tileSize);
imageDataB1.clear();
imageDataB1.put(imageDataA);
imageDataB1.flip();
int k1 = 1;
do {
if (k1 > 4) {
break;
}
int i2 = 16 >> k1 - 1;
int k2 = 16 >> k1;
imageDataB2.clear();
for (int i3 = 0; i3 < k2; i3++) {
for (int k3 = 0; k3 < k2; k3++) {
int i4 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 0) * i2) * 4);
int k4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 0) * i2) * 4);
int i5 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 1) * i2) * 4);
int k5 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 1) * i2) * 4);
int l5 = averageColor(averageColor(i4, k4), averageColor(i5, k5));
imageDataB2.putInt((i3 + k3 * k2) * 4, l5);
}
}
for (int k = 0; k < texturefx.tileSize; k++) {
for (int i1 = 0; i1 < texturefx.tileSize; i1++) {
int idx = texturefx.iconIndex + k + i1 * 16;
imageDataB2.mark();
EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, k1, (idx % 16) * k2, (idx / 16) * k2, k2, k2, 6408 /* GL_RGBA */,
5121 /* GL_UNSIGNED_BYTE */, imageDataB2);
imageDataB2.rewind();
}
}
k1++;
ByteBuffer tmp = imageDataB1;
imageDataB1 = imageDataB2;
imageDataB2 = tmp;
} while (true);
}
}
}
// public void updateTerrainTextures() {
// for (int i = 0; i < textureList.size(); i++) {
// TextureFX texturefx = (TextureFX) textureList.get(i);
// texturefx.anaglyphEnabled = options.anaglyph;
// texturefx.onTick();
// int tileSize = 16 * 16 * 4;
// imageDataB1.clear();
// imageDataB1.put(texturefx.imageData);
// imageDataB1.position(0).limit(tileSize);
// texturefx.bindImage(this);
//
// imageDataB1.position(0).limit(tileSize);
//
// for (int k = 0; k < texturefx.tileSize; k++) {
// for (int i1 = 0; i1 < texturefx.tileSize; i1++) {
// int idx = texturefx.iconIndex + k + i1 * 16;
// imageDataB1.mark();
// EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 0, (idx % 16) * 16, (idx / 16) * 16, 16, 16, 6408 /* GL_RGBA */,
// 5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
// imageDataB1.rewind();
// }
// }
// }
// TextureFX.terrainTexture.bindTexture();
// IntBuffer buf = imageDataInt;
// for (int i = 0; i < textureSpriteList.size(); i++) {
// Object obj = textureSpriteList.get(i);
// PXSpriteSheet s;
// int ticksCount = -1;
// if(obj instanceof PXSpriteSheet) {
// s = (PXSpriteSheet)obj;
// s.onUpdate();
// ticksCount = s.ticks;
// }else if(obj instanceof PXSpriteSheet.PXSpriteSheetOffset) {
// PXSpriteSheet.PXSpriteSheetOffset ss = (PXSpriteSheet.PXSpriteSheetOffset) obj;
// s = ss.src;
// ticksCount = (s.ticks + ss.offset) % s.sheetLength;
// }else {
// continue;
// }
//
// int idx = s.tileIndex;
//
// int tileSize = 16 * s.tileSize * 16 * s.tileSize;
// int offsetIndex = ticksCount * tileSize;
// buf.clear();
// buf.put(s.pixels0, offsetIndex, tileSize);
// buf.flip();
// EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 0, (idx % 16) * 16, (idx / 16) * 16, 16 * s.tileSize, 16 * s.tileSize, 6408 /* GL_RGBA */,
// 5121 /* GL_UNSIGNED_BYTE */, buf);
//
// tileSize = 8 * s.tileSize * 8 * s.tileSize;
// offsetIndex = ticksCount * tileSize;
// buf.clear();
// buf.put(s.pixels1, offsetIndex, tileSize);
// buf.flip();
// EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 1, (idx % 16) * 8, (idx / 16) * 8, 8 * s.tileSize, 8 * s.tileSize, 6408 /* GL_RGBA */,
// 5121 /* GL_UNSIGNED_BYTE */, buf);
//
// tileSize = 4 * s.tileSize * 4 * s.tileSize;
// offsetIndex = ticksCount * tileSize;
// buf.clear();
// buf.put(s.pixels2, offsetIndex, tileSize);
// buf.flip();
// EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 2, (idx % 16) * 4, (idx / 16) * 4, 4 * s.tileSize, 4 * s.tileSize, 6408 /* GL_RGBA */,
// 5121 /* GL_UNSIGNED_BYTE */, buf);
//
// tileSize = 2 * s.tileSize * 2 * s.tileSize;
// offsetIndex = ticksCount * tileSize;
// buf.clear();
// buf.put(s.pixels3, offsetIndex, tileSize);
// buf.flip();
// EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 3, (idx % 16) * 2, (idx / 16) * 2, 2 * s.tileSize, 2 * s.tileSize, 6408 /* GL_RGBA */,
// 5121 /* GL_UNSIGNED_BYTE */, buf);
//
// tileSize = s.tileSize * s.tileSize;
// offsetIndex = ticksCount * tileSize;
// buf.clear();
// buf.put(s.pixels4, offsetIndex, tileSize);
// buf.flip();
// EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 4, (idx % 16), (idx / 16), 1 * s.tileSize, 1 * s.tileSize, 6408 /* GL_RGBA */,
// 5121 /* GL_UNSIGNED_BYTE */, buf);
// }
//
// }
private int averageColor(int i, int j) {
int k = (i & 0xff000000) >> 24 & 0xff;
@ -296,28 +260,7 @@ public class RenderEngine {
return ((k + l >> 1) << 24) + ((i & 0xfefefe) + (j & 0xfefefe) >> 1);
}
/*
private int weightedAverageColor(int i, int j) {
int k = (i & 0xff000000) >> 24 & 0xff;
int l = (j & 0xff000000) >> 24 & 0xff;
char c = '\377';
if (k + l == 0) {
k = 1;
l = 1;
c = '\0';
}
int i1 = (i >> 16 & 0xff) * k;
int j1 = (i >> 8 & 0xff) * k;
int k1 = (i & 0xff) * k;
int l1 = (j >> 16 & 0xff) * l;
int i2 = (j >> 8 & 0xff) * l;
int j2 = (j & 0xff) * l;
int k2 = (i1 + l1) / (k + l);
int l2 = (j1 + i2) / (k + l);
int i3 = (k1 + j2) / (k + l);
return c << 24 | k2 << 16 | l2 << 8 | i3;
}
*/
public void refreshTextures() {
TextureLocation.freeTextures();
TexturePackBase texturepackbase = field_6527_k.selectedTexturePack;
@ -362,6 +305,10 @@ public class RenderEngine {
}
}
for(int j = 0, l = textureSpriteList.size(); j < l; ++j) {
textureSpriteList.get(j).reloadData();
}
}
private EaglerImage readTextureImage(byte[] inputstream) throws IOException {
@ -381,14 +328,46 @@ public class RenderEngine {
private HashMap textureMap;
private HashMap textureNameToImageMap;
private IntBuffer singleIntBuffer;
private ByteBuffer imageDataA;
private ByteBuffer imageDataB1;
private ByteBuffer imageDataB2;
private java.util.List textureList;
private Map urlToImageDataMap;
private java.util.List<TextureFX> textureList;
private java.util.List<SpriteSheetTexture> textureSpriteList;
private GameSettings options;
private boolean clampTexture;
private boolean blurTexture;
private TexturePackList field_6527_k;
public void updateTerrainTextures() {
for (int i = 0; i < textureList.size(); i++) {
TextureFX texturefx = (TextureFX) textureList.get(i);
texturefx.anaglyphEnabled = options.anaglyph;
texturefx.onTick();
int tileSize = 16 * 16 * 4;
imageDataB1.clear();
imageDataB1.put(texturefx.imageData);
imageDataB1.position(0).limit(tileSize);
texturefx.bindImage(this);
EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, 0, (texturefx.iconIndex % 16) * 16, (texturefx.iconIndex / 16) * 16, 16, 16,
6408 /* GL_RGBA */, 5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
}
TextureFX.terrainTexture.bindTexture();
for(int i = 0, l = textureSpriteList.size(); i < l; ++i) {
SpriteSheetTexture sp = textureSpriteList.get(i);
sp.update();
int w = 16;
for(int j = 0; j < 5; ++j) {
EaglerAdapter.glTexSubImage2D(3553 /* GL_TEXTURE_2D */, j, (sp.iconIndex % 16) * w, (sp.iconIndex / 16) * w, w * sp.iconTileSize, w * sp.iconTileSize,
6408 /* GL_RGBA */, 5121 /* GL_UNSIGNED_BYTE */, sp.grabFrame(j));
w /= 2;
}
}
}
public void registerSpriteSheet(String name, int iconIndex, int iconTileSize) {
textureSpriteList.add(new SpriteSheetTexture(name, iconIndex, iconTileSize));
}
}

View File

@ -1,120 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage;
import net.minecraft.client.Minecraft;
public class TextureCompassFX extends TextureFX {
public TextureCompassFX(Minecraft minecraft) {
super(Item.compass.getIconIndex(null));
mc = minecraft;
tileImage = 1;
EaglerImage bufferedimage = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/gui/items.png"));
int i = (iconIndex % 16) * 16;
int j = (iconIndex / 16) * 16;
field_4230_h = bufferedimage.getSubImage(i, j, 16, 16).data;
}
public void onTick() {
for (int i = 0; i < 256; i++) {
int j = field_4230_h[i] >> 24 & 0xff;
int k = field_4230_h[i] >> 16 & 0xff;
int l = field_4230_h[i] >> 8 & 0xff;
int i1 = field_4230_h[i] >> 0 & 0xff;
if (anaglyphEnabled) {
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;
}
imageData[i * 4 + 0] = (byte) k;
imageData[i * 4 + 1] = (byte) l;
imageData[i * 4 + 2] = (byte) i1;
imageData[i * 4 + 3] = (byte) j;
}
double d = 0.0D;
if (mc.theWorld != null && mc.thePlayer != null) {
ChunkCoordinates chunkcoordinates = mc.theWorld.func_22137_s();
double d2 = (double) chunkcoordinates.field_22395_a - mc.thePlayer.posX;
double d4 = (double) chunkcoordinates.field_22396_c - mc.thePlayer.posZ;
d = ((double) (mc.thePlayer.rotationYaw - 90F) * 3.1415926535897931D) / 180D - Math.atan2(d4, d2);
if (mc.theWorld.worldProvider.field_4220_c) {
d = Math.random() * 3.1415927410125732D * 2D;
}
}
double d1;
for (d1 = d - field_4229_i; d1 < -3.1415926535897931D; d1 += 6.2831853071795862D) {
}
for (; d1 >= 3.1415926535897931D; d1 -= 6.2831853071795862D) {
}
if (d1 < -1D) {
d1 = -1D;
}
if (d1 > 1.0D) {
d1 = 1.0D;
}
field_4228_j += d1 * 0.10000000000000001D;
field_4228_j *= 0.80000000000000004D;
field_4229_i += field_4228_j;
double d3 = Math.sin(field_4229_i);
double d5 = Math.cos(field_4229_i);
for (int i2 = -4; i2 <= 4; i2++) {
int k2 = (int) (8.5D + d5 * (double) i2 * 0.29999999999999999D);
int i3 = (int) (7.5D - d3 * (double) i2 * 0.29999999999999999D * 0.5D);
int k3 = i3 * 16 + k2;
int i4 = 100;
int k4 = 100;
int i5 = 100;
char c = '\377';
if (anaglyphEnabled) {
int k5 = (i4 * 30 + k4 * 59 + i5 * 11) / 100;
int i6 = (i4 * 30 + k4 * 70) / 100;
int k6 = (i4 * 30 + i5 * 70) / 100;
i4 = k5;
k4 = i6;
i5 = k6;
}
imageData[k3 * 4 + 0] = (byte) i4;
imageData[k3 * 4 + 1] = (byte) k4;
imageData[k3 * 4 + 2] = (byte) i5;
imageData[k3 * 4 + 3] = (byte) c;
}
for (int j2 = -8; j2 <= 16; j2++) {
int l2 = (int) (8.5D + d3 * (double) j2 * 0.29999999999999999D);
int j3 = (int) (7.5D + d5 * (double) j2 * 0.29999999999999999D * 0.5D);
int l3 = j3 * 16 + l2;
int j4 = j2 < 0 ? 100 : 255;
int l4 = j2 < 0 ? 100 : 20;
int j5 = j2 < 0 ? 100 : 20;
char c1 = '\377';
if (anaglyphEnabled) {
int l5 = (j4 * 30 + l4 * 59 + j5 * 11) / 100;
int j6 = (j4 * 30 + l4 * 70) / 100;
int l6 = (j4 * 30 + j5 * 70) / 100;
j4 = l5;
l4 = j6;
j5 = l6;
}
imageData[l3 * 4 + 0] = (byte) j4;
imageData[l3 * 4 + 1] = (byte) l4;
imageData[l3 * 4 + 2] = (byte) j5;
imageData[l3 * 4 + 3] = (byte) c1;
}
}
private Minecraft mc;
private int field_4230_h[];
private double field_4229_i;
private double field_4228_j;
}

View File

@ -7,8 +7,8 @@ import net.lax1dude.eaglercraft.TextureLocation;
public class TextureFX {
private static final TextureLocation terrainTexture = new TextureLocation("/terrain.png");
private static final TextureLocation itemsTexture = new TextureLocation("/gui/items.png");
public static final TextureLocation terrainTexture = new TextureLocation("/terrain.png");
public static final TextureLocation itemsTexture = new TextureLocation("/gui/items.png");
public TextureFX(int i) {
imageData = new byte[1024 /* GL_FRONT_LEFT */];

View File

@ -1,79 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class TextureFlamesFX extends TextureFX {
public TextureFlamesFX(int i) {
super(Block.fire.blockIndexInTexture + i * 16);
field_1133_g = new float[320];
field_1132_h = new float[320];
}
public void onTick() {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 20; j++) {
int l = 18;
float f1 = field_1133_g[i + ((j + 1) % 20) * 16] * (float) l;
for (int i1 = i - 1; i1 <= i + 1; i1++) {
for (int k1 = j; k1 <= j + 1; k1++) {
int i2 = i1;
int k2 = k1;
if (i2 >= 0 && k2 >= 0 && i2 < 16 && k2 < 20) {
f1 += field_1133_g[i2 + k2 * 16];
}
l++;
}
}
field_1132_h[i + j * 16] = f1 / ((float) l * 1.06F);
if (j >= 19) {
field_1132_h[i + j * 16] = (float) (Math.random() * Math.random() * Math.random() * 4D
+ Math.random() * 0.10000000149011612D + 0.20000000298023224D);
}
}
}
float af[] = field_1132_h;
field_1132_h = field_1133_g;
field_1133_g = af;
for (int k = 0; k < 256; k++) {
float f = field_1133_g[k] * 1.8F;
if (f > 1.0F) {
f = 1.0F;
}
if (f < 0.0F) {
f = 0.0F;
}
float f2 = f;
int j1 = (int) (f2 * 155F + 100F);
int l1 = (int) (f2 * f2 * 255F);
int j2 = (int) (f2 * f2 * f2 * f2 * f2 * f2 * f2 * f2 * f2 * f2 * 255F);
char c = '\377';
if (f2 < 0.5F) {
c = '\0';
}
f2 = (f2 - 0.5F) * 2.0F;
if (anaglyphEnabled) {
int l2 = (j1 * 30 + l1 * 59 + j2 * 11) / 100;
int i3 = (j1 * 30 + l1 * 70) / 100;
int j3 = (j1 * 30 + j2 * 70) / 100;
j1 = l2;
l1 = i3;
j2 = j3;
}
imageData[k * 4 + 0] = (byte) j1;
imageData[k * 4 + 1] = (byte) l1;
imageData[k * 4 + 2] = (byte) j2;
imageData[k * 4 + 3] = (byte) c;
}
}
protected float field_1133_g[];
protected float field_1132_h[];
}

View File

@ -1,83 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class TextureLavaFX extends TextureFX {
public TextureLavaFX() {
super(Block.lavaStill.blockIndexInTexture);
field_1147_g = new float[256];
field_1146_h = new float[256];
field_1145_i = new float[256];
field_1144_j = new float[256];
}
public void onTick() {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
float f = 0.0F;
int l = (int) (MathHelper.sin(((float) j * 3.141593F * 2.0F) / 16F) * 1.2F);
int i1 = (int) (MathHelper.sin(((float) i * 3.141593F * 2.0F) / 16F) * 1.2F);
for (int k1 = i - 1; k1 <= i + 1; k1++) {
for (int i2 = j - 1; i2 <= j + 1; i2++) {
int k2 = k1 + l & 0xf;
int i3 = i2 + i1 & 0xf;
f += field_1147_g[k2 + i3 * 16];
}
}
field_1146_h[i + j * 16] = f / 10F + ((field_1145_i[(i + 0 & 0xf) + (j + 0 & 0xf) * 16]
+ field_1145_i[(i + 1 & 0xf) + (j + 0 & 0xf) * 16]
+ field_1145_i[(i + 1 & 0xf) + (j + 1 & 0xf) * 16]
+ field_1145_i[(i + 0 & 0xf) + (j + 1 & 0xf) * 16]) / 4F) * 0.8F;
field_1145_i[i + j * 16] += field_1144_j[i + j * 16] * 0.01F;
if (field_1145_i[i + j * 16] < 0.0F) {
field_1145_i[i + j * 16] = 0.0F;
}
field_1144_j[i + j * 16] -= 0.06F;
if (Math.random() < 0.0050000000000000001D) {
field_1144_j[i + j * 16] = 1.5F;
}
}
}
float af[] = field_1146_h;
field_1146_h = field_1147_g;
field_1147_g = af;
for (int k = 0; k < 256; k++) {
float f1 = field_1147_g[k] * 2.0F;
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 < 0.0F) {
f1 = 0.0F;
}
float f2 = f1;
int j1 = (int) (f2 * 100F + 155F);
int l1 = (int) (f2 * f2 * 255F);
int j2 = (int) (f2 * f2 * f2 * f2 * 128F);
if (anaglyphEnabled) {
int l2 = (j1 * 30 + l1 * 59 + j2 * 11) / 100;
int j3 = (j1 * 30 + l1 * 70) / 100;
int k3 = (j1 * 30 + j2 * 70) / 100;
j1 = l2;
l1 = j3;
j2 = k3;
}
imageData[k * 4 + 0] = (byte) j1;
imageData[k * 4 + 1] = (byte) l1;
imageData[k * 4 + 2] = (byte) j2;
imageData[k * 4 + 3] = -1;
}
}
protected float field_1147_g[];
protected float field_1146_h[];
protected float field_1145_i[];
protected float field_1144_j[];
}

View File

@ -1,87 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class TextureLavaFlowFX extends TextureFX {
public TextureLavaFlowFX() {
super(Block.lavaStill.blockIndexInTexture + 1);
field_1143_g = new float[256];
field_1142_h = new float[256];
field_1141_i = new float[256];
field_1140_j = new float[256];
field_1139_k = 0;
tileSize = 2;
}
public void onTick() {
field_1139_k++;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
float f = 0.0F;
int l = (int) (MathHelper.sin(((float) j * 3.141593F * 2.0F) / 16F) * 1.2F);
int i1 = (int) (MathHelper.sin(((float) i * 3.141593F * 2.0F) / 16F) * 1.2F);
for (int k1 = i - 1; k1 <= i + 1; k1++) {
for (int i2 = j - 1; i2 <= j + 1; i2++) {
int k2 = k1 + l & 0xf;
int i3 = i2 + i1 & 0xf;
f += field_1143_g[k2 + i3 * 16];
}
}
field_1142_h[i + j * 16] = f / 10F + ((field_1141_i[(i + 0 & 0xf) + (j + 0 & 0xf) * 16]
+ field_1141_i[(i + 1 & 0xf) + (j + 0 & 0xf) * 16]
+ field_1141_i[(i + 1 & 0xf) + (j + 1 & 0xf) * 16]
+ field_1141_i[(i + 0 & 0xf) + (j + 1 & 0xf) * 16]) / 4F) * 0.8F;
field_1141_i[i + j * 16] += field_1140_j[i + j * 16] * 0.01F;
if (field_1141_i[i + j * 16] < 0.0F) {
field_1141_i[i + j * 16] = 0.0F;
}
field_1140_j[i + j * 16] -= 0.06F;
if (Math.random() < 0.0050000000000000001D) {
field_1140_j[i + j * 16] = 1.5F;
}
}
}
float af[] = field_1142_h;
field_1142_h = field_1143_g;
field_1143_g = af;
for (int k = 0; k < 256; k++) {
float f1 = field_1143_g[k - (field_1139_k / 3) * 16 & 0xff] * 2.0F;
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 < 0.0F) {
f1 = 0.0F;
}
float f2 = f1;
int j1 = (int) (f2 * 100F + 155F);
int l1 = (int) (f2 * f2 * 255F);
int j2 = (int) (f2 * f2 * f2 * f2 * 128F);
if (anaglyphEnabled) {
int l2 = (j1 * 30 + l1 * 59 + j2 * 11) / 100;
int j3 = (j1 * 30 + l1 * 70) / 100;
int k3 = (j1 * 30 + j2 * 70) / 100;
j1 = l2;
l1 = j3;
j2 = k3;
}
imageData[k * 4 + 0] = (byte) j1;
imageData[k * 4 + 1] = (byte) l1;
imageData[k * 4 + 2] = (byte) j2;
imageData[k * 4 + 3] = -1;
}
}
protected float field_1143_g[];
protected float field_1142_h[];
protected float field_1141_i[];
protected float field_1140_j[];
int field_1139_k;
}

View File

@ -1,92 +0,0 @@
package net.minecraft.src;
import net.lax1dude.eaglercraft.EaglercraftRandom;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class TexturePortalFX extends TextureFX {
public TexturePortalFX() {
super(Block.portal.blockIndexInTexture);
field_4227_g = 0;
field_4226_h = new byte[32][1024];
EaglercraftRandom random = new EaglercraftRandom(100L);
for (int i = 0; i < 32; i++) {
for (int j = 0; j < 16; j++) {
for (int k = 0; k < 16; k++) {
float f = 0.0F;
for (int l = 0; l < 2; l++) {
float f1 = l * 8;
float f2 = l * 8;
float f3 = (((float) j - f1) / 16F) * 2.0F;
float f4 = (((float) k - f2) / 16F) * 2.0F;
if (f3 < -1F) {
f3 += 2.0F;
}
if (f3 >= 1.0F) {
f3 -= 2.0F;
}
if (f4 < -1F) {
f4 += 2.0F;
}
if (f4 >= 1.0F) {
f4 -= 2.0F;
}
float f5 = f3 * f3 + f4 * f4;
float f6 = (float) Math.atan2(f4, f3)
+ ((((float) i / 32F) * 3.141593F * 2.0F - f5 * 10F) + (float) (l * 2))
* (float) (l * 2 - 1);
f6 = (MathHelper.sin(f6) + 1.0F) / 2.0F;
f6 /= f5 + 1.0F;
f += f6 * 0.5F;
}
f += random.nextFloat() * 0.1F;
int i1 = (int) (f * 100F + 155F);
int j1 = (int) (f * f * 200F + 55F);
int k1 = (int) (f * f * f * f * 255F);
int l1 = (int) (f * 100F + 155F);
int i2 = k * 16 + j;
field_4226_h[i][i2 * 4 + 0] = (byte) j1;
field_4226_h[i][i2 * 4 + 1] = (byte) k1;
field_4226_h[i][i2 * 4 + 2] = (byte) i1;
field_4226_h[i][i2 * 4 + 3] = (byte) l1;
}
}
}
}
public void onTick() {
field_4227_g++;
byte abyte0[] = field_4226_h[field_4227_g & 0x1f];
for (int i = 0; i < 256; i++) {
int j = abyte0[i * 4 + 0] & 0xff;
int k = abyte0[i * 4 + 1] & 0xff;
int l = abyte0[i * 4 + 2] & 0xff;
int i1 = abyte0[i * 4 + 3] & 0xff;
if (anaglyphEnabled) {
int j1 = (j * 30 + k * 59 + l * 11) / 100;
int k1 = (j * 30 + k * 70) / 100;
int l1 = (j * 30 + l * 70) / 100;
j = j1;
k = k1;
l = l1;
}
imageData[i * 4 + 0] = (byte) j;
imageData[i * 4 + 1] = (byte) k;
imageData[i * 4 + 2] = (byte) l;
imageData[i * 4 + 3] = (byte) i1;
}
}
private int field_4227_g;
private byte field_4226_h[][];
}

View File

@ -1,93 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage;
import net.minecraft.client.Minecraft;
public class TextureWatchFX extends TextureFX {
public TextureWatchFX(Minecraft minecraft) {
super(Item.pocketSundial.getIconIndex(null));
field_4224_h = new int[256];
field_4223_i = new int[256];
field_4225_g = minecraft;
tileImage = 1;
EaglerImage bufferedimage = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/gui/items.png"));
int i = (iconIndex % 16) * 16;
int j = (iconIndex / 16) * 16;
field_4224_h = bufferedimage.getSubImage(i, j, 16, 16).data;
field_4223_i = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/misc/dial.png")).data;
}
public void onTick() {
double d = 0.0D;
if (field_4225_g.theWorld != null && field_4225_g.thePlayer != null) {
float f = field_4225_g.theWorld.getCelestialAngle(1.0F);
d = -f * 3.141593F * 2.0F;
if (field_4225_g.theWorld.worldProvider.field_4220_c) {
d = Math.random() * 3.1415927410125732D * 2D;
}
}
double d1;
for (d1 = d - field_4222_j; d1 < -3.1415926535897931D; d1 += 6.2831853071795862D) {
}
for (; d1 >= 3.1415926535897931D; d1 -= 6.2831853071795862D) {
}
if (d1 < -1D) {
d1 = -1D;
}
if (d1 > 1.0D) {
d1 = 1.0D;
}
field_4221_k += d1 * 0.10000000000000001D;
field_4221_k *= 0.80000000000000004D;
field_4222_j += field_4221_k;
double d2 = Math.sin(field_4222_j);
double d3 = Math.cos(field_4222_j);
for (int i = 0; i < 256; i++) {
int j = field_4224_h[i] >> 24 & 0xff;
int k = field_4224_h[i] >> 16 & 0xff;
int l = field_4224_h[i] >> 8 & 0xff;
int i1 = field_4224_h[i] >> 0 & 0xff;
if (k == i1 && l == 0 && i1 > 0) {
double d4 = -((double) (i % 16) / 15D - 0.5D);
double d5 = (double) (i / 16) / 15D - 0.5D;
int i2 = k;
int j2 = (int) ((d4 * d3 + d5 * d2 + 0.5D) * 16D);
int k2 = (int) (((d5 * d3 - d4 * d2) + 0.5D) * 16D);
int l2 = (j2 & 0xf) + (k2 & 0xf) * 16;
j = field_4223_i[l2] >> 24 & 0xff;
k = ((field_4223_i[l2] >> 16 & 0xff) * i2) / 255;
l = ((field_4223_i[l2] >> 8 & 0xff) * i2) / 255;
i1 = ((field_4223_i[l2] >> 0 & 0xff) * i2) / 255;
}
if (anaglyphEnabled) {
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;
}
imageData[i * 4 + 0] = (byte) k;
imageData[i * 4 + 1] = (byte) l;
imageData[i * 4 + 2] = (byte) i1;
imageData[i * 4 + 3] = (byte) j;
}
}
private Minecraft field_4225_g;
private int field_4224_h[];
private int field_4223_i[];
private double field_4222_j;
private double field_4221_k;
}

View File

@ -1,85 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class TextureWaterFX extends TextureFX {
public TextureWaterFX() {
super(Block.waterStill.blockIndexInTexture);
field_1158_g = new float[256];
field_1157_h = new float[256];
field_1156_i = new float[256];
field_1155_j = new float[256];
tickCounter = 0;
}
public void onTick() {
tickCounter++;
for (int i = 0; i < 16; i++) {
for (int k = 0; k < 16; k++) {
float f = 0.0F;
for (int j1 = i - 1; j1 <= i + 1; j1++) {
int k1 = j1 & 0xf;
int i2 = k & 0xf;
f += field_1158_g[k1 + i2 * 16];
}
field_1157_h[i + k * 16] = f / 3.3F + field_1156_i[i + k * 16] * 0.8F;
}
}
for (int j = 0; j < 16; j++) {
for (int l = 0; l < 16; l++) {
field_1156_i[j + l * 16] += field_1155_j[j + l * 16] * 0.05F;
if (field_1156_i[j + l * 16] < 0.0F) {
field_1156_i[j + l * 16] = 0.0F;
}
field_1155_j[j + l * 16] -= 0.1F;
if (Math.random() < 0.050000000000000003D) {
field_1155_j[j + l * 16] = 0.5F;
}
}
}
float af[] = field_1157_h;
field_1157_h = field_1158_g;
field_1158_g = af;
for (int i1 = 0; i1 < 256; i1++) {
float f1 = field_1158_g[i1];
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 < 0.0F) {
f1 = 0.0F;
}
float f2 = f1 * f1;
int l1 = (int) (32F + f2 * 32F);
int j2 = (int) (50F + f2 * 64F);
int k2 = 255;
int l2 = (int) (146F + f2 * 50F);
if (anaglyphEnabled) {
int i3 = (l1 * 30 + j2 * 59 + k2 * 11) / 100;
int j3 = (l1 * 30 + j2 * 70) / 100;
int k3 = (l1 * 30 + k2 * 70) / 100;
l1 = i3;
j2 = j3;
k2 = k3;
}
imageData[i1 * 4 + 0] = (byte) l1;
imageData[i1 * 4 + 1] = (byte) j2;
imageData[i1 * 4 + 2] = (byte) k2;
imageData[i1 * 4 + 3] = (byte) l2;
}
}
protected float field_1158_g[];
protected float field_1157_h[];
protected float field_1156_i[];
protected float field_1155_j[];
private int tickCounter;
}

View File

@ -1,86 +0,0 @@
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class TextureWaterFlowFX extends TextureFX {
public TextureWaterFlowFX() {
super(Block.waterStill.blockIndexInTexture + 1);
field_1138_g = new float[256];
field_1137_h = new float[256];
field_1136_i = new float[256];
field_1135_j = new float[256];
field_1134_k = 0;
tileSize = 2;
}
public void onTick() {
field_1134_k++;
for (int i = 0; i < 16; i++) {
for (int k = 0; k < 16; k++) {
float f = 0.0F;
for (int j1 = k - 2; j1 <= k; j1++) {
int k1 = i & 0xf;
int i2 = j1 & 0xf;
f += field_1138_g[k1 + i2 * 16];
}
field_1137_h[i + k * 16] = f / 3.2F + field_1136_i[i + k * 16] * 0.8F;
}
}
for (int j = 0; j < 16; j++) {
for (int l = 0; l < 16; l++) {
field_1136_i[j + l * 16] += field_1135_j[j + l * 16] * 0.05F;
if (field_1136_i[j + l * 16] < 0.0F) {
field_1136_i[j + l * 16] = 0.0F;
}
field_1135_j[j + l * 16] -= 0.3F;
if (Math.random() < 0.20000000000000001D) {
field_1135_j[j + l * 16] = 0.5F;
}
}
}
float af[] = field_1137_h;
field_1137_h = field_1138_g;
field_1138_g = af;
for (int i1 = 0; i1 < 256; i1++) {
float f1 = field_1138_g[i1 - field_1134_k * 16 & 0xff];
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 < 0.0F) {
f1 = 0.0F;
}
float f2 = f1 * f1;
int l1 = (int) (32F + f2 * 32F);
int j2 = (int) (50F + f2 * 64F);
int k2 = 255;
int l2 = (int) (146F + f2 * 50F);
if (anaglyphEnabled) {
int i3 = (l1 * 30 + j2 * 59 + k2 * 11) / 100;
int j3 = (l1 * 30 + j2 * 70) / 100;
int k3 = (l1 * 30 + k2 * 70) / 100;
l1 = i3;
j2 = j3;
k2 = k3;
}
imageData[i1 * 4 + 0] = (byte) l1;
imageData[i1 * 4 + 1] = (byte) j2;
imageData[i1 * 4 + 2] = (byte) k2;
imageData[i1 * 4 + 3] = (byte) l2;
}
}
protected float field_1138_g[];
protected float field_1137_h[];
protected float field_1136_i[];
protected float field_1135_j[];
private int field_1134_k;
}

View File

@ -107,6 +107,10 @@ public class WorldProvider {
}
}
public boolean isSurfaceWorld() {
return true;
}
public World worldObj;
public WorldChunkManager worldChunkMgr;
public boolean field_4220_c;

View File

@ -52,4 +52,8 @@ public class WorldProviderHell extends WorldProvider {
public boolean canRespawnHere() {
return false;
}
public boolean isSurfaceWorld() {
return true;
}
}

View File

@ -1003,9 +1003,12 @@ public class EaglerAdapterImpl2 {
return false;
}
public static final boolean isFunctionKeyDown(boolean mod, int p1) {
return mod && p1 >= 59 && p1 <= 67 && isKeyDown(2 + (p1 - 59));
return mod && p1 >= 59 && p1 <= 67 && getEventKey() == (2 + (p1 - 59));
}
public static final boolean isFunctionKeyDown(int mod, int p1) {
return isKeyDown(mod) && p1 >= 59 && p1 <= 67 & getEventKey() == (2 + (p1 - 59));
}
public static final boolean isFunctionKeyHeldDown(int mod, int p1) {
return isKeyDown(mod) && p1 >= 59 && p1 <= 67 & isKeyDown(2 + (p1 - 59));
}