Fix multiplayer
This commit is contained in:
parent
e2a7989070
commit
af16d25537
File diff suppressed because one or more lines are too long
|
@ -18,10 +18,11 @@ public class GameSettings {
|
||||||
File file1 = new File("filesystem");
|
File file1 = new File("filesystem");
|
||||||
File file = new File(file1, "options.txt");
|
File file = new File(file1, "options.txt");
|
||||||
if(!file.exists()) {
|
if(!file.exists()) {
|
||||||
|
file.createNewFile();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] fileData = new byte[0];
|
byte[] fileData = new byte[(int) file.length()];
|
||||||
try (FileInputStream fis = new FileInputStream(file)) {
|
try (FileInputStream fis = new FileInputStream(file)) {
|
||||||
fis.read(fileData);
|
fis.read(fileData);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
@ -92,6 +93,10 @@ public class GameSettings {
|
||||||
if(var3[0].equals("lastServer")) {
|
if(var3[0].equals("lastServer")) {
|
||||||
Minecraft.getMinecraft().gameSettings.field_12259_z = var3[1];
|
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) {
|
for(int var4 = 0; var4 < Minecraft.getMinecraft().gameSettings.keyBindings.length; ++var4) {
|
||||||
if(var3[0].equals("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var4].keyDescription)) {
|
if(var3[0].equals("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var4].keyDescription)) {
|
||||||
|
@ -124,6 +129,12 @@ public class GameSettings {
|
||||||
var1.println("difficulty:" + Minecraft.getMinecraft().gameSettings.difficulty);
|
var1.println("difficulty:" + Minecraft.getMinecraft().gameSettings.difficulty);
|
||||||
var1.println("fancyGraphics:" + Minecraft.getMinecraft().gameSettings.fancyGraphics);
|
var1.println("fancyGraphics:" + Minecraft.getMinecraft().gameSettings.fancyGraphics);
|
||||||
var1.println("skin:" + Minecraft.getMinecraft().gameSettings.skin);
|
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) {
|
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);
|
var1.println("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var2].keyDescription + ":" + Minecraft.getMinecraft().gameSettings.keyBindings[var2].keyCode);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.lax1dude.eaglercraft;
|
package net.lax1dude.eaglercraft;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import net.PeytonPlayz585.opengl.GL11;
|
import net.PeytonPlayz585.opengl.GL11;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.src.Session;
|
import net.minecraft.src.Session;
|
||||||
|
|
|
@ -71,9 +71,7 @@ import org.lwjgl.util.glu.GLU;
|
||||||
import net.lax1dude.eaglercraft.AssetRepository;
|
import net.lax1dude.eaglercraft.AssetRepository;
|
||||||
import net.lax1dude.eaglercraft.EaglerImage;
|
import net.lax1dude.eaglercraft.EaglerImage;
|
||||||
import net.lax1dude.eaglercraft.GameWindowListener;
|
import net.lax1dude.eaglercraft.GameWindowListener;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.src.MathHelper;
|
import net.minecraft.src.MathHelper;
|
||||||
import net.minecraft.src.NetClientHandler;
|
|
||||||
|
|
||||||
public class EaglerAdapterImpl2 {
|
public class EaglerAdapterImpl2 {
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private File chunkFileForXZ(int i, int j) {
|
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 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 s1 = Integer.toString(i & 0x3f, 36);
|
||||||
String s2 = Integer.toString(j & 0x3f, 36);
|
String s2 = Integer.toString(j & 0x3f, 36);
|
||||||
|
@ -44,6 +47,9 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk loadChunk(World world, int i, int j) {
|
public Chunk loadChunk(World world, int i, int j) {
|
||||||
|
if(saveDir == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
File file = chunkFileForXZ(i, j);
|
File file = chunkFileForXZ(i, j);
|
||||||
if (file != null && file.exists()) {
|
if (file != null && file.exists()) {
|
||||||
try {
|
try {
|
||||||
|
@ -78,6 +84,9 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveChunk(World world, Chunk chunk) {
|
public void saveChunk(World world, Chunk chunk) {
|
||||||
|
if(saveDir == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
world.func_663_l();
|
world.func_663_l();
|
||||||
File file = chunkFileForXZ(chunk.xPosition, chunk.zPosition);
|
File file = chunkFileForXZ(chunk.xPosition, chunk.zPosition);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
|
|
|
@ -118,7 +118,8 @@ public class Minecraft implements Runnable {
|
||||||
public void startGame() {
|
public void startGame() {
|
||||||
|
|
||||||
RenderManager.instance.field_4236_f = new ItemRenderer(this);
|
RenderManager.instance.field_4236_f = new ItemRenderer(this);
|
||||||
this.gameSettings = new GameSettings(this);
|
new GameSettings(this);
|
||||||
|
this.gameSettings.loadOptions();
|
||||||
this.texturePackList = new TexturePackList(this);
|
this.texturePackList = new TexturePackList(this);
|
||||||
this.renderEngine = new RenderEngine(texturePackList, this.gameSettings);
|
this.renderEngine = new RenderEngine(texturePackList, this.gameSettings);
|
||||||
this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine);
|
this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine);
|
||||||
|
@ -276,6 +277,12 @@ public class Minecraft implements Runnable {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.runTick();
|
this.runTick();
|
||||||
|
} catch(ArrayIndexOutOfBoundsException e) {
|
||||||
|
if(this.isMultiplayerWorld()) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
} catch (MinecraftException var14) {
|
} catch (MinecraftException var14) {
|
||||||
this.theWorld = null;
|
this.theWorld = null;
|
||||||
this.func_6261_a((World)null);
|
this.func_6261_a((World)null);
|
||||||
|
@ -313,7 +320,15 @@ public class Minecraft implements Runnable {
|
||||||
this.field_6327_b.func_6467_a(this.timer.renderPartialTicks);
|
this.field_6327_b.func_6467_a(this.timer.renderPartialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
|
try {
|
||||||
|
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
|
||||||
|
} catch(ArrayIndexOutOfBoundsException e) {
|
||||||
|
if(this.isMultiplayerWorld()) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!GL11.isFocused()) {
|
if(!GL11.isFocused()) {
|
||||||
|
@ -437,7 +452,7 @@ public class Minecraft implements Runnable {
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
System.out.println("Stopping!");
|
System.out.println("Stopping!");
|
||||||
if(this.theWorld != null && !this.theWorld.multiplayerWorld) {
|
if(this.theWorld != null && !this.isMultiplayerWorld()) {
|
||||||
this.theWorld.saveLevel();
|
this.theWorld.saveLevel();
|
||||||
this.theWorld.chunkProvider.saveChunks(false, (IProgressUpdate)null);
|
this.theWorld.chunkProvider.saveChunks(false, (IProgressUpdate)null);
|
||||||
}
|
}
|
||||||
|
@ -625,17 +640,6 @@ 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.ingameGUI.func_555_a();
|
||||||
this.field_9243_r.func_910_a(1.0F);
|
this.field_9243_r.func_910_a(1.0F);
|
||||||
if(this.thePlayer != null) {
|
if(this.thePlayer != null) {
|
||||||
|
@ -725,6 +729,10 @@ public class Minecraft implements Runnable {
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) {
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) {
|
||||||
this.thePlayer.dropPlayerItemWithRandomChoice(this.thePlayer.inventory.decrStackSize(this.thePlayer.inventory.currentItem, 1), false);
|
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) {
|
for(int var4 = 0; var4 < 9; ++var4) {
|
||||||
|
@ -736,10 +744,6 @@ public class Minecraft implements Runnable {
|
||||||
if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) {
|
if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) {
|
||||||
this.gameSettings.setOptionValue(4, !Keyboard.isKeyDown(42) && !Keyboard.isKeyDown(54) ? 1 : -1);
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1003,12 +1007,10 @@ public class Minecraft implements Runnable {
|
||||||
if(this.currentScreen instanceof GuiGameOver) {
|
if(this.currentScreen instanceof GuiGameOver) {
|
||||||
this.displayGuiScreen((GuiScreen)null);
|
this.displayGuiScreen((GuiScreen)null);
|
||||||
}
|
}
|
||||||
respawnTimer = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Minecraft getMinecraft() {
|
public static Minecraft getMinecraft() {
|
||||||
return mc;
|
return mc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int respawnTimer;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,18 +270,12 @@ public class Chunk {
|
||||||
|
|
||||||
this.data.setNibble(var1, var2, var3, var5);
|
this.data.setNibble(var1, var2, var3, var5);
|
||||||
if(!this.worldObj.worldProvider.field_6478_e) {
|
if(!this.worldObj.worldProvider.field_6478_e) {
|
||||||
if(!(var6 < 0 || var6 > 256)) {
|
if(Block.lightOpacity[var6] != 0) {
|
||||||
if(Block.lightOpacity[var6] != 0) {
|
if(var2 >= var7) {
|
||||||
if(var2 >= var7) {
|
this.func_1003_g(var1, var2 + 1, var3);
|
||||||
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);
|
this.worldObj.func_616_a(EnumSkyBlock.Sky, var9, var2, var10, var9, var2, var10);
|
||||||
|
@ -289,7 +283,7 @@ public class Chunk {
|
||||||
|
|
||||||
this.worldObj.func_616_a(EnumSkyBlock.Block, var9, var2, var10, var9, var2, var10);
|
this.worldObj.func_616_a(EnumSkyBlock.Block, var9, var2, var10, var9, var2, var10);
|
||||||
this.func_996_c(var1, var3);
|
this.func_996_c(var1, var3);
|
||||||
if(var4 != 0 && !(var4 < 0 || var4 > 256)) {
|
if(var4 != 0) {
|
||||||
Block.blocksList[var4].onBlockAdded(this.worldObj, var9, var2, var10);
|
Block.blocksList[var4].onBlockAdded(this.worldObj, var9, var2, var10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,11 +117,11 @@ public class ChunkCache implements IBlockAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBlockOpaqueCube(int var1, int var2, int var3) {
|
public boolean isBlockOpaqueCube(int var1, int var2, int var3) {
|
||||||
if(this.getBlockId(var1, var2, var3) < 0 || this.getBlockId(var1, var2, var3) > 256) {
|
if(!(this.getBlockId(var1, var2, var3) < 0)) {
|
||||||
return false;
|
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
|
||||||
|
return var4 == null ? false : var4.isOpaqueCube();
|
||||||
}
|
}
|
||||||
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
|
return false;
|
||||||
return var4 == null ? false : var4.isOpaqueCube();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldChunkManager func_4075_a() {
|
public WorldChunkManager func_4075_a() {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class GameSettings {
|
||||||
|
|
||||||
public GameSettings(Minecraft var1) {
|
public GameSettings(Minecraft var1) {
|
||||||
this.mc = var1;
|
this.mc = var1;
|
||||||
this.loadOptions();
|
this.mc.gameSettings = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameSettings() {
|
public GameSettings() {
|
||||||
|
@ -190,14 +190,14 @@ public class GameSettings {
|
||||||
if(var3[0].equals("skin")) {
|
if(var3[0].equals("skin")) {
|
||||||
this.skin = var3[1];
|
this.skin = var3[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var3[0].equals("lastServer")) {
|
|
||||||
this.field_12259_z = var3[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var3[0].equals("username")) {
|
if(var3[0].equals("username")) {
|
||||||
this.username = var3[1];
|
this.username = var3[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(var3[0].equals("lastServer")) {
|
||||||
|
this.field_12259_z = var3[1];
|
||||||
|
}
|
||||||
|
|
||||||
for(int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
for(int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
||||||
if(var3[0].equals("key_" + this.keyBindings[var4].keyDescription)) {
|
if(var3[0].equals("key_" + this.keyBindings[var4].keyDescription)) {
|
||||||
|
|
|
@ -1,79 +1,21 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import net.PeytonPlayz585.opengl.GL11;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class GuiConnecting extends GuiScreen {
|
public class GuiConnecting extends GuiScreen {
|
||||||
private NetClientHandler clientHandler;
|
private NetClientHandler clientHandler;
|
||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
String uri;
|
|
||||||
private int timer = 0;
|
|
||||||
|
|
||||||
public GuiConnecting(Minecraft var1, String var2, int var3) {
|
public GuiConnecting(Minecraft var1, String var2) {
|
||||||
cancelled = false;
|
|
||||||
uri = var2 + ":" + var3;
|
|
||||||
var1.func_6261_a((World)null);
|
var1.func_6261_a((World)null);
|
||||||
|
(new ThreadConnectToServer(this, var1, var2)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateScreen() {
|
public void updateScreen() {
|
||||||
if (timer > 2 && this.clientHandler == null) {
|
if(this.clientHandler != null) {
|
||||||
try {
|
this.clientHandler.processReadPackets();
|
||||||
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) {
|
protected void keyTyped(char var1, int var2) {
|
||||||
|
@ -97,9 +39,6 @@ public class GuiConnecting extends GuiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawScreen(int var1, int var2, float var3) {
|
public void drawScreen(int var1, int var2, float var3) {
|
||||||
if(timer == 0) {
|
|
||||||
timer = 1;
|
|
||||||
}
|
|
||||||
this.drawDefaultBackground();
|
this.drawDefaultBackground();
|
||||||
if(this.clientHandler == null) {
|
if(this.clientHandler == null) {
|
||||||
this.drawCenteredString(this.fontRenderer, "Connecting to the server...", this.width / 2, this.height / 2 - 50, 16777215);
|
this.drawCenteredString(this.fontRenderer, "Connecting to the server...", this.width / 2, this.height / 2 - 50, 16777215);
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class GuiIngameMenu extends GuiScreen {
|
||||||
if(this.mc.isMultiplayerWorld()) {
|
if(this.mc.isMultiplayerWorld()) {
|
||||||
((GuiButton)this.controlList.get(0)).displayString = "Disconnect";
|
((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(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..."));
|
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96, "Options..."));
|
||||||
}
|
}
|
||||||
|
@ -49,14 +49,12 @@ public class GuiIngameMenu extends GuiScreen {
|
||||||
|
|
||||||
public void drawScreen(int var1, int var2, float var3) {
|
public void drawScreen(int var1, int var2, float var3) {
|
||||||
this.drawDefaultBackground();
|
this.drawDefaultBackground();
|
||||||
if(!this.mc.theWorld.multiplayerWorld) {
|
boolean var4 = !this.mc.theWorld.func_650_a(this.updateCounter2++);
|
||||||
boolean var4 = !this.mc.theWorld.func_650_a(this.updateCounter2++);
|
if(var4 || this.updateCounter < 20) {
|
||||||
if(var4 || this.updateCounter < 20) {
|
float var5 = ((float)(this.updateCounter % 10) + var3) / 10.0F;
|
||||||
float var5 = ((float)(this.updateCounter % 10) + var3) / 10.0F;
|
var5 = MathHelper.sin(var5 * (float)Math.PI * 2.0F) * 0.2F + 0.8F;
|
||||||
var5 = MathHelper.sin(var5 * (float)Math.PI * 2.0F) * 0.2F + 0.8F;
|
int var6 = (int)(255.0F * var5);
|
||||||
int var6 = (int)(255.0F * var5);
|
this.drawString(this.fontRenderer, "Saving level..", 8, this.height - 16, var6 << 16 | var6 << 8 | var6);
|
||||||
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);
|
this.drawCenteredString(this.fontRenderer, "Game menu", this.width / 2, 40, 16777215);
|
||||||
|
|
|
@ -76,6 +76,9 @@ 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(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(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..."));
|
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) {
|
protected void actionPerformed(GuiButton var1) {
|
||||||
|
|
|
@ -27,7 +27,8 @@ 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(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.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.serverAddress = this.mc.gameSettings.field_12259_z.replaceAll("_", ":");
|
||||||
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionPerformed(GuiButton var1) {
|
protected void actionPerformed(GuiButton var1) {
|
||||||
|
@ -40,7 +41,7 @@ public class GuiMultiplayer extends GuiScreen {
|
||||||
this.mc.gameSettings.username = this.username;
|
this.mc.gameSettings.username = this.username;
|
||||||
this.mc.gameSettings.saveOptions();
|
this.mc.gameSettings.saveOptions();
|
||||||
String[] var2 = this.serverAddress.split(":");
|
String[] var2 = this.serverAddress.split(":");
|
||||||
this.mc.displayGuiScreen(new GuiConnecting(this.mc, var2[0], var2.length > 1 ? this.func_4067_a(var2[1], 25565) : 25565));
|
this.mc.displayGuiScreen(new GuiConnecting(this.mc, serverAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,7 +77,7 @@ public class GuiMultiplayer extends GuiScreen {
|
||||||
protected void keyTyped(char var1, int var2) {
|
protected void keyTyped(char var1, int var2) {
|
||||||
if(this.serverTextBox) {
|
if(this.serverTextBox) {
|
||||||
if(var1 == 22) {
|
if(var1 == 22) {
|
||||||
String var3 = GuiScreen.getClipboardString();
|
String var3 = null;
|
||||||
if(var3 == null) {
|
if(var3 == null) {
|
||||||
var3 = "";
|
var3 = "";
|
||||||
}
|
}
|
||||||
|
@ -106,11 +107,9 @@ 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();
|
((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) {
|
} else if(this.usernameTextBox) {
|
||||||
if(var1 == 22) {
|
if(var1 == 22) {
|
||||||
String var3 = GuiScreen.getClipboardString();
|
String var3 = null;
|
||||||
if(var3 == null) {
|
if(var3 == null) {
|
||||||
var3 = "";
|
var3 = "";
|
||||||
} else {
|
|
||||||
var3.replaceAll("[^a-zA-Z0-9]", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int var4 = 16 - this.username.length();
|
int var4 = 16 - this.username.length();
|
||||||
|
@ -178,4 +177,4 @@ public class GuiMultiplayer extends GuiScreen {
|
||||||
private boolean containsOnlyAZ09(String input) {
|
private boolean containsOnlyAZ09(String input) {
|
||||||
return input.matches("[a-z0-9]+") || input.matches("[A-Z0-9]+");
|
return input.matches("[a-z0-9]+") || input.matches("[A-Z0-9]+");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -144,8 +144,4 @@ public class GuiScreen extends Gui {
|
||||||
|
|
||||||
public void deleteWorld(boolean var1, int var2) {
|
public void deleteWorld(boolean var1, int var2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getClipboardString() {
|
|
||||||
return GL11.getClipboard();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,7 @@ public class MetadataChunkBlock {
|
||||||
int var9 = var1.getSavedLightValue(this.field_1299_a, var6, var8, var7);
|
int var9 = var1.getSavedLightValue(this.field_1299_a, var6, var8, var7);
|
||||||
boolean var10 = false;
|
boolean var10 = false;
|
||||||
int var11 = var1.getBlockId(var6, var8, var7);
|
int var11 = var1.getBlockId(var6, var8, var7);
|
||||||
int var12;
|
int var12 = Block.lightOpacity[var11];
|
||||||
if(!(var11 < 0 || var11 > 256)) {
|
|
||||||
var12 = Block.lightOpacity[var11];
|
|
||||||
} else {
|
|
||||||
var12 = 0;
|
|
||||||
}
|
|
||||||
if(var12 == 0) {
|
if(var12 == 0) {
|
||||||
var12 = 1;
|
var12 = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,22 +7,21 @@ import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class NetClientHandler extends NetHandler {
|
public class NetClientHandler extends NetHandler {
|
||||||
private boolean disconnected = false;
|
private boolean disconnected = false;
|
||||||
public static NetworkManager netManager;
|
private NetworkManager netManager;
|
||||||
public String field_1209_a;
|
public String field_1209_a;
|
||||||
private Minecraft mc;
|
private Minecraft mc;
|
||||||
private WorldClient worldClient;
|
private WorldClient worldClient;
|
||||||
private boolean field_1210_g = false;
|
private boolean field_1210_g = false;
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
public NetClientHandler(Minecraft var1, String var2, int var3) throws IOException, UnknownHostException {
|
public NetClientHandler(Minecraft var1, String var2) throws IOException, UnknownHostException {
|
||||||
this.mc = var1;
|
this.mc = var1;
|
||||||
String ip = var2;
|
this.netManager = new NetworkManager(var2, this);
|
||||||
this.netManager = new NetworkManager(ip, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processReadPackets() {
|
public void processReadPackets() {
|
||||||
if(!this.disconnected) {
|
if(!this.disconnected) {
|
||||||
this.netManager.processReadPackets();
|
this.netManager.readPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -16,67 +15,86 @@ import java.util.List;
|
||||||
import net.PeytonPlayz585.opengl.GL11;
|
import net.PeytonPlayz585.opengl.GL11;
|
||||||
|
|
||||||
public class NetworkManager {
|
public class NetworkManager {
|
||||||
|
private Object sendQueueLock = new Object();
|
||||||
private NetHandler netHandler;
|
private boolean isRunning = true;
|
||||||
private String serverURI;
|
|
||||||
|
|
||||||
private List dataPackets = Collections.synchronizedList(new ArrayList());
|
private List dataPackets = Collections.synchronizedList(new ArrayList());
|
||||||
private List chunkDataPackets = 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 timeSinceLastRead = 0;
|
||||||
private int sendQueueByteLength = 0;
|
private int sendQueueByteLength = 0;
|
||||||
private int chunkDataSendCounter = 0;
|
private int chunkDataSendCounter = 0;
|
||||||
public static int numWriteThreads;
|
|
||||||
private Thread writeThread;
|
public NetworkManager(String var4, NetHandler var3) throws IOException {
|
||||||
|
this.netHandler = var3;
|
||||||
public NetworkManager(String uri, NetHandler netHandler) throws IOException {
|
String uri = null;
|
||||||
this.serverURI = uri;
|
System.out.println(uri);
|
||||||
this.netHandler = netHandler;
|
if(var4.startsWith("ws://")) {
|
||||||
if(!GL11.startConnection(uri)) {
|
uri = var4.substring(5);
|
||||||
throw new IOException("websocket to "+uri+" failed");
|
}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!");
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
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) {
|
public void addToSendQueue(Packet var1) {
|
||||||
if(this.isSocketOpen()) {
|
if(!this.isServerTerminating) {
|
||||||
this.sendQueueByteLength += var1.getPacketSize() + 1;
|
Object var2 = this.sendQueueLock;
|
||||||
if(var1.isChunkDataPacket) {
|
synchronized(var2) {
|
||||||
this.chunkDataPackets.add(var1);
|
this.sendQueueByteLength += var1.getPacketSize() + 1;
|
||||||
} else {
|
if(var1.isChunkDataPacket) {
|
||||||
this.dataPackets.add(var1);
|
this.chunkDataPackets.add(var1);
|
||||||
|
} else {
|
||||||
|
this.dataPackets.add(var1);
|
||||||
|
}
|
||||||
|
this.sendPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ByteArrayOutputStream sendBuffer = new ByteArrayOutputStream();
|
private ByteArrayOutputStream sendBuffer;
|
||||||
|
|
||||||
private void sendPacket() {
|
private void sendPacket() {
|
||||||
try {
|
try {
|
||||||
sendBuffer.reset();
|
|
||||||
DataOutputStream yee = new DataOutputStream(sendBuffer);
|
|
||||||
boolean var1 = true;
|
boolean var1 = true;
|
||||||
Packet var2;
|
Packet var2;
|
||||||
|
Object var3;
|
||||||
if(!this.dataPackets.isEmpty()) {
|
if(!this.dataPackets.isEmpty()) {
|
||||||
var1 = false;
|
var1 = false;
|
||||||
var2 = (Packet)this.dataPackets.remove(0);
|
var3 = this.sendQueueLock;
|
||||||
this.sendQueueByteLength -= var2.getPacketSize() + 1;
|
synchronized(var3) {
|
||||||
|
var2 = (Packet)this.dataPackets.remove(0);
|
||||||
|
this.sendQueueByteLength -= var2.getPacketSize() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendBuffer = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream yee = new DataOutputStream(sendBuffer);
|
||||||
Packet.writePacket(var2, yee);
|
Packet.writePacket(var2, yee);
|
||||||
GL11.writePacket(sendBuffer.toByteArray());
|
GL11.writePacket(sendBuffer.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
sendBuffer.reset();
|
|
||||||
DataOutputStream yee2 = new DataOutputStream(sendBuffer);
|
|
||||||
if((var1 || this.chunkDataSendCounter-- <= 0) && !this.chunkDataPackets.isEmpty()) {
|
if((var1 || this.chunkDataSendCounter-- <= 0) && !this.chunkDataPackets.isEmpty()) {
|
||||||
var1 = false;
|
var1 = false;
|
||||||
var2 = (Packet)this.chunkDataPackets.remove(0);
|
var3 = this.sendQueueLock;
|
||||||
this.sendQueueByteLength -= var2.getPacketSize() + 1;
|
synchronized(var3) {
|
||||||
Packet.writePacket(var2, yee2);
|
var2 = (Packet)this.chunkDataPackets.remove(0);
|
||||||
|
this.sendQueueByteLength -= var2.getPacketSize() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendBuffer = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream yee = new DataOutputStream(sendBuffer);
|
||||||
|
Packet.writePacket(var2, yee);
|
||||||
GL11.writePacket(sendBuffer.toByteArray());
|
GL11.writePacket(sendBuffer.toByteArray());
|
||||||
this.chunkDataSendCounter = 50;
|
this.chunkDataSendCounter = 50;
|
||||||
}
|
}
|
||||||
|
@ -86,39 +104,21 @@ public class NetworkManager {
|
||||||
}
|
}
|
||||||
} catch (InterruptedException var8) {
|
} catch (InterruptedException var8) {
|
||||||
} catch (Exception var9) {
|
} catch (Exception var9) {
|
||||||
if(this.isSocketOpen()) {
|
if(!this.isTerminating) {
|
||||||
GL11.endConnection();
|
this.onNetworkError(var9);
|
||||||
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 ByteBuffer oldChunkBuffer = null;
|
||||||
private LinkedList<ByteBuffer> readChunks = new LinkedList();
|
private LinkedList<ByteBuffer> readChunks = new LinkedList();
|
||||||
|
|
||||||
public void processReadPackets() {
|
public void readPacket() {
|
||||||
|
if(this.sendQueueByteLength > 1048576) {
|
||||||
|
this.networkShutdown("Send buffer overflow");
|
||||||
|
}
|
||||||
|
|
||||||
readChunks.clear();
|
readChunks.clear();
|
||||||
|
|
||||||
if(oldChunkBuffer != null) {
|
if(oldChunkBuffer != null) {
|
||||||
|
@ -130,6 +130,7 @@ public class NetworkManager {
|
||||||
readChunks.add(ByteBuffer.wrap(packet));
|
readChunks.add(ByteBuffer.wrap(packet));
|
||||||
}
|
}
|
||||||
if(!readChunks.isEmpty()) {
|
if(!readChunks.isEmpty()) {
|
||||||
|
this.timeSinceLastRead = 0;
|
||||||
int cap = 0;
|
int cap = 0;
|
||||||
for(ByteBuffer b : readChunks) {
|
for(ByteBuffer b : readChunks) {
|
||||||
cap += b.limit();
|
cap += b.limit();
|
||||||
|
@ -142,17 +143,25 @@ public class NetworkManager {
|
||||||
stream.flip();
|
stream.flip();
|
||||||
|
|
||||||
DataInputStream packetStream = new DataInputStream(new ByteBufferDirectInputStream(stream));
|
DataInputStream packetStream = new DataInputStream(new ByteBufferDirectInputStream(stream));
|
||||||
|
//int var1 = 100;
|
||||||
while(stream.hasRemaining()) {
|
while(stream.hasRemaining()) {
|
||||||
stream.mark();
|
stream.mark();
|
||||||
try {
|
try {
|
||||||
Packet pkt = Packet.readPacket(packetStream);
|
Packet pkt = Packet.readPacket(packetStream);
|
||||||
|
if(pkt == null) {
|
||||||
|
this.networkShutdown("End of Stream");
|
||||||
|
}
|
||||||
pkt.processPacket(this.netHandler);
|
pkt.processPacket(this.netHandler);
|
||||||
} catch (EOFException e) {
|
} catch (EOFException e) {
|
||||||
stream.reset();
|
stream.reset();
|
||||||
break;
|
break;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
continue;
|
continue;
|
||||||
} catch (Throwable e2) {
|
} catch(ArrayIndexOutOfBoundsException e) {
|
||||||
|
continue;
|
||||||
|
} catch(NullPointerException e) {
|
||||||
|
continue;
|
||||||
|
} catch(Throwable e2) {
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,46 +172,48 @@ public class NetworkManager {
|
||||||
oldChunkBuffer = null;
|
oldChunkBuffer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(this.timeSinceLastRead++ == 1200) {
|
||||||
|
this.networkShutdown("Timed out");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if(this.isTerminating && this.readChunks.isEmpty()) {
|
||||||
public void serverShutdown() {
|
this.netHandler.handleErrorMessage(this.terminationReason);
|
||||||
if(GL11.connectionOpen()) {
|
|
||||||
GL11.endConnection();
|
|
||||||
GL11.setDebugVar("minecraftServer", "null");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSocketOpen() {
|
private void onNetworkError(Exception var1) {
|
||||||
return GL11.connectionOpen();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean isRunning(NetworkManager var0) {
|
||||||
|
return var0.isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean isServerTerminating(NetworkManager var0) {
|
||||||
|
return var0.isServerTerminating;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void readNetworkPacket(NetworkManager var0) {
|
||||||
|
var0.readPacket();
|
||||||
|
}
|
||||||
|
|
||||||
static void sendNetworkPacket(NetworkManager var0) {
|
static void sendNetworkPacket(NetworkManager var0) {
|
||||||
var0.sendPacket();
|
var0.sendPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRunning(NetworkManager netManager) {
|
|
||||||
return netManager.isSocketOpen();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ByteBufferDirectInputStream extends InputStream {
|
private static class ByteBufferDirectInputStream extends InputStream {
|
||||||
private ByteBuffer buf;
|
private ByteBuffer buf;
|
||||||
|
@ -220,4 +231,4 @@ public class NetworkManager {
|
||||||
return buf.remaining();
|
return buf.remaining();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -24,19 +24,7 @@ public class Packet5PlayerInventory extends Packet {
|
||||||
public void readPacketData(DataInputStream var1) throws IOException {
|
public void readPacketData(DataInputStream var1) throws IOException {
|
||||||
this.type = var1.readInt();
|
this.type = var1.readInt();
|
||||||
short var2 = var1.readShort();
|
short var2 = var1.readShort();
|
||||||
ItemStack[] stacks2 = this.stacks;
|
this.stacks = new ItemStack[var2];
|
||||||
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) {
|
for(int var3 = 0; var3 < var2; ++var3) {
|
||||||
short var4 = var1.readShort();
|
short var4 = var1.readShort();
|
||||||
|
|
|
@ -127,7 +127,8 @@ public class PlayerControllerMP extends PlayerController {
|
||||||
this.field_1080_g = this.field_9442_f;
|
this.field_1080_g = this.field_9442_f;
|
||||||
/*
|
/*
|
||||||
* Plays background music
|
* Plays background music
|
||||||
* Not needed as I already wrote my own system to play music
|
* Not needed
|
||||||
|
* I alr wrote my own system for it
|
||||||
*/
|
*/
|
||||||
//this.mc.sndManager.func_4033_c();
|
//this.mc.sndManager.func_4033_c();
|
||||||
}
|
}
|
||||||
|
|
|
@ -781,7 +781,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
var8 = this.worldObj.getBlockId(var2.blockX, var2.blockY, var2.blockZ);
|
var8 = this.worldObj.getBlockId(var2.blockX, var2.blockY, var2.blockZ);
|
||||||
Block var9 = var8 > 0 ? Block.blocksList[var8] : null;
|
Block var9 = var8 > 0 ? Block.blocksList[var8] : null;
|
||||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
GL11.glPolygonOffset(3.0F, -3.0F);
|
GL11.glPolygonOffset(-3.0F, -3.0F);
|
||||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||||
var6.startDrawingQuads();
|
var6.startDrawingQuads();
|
||||||
double var10 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var5;
|
double var10 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var5;
|
||||||
|
|
34
src/main/java/net/minecraft/src/ThreadConnectToServer.java
Normal file
34
src/main/java/net/minecraft/src/ThreadConnectToServer.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -739,10 +739,8 @@ public class World implements IBlockAccess {
|
||||||
}
|
}
|
||||||
} else if(var1 == EnumSkyBlock.Block) {
|
} else if(var1 == EnumSkyBlock.Block) {
|
||||||
int var6 = this.getBlockId(var2, var3, var4);
|
int var6 = this.getBlockId(var2, var3, var4);
|
||||||
if(!(var6 < 0 || var6 > 256)) {
|
if(Block.lightValue[var6] > var5) {
|
||||||
if(Block.lightValue[var6] > var5) {
|
var5 = Block.lightValue[var6];
|
||||||
var5 = Block.lightValue[var6];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -63,7 +64,6 @@ public class WorldClient extends World {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected IChunkProvider func_4081_a(String var1) {
|
protected IChunkProvider func_4081_a(String var1) {
|
||||||
this.C = new ChunkProviderClient(this);
|
this.C = new ChunkProviderClient(this);
|
||||||
return this.C;
|
return this.C;
|
||||||
|
|
23
src/teavm/java/Client.launch
Normal file
23
src/teavm/java/Client.launch
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?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>
|
|
@ -1158,7 +1158,6 @@ public class EaglerAdapterImpl2 {
|
||||||
|
|
||||||
@JSBody(params = { "name", "cvs" }, script = "var a=document.createElement(\"a\");a.href=cvs.toDataURL(\"image/png\");a.download=name;a.click();")
|
@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);
|
private static native void saveScreenshot(String name, HTMLCanvasElement cvs);
|
||||||
|
|
||||||
public static enum RateLimit {
|
public static enum RateLimit {
|
||||||
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
|
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
|
||||||
}
|
}
|
||||||
|
@ -1318,7 +1317,6 @@ public class EaglerAdapterImpl2 {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final byte[] loadLocalStorage(String key) {
|
public static final byte[] loadLocalStorage(String key) {
|
||||||
String s = win.getLocalStorage().getItem("_eaglercraft_beta."+key);
|
String s = win.getLocalStorage().getItem("_eaglercraft_beta."+key);
|
||||||
if(s != null) {
|
if(s != null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user