Compare commits

..

No commits in common. "62af5c919131c9933ad0c2f6e53fef3f07d87bc7" and "e2a7989070ca3b1b5879bac3a92b3caf76230da4" have entirely different histories.

27 changed files with 7701 additions and 15510 deletions

File diff suppressed because one or more lines are too long

View File

@ -18,11 +18,10 @@ public class GameSettings {
File file1 = new File("filesystem");
File file = new File(file1, "options.txt");
if(!file.exists()) {
file.createNewFile();
return;
}
byte[] fileData = new byte[(int) file.length()];
byte[] fileData = new byte[0];
try (FileInputStream fis = new FileInputStream(file)) {
fis.read(fileData);
} catch(IOException e) {
@ -93,10 +92,6 @@ public class GameSettings {
if(var3[0].equals("lastServer")) {
Minecraft.getMinecraft().gameSettings.field_12259_z = var3[1];
}
if(var3[0].equals("username")) {
Minecraft.getMinecraft().gameSettings.username = var3[1];
}
for(int var4 = 0; var4 < Minecraft.getMinecraft().gameSettings.keyBindings.length; ++var4) {
if(var3[0].equals("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var4].keyDescription)) {
@ -129,12 +124,6 @@ public class GameSettings {
var1.println("difficulty:" + Minecraft.getMinecraft().gameSettings.difficulty);
var1.println("fancyGraphics:" + Minecraft.getMinecraft().gameSettings.fancyGraphics);
var1.println("skin:" + Minecraft.getMinecraft().gameSettings.skin);
if(Minecraft.getMinecraft().gameSettings.field_12259_z.length() != 0) {
var1.println("lastServer:" + Minecraft.getMinecraft().gameSettings.field_12259_z);
}
if(Minecraft.getMinecraft().gameSettings.username.length() != 0) {
var1.println("username:" + Minecraft.getMinecraft().gameSettings.username);
}
for(int var2 = 0; var2 < Minecraft.getMinecraft().gameSettings.keyBindings.length; ++var2) {
var1.println("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var2].keyDescription + ":" + Minecraft.getMinecraft().gameSettings.keyBindings[var2].keyCode);

View File

@ -1,7 +1,6 @@
package net.lax1dude.eaglercraft;
import javax.swing.JOptionPane;
import net.PeytonPlayz585.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Session;

View File

@ -71,7 +71,9 @@ import org.lwjgl.util.glu.GLU;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.GameWindowListener;
import net.minecraft.client.Minecraft;
import net.minecraft.src.MathHelper;
import net.minecraft.src.NetClientHandler;
public class EaglerAdapterImpl2 {

View File

@ -16,9 +16,6 @@ public class ChunkLoader implements IChunkLoader {
}
private File chunkFileForXZ(int i, int j) {
if(saveDir == null) {
return null;
}
String s = (new StringBuilder()).append("c.").append(Integer.toString(i, 36)).append(".").append(Integer.toString(j, 36)).append(".dat").toString();
String s1 = Integer.toString(i & 0x3f, 36);
String s2 = Integer.toString(j & 0x3f, 36);
@ -47,9 +44,6 @@ public class ChunkLoader implements IChunkLoader {
}
public Chunk loadChunk(World world, int i, int j) {
if(saveDir == null) {
return null;
}
File file = chunkFileForXZ(i, j);
if (file != null && file.exists()) {
try {
@ -84,9 +78,6 @@ public class ChunkLoader implements IChunkLoader {
}
public void saveChunk(World world, Chunk chunk) {
if(saveDir == null) {
return;
}
world.func_663_l();
File file = chunkFileForXZ(chunk.xPosition, chunk.zPosition);
if (file.exists()) {

View File

@ -118,8 +118,7 @@ public class Minecraft implements Runnable {
public void startGame() {
RenderManager.instance.field_4236_f = new ItemRenderer(this);
new GameSettings(this);
this.gameSettings.loadOptions();
this.gameSettings = new GameSettings(this);
this.texturePackList = new TexturePackList(this);
this.renderEngine = new RenderEngine(texturePackList, this.gameSettings);
this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine);
@ -277,12 +276,6 @@ public class Minecraft implements Runnable {
try {
this.runTick();
} catch(ArrayIndexOutOfBoundsException e) {
if(this.isMultiplayerWorld()) {
continue;
} else {
e.printStackTrace();
}
} catch (MinecraftException var14) {
this.theWorld = null;
this.func_6261_a((World)null);
@ -320,15 +313,7 @@ public class Minecraft implements Runnable {
this.field_6327_b.func_6467_a(this.timer.renderPartialTicks);
}
try {
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
} catch(ArrayIndexOutOfBoundsException e) {
if(this.isMultiplayerWorld()) {
continue;
} else {
e.printStackTrace();
}
}
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
}
if(!GL11.isFocused()) {
@ -452,7 +437,7 @@ public class Minecraft implements Runnable {
public void shutdown() {
System.out.println("Stopping!");
if(this.theWorld != null && !this.isMultiplayerWorld()) {
if(this.theWorld != null && !this.theWorld.multiplayerWorld) {
this.theWorld.saveLevel();
this.theWorld.chunkProvider.saveChunks(false, (IProgressUpdate)null);
}
@ -640,6 +625,17 @@ public class Minecraft implements Runnable {
}
}
//Fix for chunks not rendering in multiplayer after player respawn
if(respawnTimer > 0) {
respawnTimer--;
if(respawnTimer == 0 && this.theWorld != null) {
if(this.theWorld.multiplayerWorld) {
field_6323_f.func_958_a();
}
}
}
this.ingameGUI.func_555_a();
this.field_9243_r.func_910_a(1.0F);
if(this.thePlayer != null) {
@ -729,10 +725,6 @@ public class Minecraft implements Runnable {
if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) {
this.thePlayer.dropPlayerItemWithRandomChoice(this.thePlayer.inventory.decrStackSize(this.thePlayer.inventory.currentItem, 1), false);
}
if(this.isMultiplayerWorld() && Keyboard.getEventKey() == this.gameSettings.keyBindChat.keyCode) {
this.displayGuiScreen(new GuiChat());
}
}
for(int var4 = 0; var4 < 9; ++var4) {
@ -744,6 +736,10 @@ public class Minecraft implements Runnable {
if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) {
this.gameSettings.setOptionValue(4, !Keyboard.isKeyDown(42) && !Keyboard.isKeyDown(54) ? 1 : -1);
}
if(this.isMultiplayerWorld() && Keyboard.getEventKey() == this.gameSettings.keyBindChat.keyCode) {
this.displayGuiScreen(new GuiChat());
}
}
}
}
@ -1007,10 +1003,12 @@ public class Minecraft implements Runnable {
if(this.currentScreen instanceof GuiGameOver) {
this.displayGuiScreen((GuiScreen)null);
}
respawnTimer = 5;
}
public static Minecraft getMinecraft() {
return mc;
}
private int respawnTimer;
}

View File

@ -270,12 +270,18 @@ public class Chunk {
this.data.setNibble(var1, var2, var3, var5);
if(!this.worldObj.worldProvider.field_6478_e) {
if(Block.lightOpacity[var6] != 0) {
if(var2 >= var7) {
this.func_1003_g(var1, var2 + 1, var3);
if(!(var6 < 0 || var6 > 256)) {
if(Block.lightOpacity[var6] != 0) {
if(var2 >= var7) {
this.func_1003_g(var1, var2 + 1, var3);
}
} else if(var2 == var7 - 1) {
this.func_1003_g(var1, var2, var3);
}
} else {
if(var2 == var7 - 1) {
this.func_1003_g(var1, var2, var3);
}
} else if(var2 == var7 - 1) {
this.func_1003_g(var1, var2, var3);
}
this.worldObj.func_616_a(EnumSkyBlock.Sky, var9, var2, var10, var9, var2, var10);
@ -283,7 +289,7 @@ public class Chunk {
this.worldObj.func_616_a(EnumSkyBlock.Block, var9, var2, var10, var9, var2, var10);
this.func_996_c(var1, var3);
if(var4 != 0) {
if(var4 != 0 && !(var4 < 0 || var4 > 256)) {
Block.blocksList[var4].onBlockAdded(this.worldObj, var9, var2, var10);
}

View File

@ -117,11 +117,11 @@ public class ChunkCache implements IBlockAccess {
}
public boolean isBlockOpaqueCube(int var1, int var2, int var3) {
if(!(this.getBlockId(var1, var2, var3) < 0)) {
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
return var4 == null ? false : var4.isOpaqueCube();
if(this.getBlockId(var1, var2, var3) < 0 || this.getBlockId(var1, var2, var3) > 256) {
return false;
}
return false;
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
return var4 == null ? false : var4.isOpaqueCube();
}
public WorldChunkManager func_4075_a() {

View File

@ -45,7 +45,7 @@ public class GameSettings {
public GameSettings(Minecraft var1) {
this.mc = var1;
this.mc.gameSettings = this;
this.loadOptions();
}
public GameSettings() {
@ -190,15 +190,15 @@ public class GameSettings {
if(var3[0].equals("skin")) {
this.skin = var3[1];
}
if(var3[0].equals("username")) {
this.username = var3[1];
}
if(var3[0].equals("lastServer")) {
this.field_12259_z = var3[1];
}
if(var3[0].equals("username")) {
this.username = var3[1];
}
for(int var4 = 0; var4 < this.keyBindings.length; ++var4) {
if(var3[0].equals("key_" + this.keyBindings[var4].keyDescription)) {
this.keyBindings[var4].keyCode = Integer.parseInt(var3[1]);

View File

@ -1,21 +1,79 @@
package net.minecraft.src;
import java.io.IOException;
import net.PeytonPlayz585.opengl.GL11;
import net.minecraft.client.Minecraft;
public class GuiConnecting extends GuiScreen {
private NetClientHandler clientHandler;
private boolean cancelled = false;
String uri;
private int timer = 0;
public GuiConnecting(Minecraft var1, String var2) {
public GuiConnecting(Minecraft var1, String var2, int var3) {
cancelled = false;
uri = var2 + ":" + var3;
var1.func_6261_a((World)null);
(new ThreadConnectToServer(this, var1, var2)).start();
}
public void updateScreen() {
if(this.clientHandler != null) {
this.clientHandler.processReadPackets();
if (timer > 2 && this.clientHandler == null) {
try {
String uria = null;
if(uri.startsWith("ws://")) {
uria = uri.substring(5);
}else if(uri.startsWith("wss://")){
uria = uri.substring(6);
}else if(!uri.contains("://")){
uria = uri;
uri = "ws://" + uri;
}else {
this.mc.displayGuiScreen(new GuiConnectFailed("disconnect.genericReason", "invalid uri websocket protocol"));
return;
}
int i = uria.lastIndexOf(':');
int port = -1;
if(i > 0 && uria.startsWith("[") && uria.charAt(i - 1) != ']') {
i = -1;
}
if(i == -1) port = uri.startsWith("wss") ? 443 : 80;
if(uria.endsWith("/")) uria = uria.substring(0, uria.length() - 1);
if(port == -1) {
try {
int i2 = uria.indexOf('/');
port = Integer.parseInt(uria.substring(i + 1, i2 == -1 ? uria.length() : i2 - 1));
}catch(Throwable t) {
this.mc.displayGuiScreen(new GuiConnectFailed("disconnect.genericReason", "invalid port number"));
}
}
this.clientHandler = new NetClientHandler(mc, uri, 0);
this.clientHandler.addToSendQueue(new Packet2Handshake(mc.field_6320_i.inventory));
} catch (IOException e) {
try {
this.clientHandler.disconnect();
}catch(Throwable t) {
}
e.printStackTrace();
this.mc.displayGuiScreen(new GuiConnectFailed("disconnect.genericReason", e.toString()));
}
}
if (clientHandler != null) {
clientHandler.processReadPackets();
}
if(timer >= 1) {
++timer;
}
if(timer > 5) {
if(!GL11.connectionOpen() && this.mc.currentScreen == this) {
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.timeout"));
}
}
}
protected void keyTyped(char var1, int var2) {
@ -39,6 +97,9 @@ public class GuiConnecting extends GuiScreen {
}
public void drawScreen(int var1, int var2, float var3) {
if(timer == 0) {
timer = 1;
}
this.drawDefaultBackground();
if(this.clientHandler == null) {
this.drawCenteredString(this.fontRenderer, "Connecting to the server...", this.width / 2, this.height / 2 - 50, 16777215);

View File

@ -15,7 +15,7 @@ public class GuiIngameMenu extends GuiScreen {
if(this.mc.isMultiplayerWorld()) {
((GuiButton)this.controlList.get(0)).displayString = "Disconnect";
}
this.controlList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24, "Back to game"));
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96, "Options..."));
}
@ -49,12 +49,14 @@ public class GuiIngameMenu extends GuiScreen {
public void drawScreen(int var1, int var2, float var3) {
this.drawDefaultBackground();
boolean var4 = !this.mc.theWorld.func_650_a(this.updateCounter2++);
if(var4 || this.updateCounter < 20) {
float var5 = ((float)(this.updateCounter % 10) + var3) / 10.0F;
var5 = MathHelper.sin(var5 * (float)Math.PI * 2.0F) * 0.2F + 0.8F;
int var6 = (int)(255.0F * var5);
this.drawString(this.fontRenderer, "Saving level..", 8, this.height - 16, var6 << 16 | var6 << 8 | var6);
if(!this.mc.theWorld.multiplayerWorld) {
boolean var4 = !this.mc.theWorld.func_650_a(this.updateCounter2++);
if(var4 || this.updateCounter < 20) {
float var5 = ((float)(this.updateCounter % 10) + var3) / 10.0F;
var5 = MathHelper.sin(var5 * (float)Math.PI * 2.0F) * 0.2F + 0.8F;
int var6 = (int)(255.0F * var5);
this.drawString(this.fontRenderer, "Saving level..", 8, this.height - 16, var6 << 16 | var6 << 8 | var6);
}
}
this.drawCenteredString(this.fontRenderer, "Game menu", this.width / 2, 40, 16777215);

View File

@ -76,9 +76,6 @@ public class GuiMainMenu extends GuiScreen {
this.controlList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, "Multiplayer"));
this.controlList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 96, "Mods and Texture Packs"));
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Options..."));
if(this.mc.field_6320_i == null) {
((GuiButton)this.controlList.get(1)).enabled = false;
}
}
protected void actionPerformed(GuiButton var1) {

View File

@ -27,8 +27,7 @@ public class GuiMultiplayer extends GuiScreen {
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, "Connect"));
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, "Cancel"));
this.serverAddress = this.mc.gameSettings.field_12259_z.replaceAll("_", ":");
this.username = this.mc.gameSettings.username;
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0 && this.username.length() > 0 && !this.serverAddress.isBlank() && !this.username.isBlank() && !this.serverAddress.isEmpty() && !this.username.isEmpty();
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0;
}
protected void actionPerformed(GuiButton var1) {
@ -41,7 +40,7 @@ public class GuiMultiplayer extends GuiScreen {
this.mc.gameSettings.username = this.username;
this.mc.gameSettings.saveOptions();
String[] var2 = this.serverAddress.split(":");
this.mc.displayGuiScreen(new GuiConnecting(this.mc, serverAddress));
this.mc.displayGuiScreen(new GuiConnecting(this.mc, var2[0], var2.length > 1 ? this.func_4067_a(var2[1], 25565) : 25565));
}
}
@ -77,7 +76,7 @@ public class GuiMultiplayer extends GuiScreen {
protected void keyTyped(char var1, int var2) {
if(this.serverTextBox) {
if(var1 == 22) {
String var3 = null;
String var3 = GuiScreen.getClipboardString();
if(var3 == null) {
var3 = "";
}
@ -107,9 +106,11 @@ public class GuiMultiplayer extends GuiScreen {
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0 && this.username.length() > 0 && !this.serverAddress.isBlank() && !this.username.isBlank() && !this.serverAddress.isEmpty() && !this.username.isEmpty();
} else if(this.usernameTextBox) {
if(var1 == 22) {
String var3 = null;
String var3 = GuiScreen.getClipboardString();
if(var3 == null) {
var3 = "";
} else {
var3.replaceAll("[^a-zA-Z0-9]", "");
}
int var4 = 16 - this.username.length();
@ -177,4 +178,4 @@ public class GuiMultiplayer extends GuiScreen {
private boolean containsOnlyAZ09(String input) {
return input.matches("[a-z0-9]+") || input.matches("[A-Z0-9]+");
}
}
}

View File

@ -144,4 +144,8 @@ public class GuiScreen extends Gui {
public void deleteWorld(boolean var1, int var2) {
}
public static String getClipboardString() {
return GL11.getClipboard();
}
}

View File

@ -33,7 +33,12 @@ public class MetadataChunkBlock {
int var9 = var1.getSavedLightValue(this.field_1299_a, var6, var8, var7);
boolean var10 = false;
int var11 = var1.getBlockId(var6, var8, var7);
int var12 = Block.lightOpacity[var11];
int var12;
if(!(var11 < 0 || var11 > 256)) {
var12 = Block.lightOpacity[var11];
} else {
var12 = 0;
}
if(var12 == 0) {
var12 = 1;
}

View File

@ -7,21 +7,22 @@ import net.minecraft.client.Minecraft;
public class NetClientHandler extends NetHandler {
private boolean disconnected = false;
private NetworkManager netManager;
public static NetworkManager netManager;
public String field_1209_a;
private Minecraft mc;
private WorldClient worldClient;
private boolean field_1210_g = false;
Random rand = new Random();
public NetClientHandler(Minecraft var1, String var2) throws IOException, UnknownHostException {
public NetClientHandler(Minecraft var1, String var2, int var3) throws IOException, UnknownHostException {
this.mc = var1;
this.netManager = new NetworkManager(var2, this);
String ip = var2;
this.netManager = new NetworkManager(ip, this);
}
public void processReadPackets() {
if(!this.disconnected) {
this.netManager.readPacket();
this.netManager.processReadPackets();
}
}

View File

@ -1,11 +1,12 @@
package net.minecraft.src;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
@ -15,86 +16,67 @@ import java.util.List;
import net.PeytonPlayz585.opengl.GL11;
public class NetworkManager {
private Object sendQueueLock = new Object();
private boolean isRunning = true;
private NetHandler netHandler;
private String serverURI;
private List dataPackets = Collections.synchronizedList(new ArrayList());
private List chunkDataPackets = Collections.synchronizedList(new ArrayList());
private NetHandler netHandler;
private boolean isServerTerminating = false;
private boolean isTerminating = false;
private String terminationReason = "";
private int timeSinceLastRead = 0;
private int sendQueueByteLength = 0;
private int chunkDataSendCounter = 0;
public NetworkManager(String var4, NetHandler var3) throws IOException {
this.netHandler = var3;
String uri = null;
System.out.println(uri);
if(var4.startsWith("ws://")) {
uri = var4.substring(5);
}else if(var4.startsWith("wss://")){
uri = var4.substring(6);
}else if(!var4.contains("://")){
uri = var4;
var4 = "ws://" + var4;
}else {
throw new IOException("Invalid URI Protocol!");
}
if(!GL11.startConnection(var4)) {
//if(!GL11.startConnection(uri)) {
throw new IOException("Websocket to " + uri + " failed!");
//}
public static int numWriteThreads;
private Thread writeThread;
public NetworkManager(String uri, NetHandler netHandler) throws IOException {
this.serverURI = uri;
this.netHandler = netHandler;
if(!GL11.startConnection(uri)) {
throw new IOException("websocket to "+uri+" failed");
}
GL11.setDebugVar("minecraftServer", uri);
this.writeThread = new NetworkWriterThread(this, uri + " write thread");
this.writeThread.start();
}
public void setNetHandler(NetHandler netHandler) {
this.netHandler = netHandler;
}
public void addToSendQueue(Packet var1) {
if(!this.isServerTerminating) {
Object var2 = this.sendQueueLock;
synchronized(var2) {
this.sendQueueByteLength += var1.getPacketSize() + 1;
if(var1.isChunkDataPacket) {
this.chunkDataPackets.add(var1);
} else {
this.dataPackets.add(var1);
}
this.sendPacket();
if(this.isSocketOpen()) {
this.sendQueueByteLength += var1.getPacketSize() + 1;
if(var1.isChunkDataPacket) {
this.chunkDataPackets.add(var1);
} else {
this.dataPackets.add(var1);
}
}
}
private ByteArrayOutputStream sendBuffer;
private ByteArrayOutputStream sendBuffer = new ByteArrayOutputStream();
private void sendPacket() {
try {
sendBuffer.reset();
DataOutputStream yee = new DataOutputStream(sendBuffer);
boolean var1 = true;
Packet var2;
Object var3;
if(!this.dataPackets.isEmpty()) {
var1 = false;
var3 = this.sendQueueLock;
synchronized(var3) {
var2 = (Packet)this.dataPackets.remove(0);
this.sendQueueByteLength -= var2.getPacketSize() + 1;
}
sendBuffer = new ByteArrayOutputStream();
DataOutputStream yee = new DataOutputStream(sendBuffer);
var2 = (Packet)this.dataPackets.remove(0);
this.sendQueueByteLength -= var2.getPacketSize() + 1;
Packet.writePacket(var2, yee);
GL11.writePacket(sendBuffer.toByteArray());
}
sendBuffer.reset();
DataOutputStream yee2 = new DataOutputStream(sendBuffer);
if((var1 || this.chunkDataSendCounter-- <= 0) && !this.chunkDataPackets.isEmpty()) {
var1 = false;
var3 = this.sendQueueLock;
synchronized(var3) {
var2 = (Packet)this.chunkDataPackets.remove(0);
this.sendQueueByteLength -= var2.getPacketSize() + 1;
}
sendBuffer = new ByteArrayOutputStream();
DataOutputStream yee = new DataOutputStream(sendBuffer);
Packet.writePacket(var2, yee);
var2 = (Packet)this.chunkDataPackets.remove(0);
this.sendQueueByteLength -= var2.getPacketSize() + 1;
Packet.writePacket(var2, yee2);
GL11.writePacket(sendBuffer.toByteArray());
this.chunkDataSendCounter = 50;
}
@ -104,21 +86,39 @@ public class NetworkManager {
}
} catch (InterruptedException var8) {
} catch (Exception var9) {
if(!this.isTerminating) {
this.onNetworkError(var9);
if(this.isSocketOpen()) {
GL11.endConnection();
var9.printStackTrace();
}
}
}
// public void processReadPackets() {
// if(this.sendQueueByteLength > 1048576) {
// this.networkShutdown("Send buffer overflow");
// }
//
// if(this.readPackets.isEmpty()) {
// if(this.timeSinceLastRead++ == 1200) {
// this.networkShutdown("Timed out");
// }
// } else {
// this.timeSinceLastRead = 0;
// }
//
// int var1 = 100;
//
// while(!this.readPackets.isEmpty() && var1-- >= 0) {
// Packet var2 = (Packet)this.readPackets.remove(0);
// var2.processPacket(this.netHandler);
// }
// }
private ByteBuffer oldChunkBuffer = null;
private LinkedList<ByteBuffer> readChunks = new LinkedList();
public void readPacket() {
if(this.sendQueueByteLength > 1048576) {
this.networkShutdown("Send buffer overflow");
}
public void processReadPackets() {
readChunks.clear();
if(oldChunkBuffer != null) {
@ -130,7 +130,6 @@ public class NetworkManager {
readChunks.add(ByteBuffer.wrap(packet));
}
if(!readChunks.isEmpty()) {
this.timeSinceLastRead = 0;
int cap = 0;
for(ByteBuffer b : readChunks) {
cap += b.limit();
@ -143,25 +142,17 @@ public class NetworkManager {
stream.flip();
DataInputStream packetStream = new DataInputStream(new ByteBufferDirectInputStream(stream));
//int var1 = 100;
while(stream.hasRemaining()) {
stream.mark();
try {
Packet pkt = Packet.readPacket(packetStream);
if(pkt == null) {
this.networkShutdown("End of Stream");
}
pkt.processPacket(this.netHandler);
} catch (EOFException e) {
stream.reset();
break;
} catch (IOException e) {
continue;
} catch(ArrayIndexOutOfBoundsException e) {
continue;
} catch(NullPointerException e) {
continue;
} catch(Throwable e2) {
} catch (Throwable e2) {
e2.printStackTrace();
}
}
@ -172,48 +163,46 @@ public class NetworkManager {
oldChunkBuffer = null;
}
} else {
if(this.timeSinceLastRead++ == 1200) {
this.networkShutdown("Timed out");
}
}
if(this.isTerminating && this.readChunks.isEmpty()) {
this.netHandler.handleErrorMessage(this.terminationReason);
}
}
private void onNetworkError(Exception var1) {
var1.printStackTrace();
this.networkShutdown("Internal exception: " + var1.toString());
}
public void networkShutdown(String var1) {
if(this.isRunning) {
this.isTerminating = true;
this.terminationReason = var1;
this.isRunning = false;
if(GL11.connectionOpen()) {
GL11.endConnection();
}
public void serverShutdown() {
if(GL11.connectionOpen()) {
GL11.endConnection();
GL11.setDebugVar("minecraftServer", "null");
}
}
static boolean isRunning(NetworkManager var0) {
return var0.isRunning;
public int packetSize() {
return 0;
}
public void networkShutdown(String var1, Object... var2) {
serverShutdown();
}
public void closeConnections() {
if(GL11.connectionOpen()) {
GL11.endConnection();
GL11.setDebugVar("minecraftServer", "null");
}
}
public String getServerURI() {
return this.serverURI;
}
static boolean isServerTerminating(NetworkManager var0) {
return var0.isServerTerminating;
public boolean isSocketOpen() {
return GL11.connectionOpen();
}
static void readNetworkPacket(NetworkManager var0) {
var0.readPacket();
}
static void sendNetworkPacket(NetworkManager var0) {
var0.sendPacket();
}
public static boolean isRunning(NetworkManager netManager) {
return netManager.isSocketOpen();
}
private static class ByteBufferDirectInputStream extends InputStream {
private ByteBuffer buf;
@ -231,4 +220,4 @@ public class NetworkManager {
return buf.remaining();
}
}
}
}

View File

@ -0,0 +1,33 @@
package net.minecraft.src;
class NetworkWriterThread extends Thread {
final NetworkManager netManager;
NetworkWriterThread(NetworkManager var1, String var2) {
super(var2);
this.netManager = var1;
}
public void run() {
++NetworkManager.numWriteThreads;
while(true) {
boolean var11 = false;
try {
var11 = true;
if(!NetworkManager.isRunning(this.netManager)) {
var11 = false;
break;
}
NetworkManager.sendNetworkPacket(this.netManager);
} finally {
if(var11) {
--NetworkManager.numWriteThreads;
}
}
}
--NetworkManager.numWriteThreads;
}
}

View File

@ -24,7 +24,19 @@ public class Packet5PlayerInventory extends Packet {
public void readPacketData(DataInputStream var1) throws IOException {
this.type = var1.readInt();
short var2 = var1.readShort();
this.stacks = new ItemStack[var2];
ItemStack[] stacks2 = this.stacks;
try {
this.stacks = new ItemStack[var2];
} catch(NegativeArraySizeException e) {
this.stacks = stacks2;
return;
} catch(IndexOutOfBoundsException e) {
this.stacks = stacks2;
return;
} catch(Exception e) {
this.stacks = stacks2;
return;
}
for(int var3 = 0; var3 < var2; ++var3) {
short var4 = var1.readShort();

View File

@ -127,8 +127,7 @@ public class PlayerControllerMP extends PlayerController {
this.field_1080_g = this.field_9442_f;
/*
* Plays background music
* Not needed
* I alr wrote my own system for it
* Not needed as I already wrote my own system to play music
*/
//this.mc.sndManager.func_4033_c();
}

View File

@ -1,34 +0,0 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
class ThreadConnectToServer extends Thread {
final Minecraft mc;
final String uri;
final GuiConnecting connectingGui;
ThreadConnectToServer(GuiConnecting var1, Minecraft var2, String var3) {
this.connectingGui = var1;
this.mc = var2;
this.uri = var3;
}
public void run() {
try {
GuiConnecting.setNetClientHandler(this.connectingGui, new NetClientHandler(this.mc, this.uri));
if(GuiConnecting.isCancelled(this.connectingGui)) {
return;
}
GuiConnecting.getNetClientHandler(this.connectingGui).addToSendQueue(new Packet2Handshake(this.mc.field_6320_i.inventory));
} catch (Exception var4) {
if(GuiConnecting.isCancelled(this.connectingGui)) {
return;
}
var4.printStackTrace();
this.mc.displayGuiScreen(new GuiConnectFailed("Failed to connect to the server", var4.toString()));
}
}
}

View File

@ -739,8 +739,10 @@ public class World implements IBlockAccess {
}
} else if(var1 == EnumSkyBlock.Block) {
int var6 = this.getBlockId(var2, var3, var4);
if(Block.lightValue[var6] > var5) {
var5 = Block.lightValue[var6];
if(!(var6 < 0 || var6 > 256)) {
if(Block.lightValue[var6] > var5) {
var5 = Block.lightValue[var6];
}
}
}

View File

@ -63,6 +63,7 @@ public class WorldClient extends World {
}
@Override
protected IChunkProvider func_4081_a(String var1) {
this.C = new ChunkProviderClient(this);
return this.C;

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eclipseProject/src_lwjgl_java/net/lax1dude/eaglercraft/Client.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.lax1dude.eaglercraft.Client"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="eclipseProject"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="eclipseProject"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.library.path=."/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}/../"/>
</launchConfiguration>

View File

@ -1158,6 +1158,7 @@ public class EaglerAdapterImpl2 {
@JSBody(params = { "name", "cvs" }, script = "var a=document.createElement(\"a\");a.href=cvs.toDataURL(\"image/png\");a.download=name;a.click();")
private static native void saveScreenshot(String name, HTMLCanvasElement cvs);
public static enum RateLimit {
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
}
@ -1317,6 +1318,7 @@ public class EaglerAdapterImpl2 {
return null;
}
}
public static final byte[] loadLocalStorage(String key) {
String s = win.getLocalStorage().getItem("_eaglercraft_beta."+key);
if(s != null) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long