diff --git a/src/main/java/com/mojang/minecraft/Entity.java b/src/main/java/com/mojang/minecraft/Entity.java index 3eef9da..cb1c307 100644 --- a/src/main/java/com/mojang/minecraft/Entity.java +++ b/src/main/java/com/mojang/minecraft/Entity.java @@ -4,7 +4,6 @@ import com.mojang.minecraft.level.BlockMap; import com.mojang.minecraft.level.Level; import com.mojang.minecraft.level.liquid.LiquidType; import com.mojang.minecraft.level.tile.Block; -import com.mojang.minecraft.level.tile.Tile$SoundType; import com.mojang.minecraft.model.Vec3D; import com.mojang.minecraft.net.PositionUpdate; import com.mojang.minecraft.phys.AABB; @@ -177,7 +176,7 @@ public abstract class Entity implements Serializable { float var7 = var2; float var8 = var3; AABB var9 = this.bb.copy(); - ArrayList var10 = this.level.getCubes(this.bb.expand(var1, var2, var3)); + ArrayList var10 = this.level.getCubes(this.bb.expand(var1, var2, var3)); for(int var11 = 0; var11 < var10.size(); ++var11) { var2 = ((AABB)var10.get(var11)).clipYCollide(this.bb, var2); diff --git a/src/main/java/com/mojang/minecraft/Minecraft.java b/src/main/java/com/mojang/minecraft/Minecraft.java index f163e97..9130690 100644 --- a/src/main/java/com/mojang/minecraft/Minecraft.java +++ b/src/main/java/com/mojang/minecraft/Minecraft.java @@ -16,7 +16,6 @@ import com.mojang.minecraft.model.HumanoidModel; import com.mojang.minecraft.model.ModelManager; import com.mojang.minecraft.model.ModelPart; import com.mojang.minecraft.model.Vec3D; -import com.mojang.minecraft.net.NetworkManager; import com.mojang.minecraft.net.NetworkPlayer; import com.mojang.minecraft.net.PacketType; import com.mojang.minecraft.particle.Particle; @@ -29,7 +28,6 @@ import com.mojang.minecraft.render.*; import com.mojang.minecraft.render.texture.TextureFX; import com.mojang.minecraft.render.texture.TextureLavaFX; import com.mojang.minecraft.render.texture.TextureWaterFX; -import com.mojang.net.NetworkHandler; import com.mojang.util.MathHelper; import net.PeytonPlayz585.main.MinecraftMain; @@ -47,7 +45,6 @@ import java.util.List; public final class Minecraft implements Runnable { public GameMode gamemode = new SurvivalGameMode(this); - private boolean fullscreen = false; public int width; public int height; private Timer timer = new Timer(20.0F); @@ -70,7 +67,6 @@ public final class Minecraft implements Runnable { public int levelId; public HUDScreen hud; public boolean online; - public NetworkManager networkManager; public MovingObjectPosition selected; public static GameSettings settings; String server; @@ -101,7 +97,6 @@ public final class Minecraft implements Runnable { new SleepForeverThread(this); this.width = var3; this.height = var4; - this.fullscreen = var5; } public final void setCurrentScreen(GuiScreen var1) { @@ -236,10 +231,6 @@ public final class Minecraft implements Runnable { checkGLError("Post startup"); this.hud = new HUDScreen(this, this.width, this.height); - (new SkinDownloadThread(this)).start(); - if(this.server != null && this.session != null) { - this.networkManager = new NetworkManager(this, this.server, this.port, this.session.username, this.session.mppass); - } } catch (Exception var62) { var62.printStackTrace(); throw new RuntimeException("Failed to start Minecraft! :("); @@ -1071,10 +1062,6 @@ public final class Minecraft implements Runnable { return; } - if(this.isOnline()) { - this.networkManager.sendBlockChange(var3, var4, var5, var1, var10); - } - this.level.netSetTile(var3, var4, var5, var10); var2 = this.renderer.heldBlock; this.renderer.heldBlock.pos = 0.0F; @@ -1114,245 +1101,6 @@ public final class Minecraft implements Runnable { int var40; int var46; int var45; - if(this.networkManager != null && !(this.currentScreen instanceof ErrorScreen)) { - if(!this.networkManager.isConnected()) { - this.progressBar.setTitle("Connecting.."); - this.progressBar.setProgress(0); - } else { - NetworkManager var20 = this.networkManager; - if(this.networkManager.successful) { - NetworkHandler var18 = var20.netHandler; - if(var20.netHandler.connected) { - try { - NetworkHandler var22 = var20.netHandler; - var20.netHandler.channel.read(var22.in); - var4 = 0; - - while(var22.in.position() > 0 && var4++ != 100) { - var22.in.flip(); - byte var5 = var22.in.get(0); - PacketType var6; - if((var6 = PacketType.packets[var5]) == null) { - throw new Exception("Bad command: " + var5); - } - - if(var22.in.remaining() < var6.length + 1) { - var22.in.compact(); - break; - } - - var22.in.get(); - Object[] var7 = new Object[var6.params.length]; - - for(var8 = 0; var8 < var7.length; ++var8) { - var7[var8] = var22.readObject(var6.params[var8]); - } - - NetworkManager var42 = var22.netManager; - if(var22.netManager.successful) { - if(var6 == PacketType.IDENTIFICATION) { - var42.minecraft.progressBar.setTitle(var7[1].toString()); - var42.minecraft.progressBar.setText(var7[2].toString()); - var42.minecraft.player.userType = ((Byte)var7[3]).byteValue(); - } else if(var6 == PacketType.LEVEL_INIT) { - var42.minecraft.setLevel((Level)null); - //var42.levelData = new ByteArrayOutputStream(); - } else if(var6 == PacketType.LEVEL_DATA) { - short var11 = ((Short)var7[0]).shortValue(); - byte[] var12 = (byte[])((byte[])var7[1]); - byte var13 = ((Byte)var7[2]).byteValue(); - var42.minecraft.progressBar.setProgress(var13); - //var42.levelData.write(var12, 0, var11); - } else if(var6 == PacketType.LEVEL_FINALIZE) { - //try { - //var42.levelData.close(); - //} catch (IOException var14) { - //var14.printStackTrace(); - //} - - //byte[] var51 = LevelIO.decompress(new ByteArrayInputStream(var42.levelData.toByteArray())); - //var42.levelData = null; - short var55 = ((Short)var7[0]).shortValue(); - short var63 = ((Short)var7[1]).shortValue(); - short var21 = ((Short)var7[2]).shortValue(); - Level var30; - (var30 = new Level()).setNetworkMode(true); - //var30.setData(var55, var63, var21, var51); - var42.minecraft.setLevel(var30); - var42.minecraft.online = false; - var42.levelLoaded = true; - } else if(var6 == PacketType.BLOCK_CHANGE) { - if(var42.minecraft.level != null) { - var42.minecraft.level.netSetTile(((Short)var7[0]).shortValue(), ((Short)var7[1]).shortValue(), ((Short)var7[2]).shortValue(), ((Byte)var7[3]).byteValue()); - } - } else { - byte var9; - String var34; - NetworkPlayer var33; - short var36; - short var10004; - byte var10001; - short var47; - short var10003; - if(var6 == PacketType.SPAWN_PLAYER) { - var10001 = ((Byte)var7[0]).byteValue(); - String var10002 = (String)var7[1]; - var10003 = ((Short)var7[2]).shortValue(); - var10004 = ((Short)var7[3]).shortValue(); - short var10005 = ((Short)var7[4]).shortValue(); - byte var10006 = ((Byte)var7[5]).byteValue(); - byte var58 = ((Byte)var7[6]).byteValue(); - var9 = var10006; - short var10 = var10005; - var47 = var10004; - var36 = var10003; - var34 = var10002; - var5 = var10001; - if(var5 >= 0) { - var9 = (byte)(var9 + 128); - var47 = (short)(var47 - 22); - var33 = new NetworkPlayer(var42.minecraft, var5, var34, var36, var47, var10, (float)(var9 * 360) / 256.0F, (float)(var58 * 360) / 256.0F); - var42.players.put(Byte.valueOf(var5), var33); - var42.minecraft.level.addEntity(var33); - } else { - var42.minecraft.level.setSpawnPos(var36 / 32, var47 / 32, var10 / 32, (float)(var9 * 320 / 256)); - var42.minecraft.player.moveTo((float)var36 / 32.0F, (float)var47 / 32.0F, (float)var10 / 32.0F, (float)(var9 * 360) / 256.0F, (float)(var58 * 360) / 256.0F); - } - } else { - byte var53; - NetworkPlayer var61; - byte var69; - if(var6 == PacketType.POSITION_ROTATION) { - var10001 = ((Byte)var7[0]).byteValue(); - short var66 = ((Short)var7[1]).shortValue(); - var10003 = ((Short)var7[2]).shortValue(); - var10004 = ((Short)var7[3]).shortValue(); - var69 = ((Byte)var7[4]).byteValue(); - var9 = ((Byte)var7[5]).byteValue(); - var53 = var69; - var47 = var10004; - var36 = var10003; - short var38 = var66; - var5 = var10001; - if(var5 < 0) { - var42.minecraft.player.moveTo((float)var38 / 32.0F, (float)var36 / 32.0F, (float)var47 / 32.0F, (float)(var53 * 360) / 256.0F, (float)(var9 * 360) / 256.0F); - } else { - var53 = (byte)(var53 + 128); - var36 = (short)(var36 - 22); - if((var61 = (NetworkPlayer)var42.players.get(Byte.valueOf(var5))) != null) { - var61.teleport(var38, var36, var47, (float)(var53 * 360) / 256.0F, (float)(var9 * 360) / 256.0F); - } - } - } else { - byte var37; - byte var44; - byte var49; - byte var65; - byte var67; - if(var6 == PacketType.POSITION_ROTATION_UPDATE) { - var10001 = ((Byte)var7[0]).byteValue(); - var67 = ((Byte)var7[1]).byteValue(); - var65 = ((Byte)var7[2]).byteValue(); - byte var64 = ((Byte)var7[3]).byteValue(); - var69 = ((Byte)var7[4]).byteValue(); - var9 = ((Byte)var7[5]).byteValue(); - var53 = var69; - var49 = var64; - var44 = var65; - var37 = var67; - var5 = var10001; - if(var5 >= 0) { - var53 = (byte)(var53 + 128); - if((var61 = (NetworkPlayer)var42.players.get(Byte.valueOf(var5))) != null) { - var61.queue(var37, var44, var49, (float)(var53 * 360) / 256.0F, (float)(var9 * 360) / 256.0F); - } - } - } else if(var6 == PacketType.ROTATION_UPDATE) { - var10001 = ((Byte)var7[0]).byteValue(); - var67 = ((Byte)var7[1]).byteValue(); - var44 = ((Byte)var7[2]).byteValue(); - var37 = var67; - var5 = var10001; - if(var5 >= 0) { - var37 = (byte)(var37 + 128); - NetworkPlayer var54; - if((var54 = (NetworkPlayer)var42.players.get(Byte.valueOf(var5))) != null) { - var54.queue((float)(var37 * 360) / 256.0F, (float)(var44 * 360) / 256.0F); - } - } - } else if(var6 == PacketType.POSITION_UPDATE) { - var10001 = ((Byte)var7[0]).byteValue(); - var67 = ((Byte)var7[1]).byteValue(); - var65 = ((Byte)var7[2]).byteValue(); - var49 = ((Byte)var7[3]).byteValue(); - var44 = var65; - var37 = var67; - var5 = var10001; - NetworkPlayer var59; - if(var5 >= 0 && (var59 = (NetworkPlayer)var42.players.get(Byte.valueOf(var5))) != null) { - var59.queue(var37, var44, var49); - } - } else if(var6 == PacketType.DESPAWN_PLAYER) { - var5 = ((Byte)var7[0]).byteValue(); - if(var5 >= 0 && (var33 = (NetworkPlayer)var42.players.remove(Byte.valueOf(var5))) != null) { - var42.minecraft.level.removeEntity(var33); - } - } else if(var6 == PacketType.CHAT_MESSAGE) { - var10001 = ((Byte)var7[0]).byteValue(); - var34 = (String)var7[1]; - var5 = var10001; - if(var5 < 0) { - var42.minecraft.hud.addChat("&e" + var34); - } else { - var42.players.get(Byte.valueOf(var5)); - var42.minecraft.hud.addChat(var34); - } - } else if(var6 == PacketType.DISCONNECT) { - var42.netHandler.close(); - var42.minecraft.setCurrentScreen(new ErrorScreen("Connection lost", (String)var7[0])); - } else if(var6 == PacketType.UPDATE_PLAYER_TYPE) { - var42.minecraft.player.userType = ((Byte)var7[0]).byteValue(); - } - } - } - } - } - - if(!var22.connected) { - break; - } - - var22.in.compact(); - } - - if(var22.out.position() > 0) { - var22.out.flip(); - var22.channel.write(var22.out); - var22.out.compact(); - } - } catch (Exception var15) { - var20.minecraft.setCurrentScreen(new ErrorScreen("Disconnected!", "You\'ve lost connection to the server")); - var20.minecraft.online = false; - var15.printStackTrace(); - var20.netHandler.close(); - var20.minecraft.networkManager = null; - } - } - } - - Player var28 = this.player; - var20 = this.networkManager; - if(this.networkManager.levelLoaded) { - int var24 = (int)(var28.x * 32.0F); - var4 = (int)(var28.y * 32.0F); - var40 = (int)(var28.z * 32.0F); - var46 = (int)(var28.yRot * 256.0F / 360.0F) & 255; - var45 = (int)(var28.xRot * 256.0F / 360.0F) & 255; - var20.netHandler.send(PacketType.POSITION_ROTATION, new Object[]{Integer.valueOf(-1), Integer.valueOf(var24), Integer.valueOf(var4), Integer.valueOf(var40), Integer.valueOf(var46), Integer.valueOf(var45)}); - } - } - } - if(this.currentScreen == null && this.player != null && this.player.health <= 0) { this.setCurrentScreen((GuiScreen)null); } @@ -1441,11 +1189,6 @@ public final class Minecraft implements Runnable { if(Keyboard.getEventKey() == this.settings.buildKey.key) { this.gamemode.openInventory(); } - - if(Keyboard.getEventKey() == this.settings.chatKey.key && this.networkManager != null && this.networkManager.isConnected()) { - this.player.releaseAllKeys(); - this.setCurrentScreen(new ChatInputScreen()); - } } for(var25 = 0; var25 < 9; ++var25) { @@ -1555,19 +1298,12 @@ public final class Minecraft implements Runnable { LevelRenderer var31 = this.levelRenderer; ++this.levelRenderer.ticks; this.level.tickEntities(); - if(!this.isOnline()) { - this.level.tick(); - } - + this.level.tick(); this.particleManager.tick(); } } - public final boolean isOnline() { - return this.networkManager != null; - } - public final void generateLevel(int var1) { String var2 = this.session != null?this.session.username:"anonymous"; Level var4 = (new LevelGenerator(this.progressBar)).generate(var2, 128 << var1, 128 << var1, 64); @@ -1592,16 +1328,7 @@ public final class Minecraft implements Runnable { this.gamemode.apply(var1); var1.font = this.fontRenderer; var1.rendererContext$5cd64a7f = this; - if(!this.isOnline()) { - this.player = (Player)var1.findSubclassOf(Player.class); - } else if(this.player != null) { - this.player.resetPos(); - this.gamemode.preparePlayer(this.player); - if(var1 != null) { - var1.player = this.player; - var1.addEntity(this.player); - } - } + this.player = (Player)var1.findSubclassOf(Player.class); } if(this.player == null) { diff --git a/src/main/java/com/mojang/minecraft/SkinDownloadThread.java b/src/main/java/com/mojang/minecraft/SkinDownloadThread.java deleted file mode 100644 index 9ca117a..0000000 --- a/src/main/java/com/mojang/minecraft/SkinDownloadThread.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.mojang.minecraft; - -import com.mojang.minecraft.player.Player; -import java.net.HttpURLConnection; -import java.net.URL; -import javax.imageio.ImageIO; - -public class SkinDownloadThread extends Thread -{ - public SkinDownloadThread(Minecraft minecraft) - { - super(); - - this.minecraft = minecraft; - } - - @Override - public void run() - { - if(minecraft.session != null) - { - HttpURLConnection connection = null; - - try { - connection = (HttpURLConnection)new URL("http://www.minecraft.net/skin/" + minecraft.session.username + ".png").openConnection(); - - connection.setDoInput(true); - connection.setDoOutput(false); - - connection.connect(); - -// if(connection.getResponseCode() != 404) -// { -// Player.newTexture = ImageIO.read(connection.getInputStream()); -// -// return; -// } - } catch (Exception var4) { - var4.printStackTrace(); - } finally { - if(connection != null) - { - connection.disconnect(); - } - } - - } - } - - private Minecraft minecraft; -} diff --git a/src/main/java/com/mojang/minecraft/gamemode/GameMode.java b/src/main/java/com/mojang/minecraft/gamemode/GameMode.java index 9ac7fac..651570f 100644 --- a/src/main/java/com/mojang/minecraft/gamemode/GameMode.java +++ b/src/main/java/com/mojang/minecraft/gamemode/GameMode.java @@ -48,11 +48,6 @@ public class GameMode if(block != null && success) { - if(minecraft.isOnline()) - { - minecraft.networkManager.sendBlockChange(x, y, z, 0, minecraft.player.inventory.getSelected()); - } - block.spawnBreakParticles(level, x, y, z, minecraft.particleManager); } diff --git a/src/main/java/com/mojang/minecraft/gui/ChatInputScreen.java b/src/main/java/com/mojang/minecraft/gui/ChatInputScreen.java index b16eeb1..8e36f90 100644 --- a/src/main/java/com/mojang/minecraft/gui/ChatInputScreen.java +++ b/src/main/java/com/mojang/minecraft/gui/ChatInputScreen.java @@ -1,7 +1,6 @@ package com.mojang.minecraft.gui; import com.mojang.minecraft.gui.GuiScreen; -import com.mojang.minecraft.net.NetworkManager; import com.mojang.minecraft.net.PacketType; import org.lwjgl.input.Keyboard; @@ -27,13 +26,6 @@ public final class ChatInputScreen extends GuiScreen { if(var2 == 1) { this.minecraft.setCurrentScreen((GuiScreen)null); } else if(var2 == 28) { - NetworkManager var10000 = this.minecraft.networkManager; - String var4 = this.message.trim(); - NetworkManager var3 = var10000; - if((var4 = var4.trim()).length() > 0) { - var3.netHandler.send(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var4}); - } - this.minecraft.setCurrentScreen((GuiScreen)null); } else { if(var2 == 14 && this.message.length() > 0) { diff --git a/src/main/java/com/mojang/minecraft/gui/HUDScreen.java b/src/main/java/com/mojang/minecraft/gui/HUDScreen.java index c1e69b1..9a5c92e 100644 --- a/src/main/java/com/mojang/minecraft/gui/HUDScreen.java +++ b/src/main/java/com/mojang/minecraft/gui/HUDScreen.java @@ -170,36 +170,6 @@ public final class HUDScreen extends Screen { var14 = this.width / 2; var15 = this.height / 2; this.hoveredPlayer = null; - if(Keyboard.isKeyDown(15) && this.mc.networkManager != null && this.mc.networkManager.isConnected()) { - List var22 = this.mc.networkManager.getPlayers(); - GL11.glEnable(3042); - GL11.glDisable(3553); - GL11.glBlendFunc(770, 771); - //GL11.glBegin(7); - GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.7F); - //GL11.glVertex2f((float)(var14 + 128), (float)(var15 - 68 - 12)); - //GL11.glVertex2f((float)(var14 - 128), (float)(var15 - 68 - 12)); - GL11.glColor4f(0.2F, 0.2F, 0.2F, 0.8F); - //GL11.glVertex2f((float)(var14 - 128), (float)(var15 + 68)); - //GL11.glVertex2f((float)(var14 + 128), (float)(var15 + 68)); - //GL11.glEnd(); - GL11.glDisable(3042); - GL11.glEnable(3553); - var23 = "Connected players:"; - var5.render(var23, var14 - var5.getWidth(var23) / 2, var15 - 64 - 12, 16777215); - - for(var11 = 0; var11 < var22.size(); ++var11) { - int var28 = var14 + var11 % 2 * 120 - 120; - int var17 = var15 - 64 + (var11 / 2 << 3); - if(var2 && var3 >= var28 && var4 >= var17 && var3 < var28 + 120 && var4 < var17 + 8) { - this.hoveredPlayer = (String)var22.get(var11); - var5.renderNoShadow((String)var22.get(var11), var28 + 2, var17, 16777215); - } else { - var5.renderNoShadow((String)var22.get(var11), var28, var17, 15658734); - } - } - } - } public final void addChat(String var1) { diff --git a/src/main/java/com/mojang/minecraft/gui/PauseScreen.java b/src/main/java/com/mojang/minecraft/gui/PauseScreen.java index 790f6f1..294b48f 100644 --- a/src/main/java/com/mojang/minecraft/gui/PauseScreen.java +++ b/src/main/java/com/mojang/minecraft/gui/PauseScreen.java @@ -13,13 +13,6 @@ public final class PauseScreen extends GuiScreen { ((Button)this.buttons.get(2)).active = false; ((Button)this.buttons.get(3)).active = false; } - - if(this.minecraft.networkManager != null) { - ((Button)this.buttons.get(1)).active = false; - ((Button)this.buttons.get(2)).active = false; - ((Button)this.buttons.get(3)).active = false; - } - } protected final void onButtonClick(Button var1) { @@ -31,16 +24,6 @@ public final class PauseScreen extends GuiScreen { this.minecraft.setCurrentScreen(new GenerateLevelScreen(this)); } - //if(this.minecraft.session != null) { - //if(var1.id == 2) { - //this.minecraft.setCurrentScreen(new SaveLevelScreen(this)); - //} - - //if(var1.id == 3) { - //this.minecraft.setCurrentScreen(new LoadLevelScreen(this)); - //} - //} - if(var1.id == 4) { this.minecraft.setCurrentScreen((GuiScreen)null); this.minecraft.grabMouse(); diff --git a/src/main/java/com/mojang/minecraft/net/NetworkManager.java b/src/main/java/com/mojang/minecraft/net/NetworkManager.java deleted file mode 100644 index f218ed8..0000000 --- a/src/main/java/com/mojang/minecraft/net/NetworkManager.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.mojang.minecraft.net; - -import com.mojang.minecraft.Minecraft; -import com.mojang.minecraft.gui.ErrorScreen; -import com.mojang.net.NetworkHandler; -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -public class NetworkManager -{ - public NetworkManager(Minecraft minecraft, String server, int port, String username, String key) - { - minecraft.online = true; - - this.minecraft = minecraft; - - players = new HashMap(); - - new ServerConnectThread(this, server, port, username, key, minecraft).start(); - } - -// public ByteArrayOutputStream levelData; - - public NetworkHandler netHandler; - - public Minecraft minecraft; - - public boolean successful = false; - public boolean levelLoaded = false; - - public HashMap players; - - public void sendBlockChange(int x, int y, int z, int mode, int block) - { - netHandler.send(PacketType.PLAYER_SET_BLOCK, new Object[] {x, y, z, mode, block}); - } - - public void error(Exception e) - { - netHandler.close(); - - ErrorScreen errorScreen = new ErrorScreen("Disconnected!", e.getMessage()); - - minecraft.setCurrentScreen(errorScreen); - - e.printStackTrace(); - } - - public boolean isConnected() - { - return netHandler != null && netHandler.connected; - } - - public List getPlayers() - { - ArrayList list = new ArrayList(); - - list.add(minecraft.session.username); - - Iterator playerIterator = this.players.values().iterator(); - - while(playerIterator.hasNext()) - { - NetworkPlayer networkPlayer = (NetworkPlayer)playerIterator.next(); - - list.add(networkPlayer.name); - } - - return list; - } -} diff --git a/src/main/java/com/mojang/minecraft/net/NetworkPlayer.java b/src/main/java/com/mojang/minecraft/net/NetworkPlayer.java index bb1a364..c29138a 100644 --- a/src/main/java/com/mojang/minecraft/net/NetworkPlayer.java +++ b/src/main/java/com/mojang/minecraft/net/NetworkPlayer.java @@ -3,8 +3,6 @@ package com.mojang.minecraft.net; import com.mojang.minecraft.Minecraft; import com.mojang.minecraft.gui.FontRenderer; import com.mojang.minecraft.mob.HumanoidMob; -import com.mojang.minecraft.net.PositionUpdate; -import com.mojang.minecraft.net.SkinDownloadThread; import com.mojang.minecraft.render.TextureLocation; import java.awt.image.BufferedImage; @@ -15,12 +13,11 @@ import org.lwjgl.opengl.GL11; public class NetworkPlayer extends HumanoidMob { public static final long serialVersionUID = 77479605454997290L; - private List moveQueue = new LinkedList(); + private List moveQueue = new LinkedList(); private Minecraft minecraft; private int xp; private int yp; private int zp; - private transient int a = -1; public transient BufferedImage newTexture = null; public String name; public String displayName; @@ -42,7 +39,6 @@ public class NetworkPlayer extends HumanoidMob { this.yRot = var7; this.armor = this.helmet = false; this.renderOffset = 0.6875F; - (new SkinDownloadThread(this)).start(); this.allowAlpha = false; } diff --git a/src/main/java/com/mojang/minecraft/net/ServerConnectThread.java b/src/main/java/com/mojang/minecraft/net/ServerConnectThread.java deleted file mode 100644 index e102efb..0000000 --- a/src/main/java/com/mojang/minecraft/net/ServerConnectThread.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.mojang.minecraft.net; - -import com.mojang.minecraft.Minecraft; -import com.mojang.minecraft.gui.ErrorScreen; -import com.mojang.net.NetworkHandler; - -public class ServerConnectThread extends Thread -{ - public ServerConnectThread(NetworkManager networkManager, String server, int port, String username, String key, Minecraft minecraft) { - super(); - - netManager = networkManager; - - this.server = server; - this.port = port; - - this.username = username; - this.key = key; - - this.minecraft = minecraft; - } - - @Override - public void run() - { - try { - netManager.netHandler = new NetworkHandler(server, port); - netManager.netHandler.netManager = netManager; - - netManager.netHandler.send(PacketType.IDENTIFICATION, new Object[]{Byte.valueOf((byte)7), this.username, this.key, Integer.valueOf(0)}); - - netManager.successful = true; - } catch (Exception var3) { - minecraft.online = false; - - minecraft.networkManager = null; - - minecraft.setCurrentScreen(new ErrorScreen("Failed to connect", "You failed to connect to the server. It\'s probably down!")); - - netManager.successful = false; - } - } - - private String server; - private int port; - - private String username; - private String key; - - private Minecraft minecraft; - - private NetworkManager netManager; -} diff --git a/src/main/java/com/mojang/minecraft/net/SkinDownloadThread.java b/src/main/java/com/mojang/minecraft/net/SkinDownloadThread.java deleted file mode 100644 index e8a4098..0000000 --- a/src/main/java/com/mojang/minecraft/net/SkinDownloadThread.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.mojang.minecraft.net; - -import java.net.HttpURLConnection; -import java.net.URL; -import javax.imageio.ImageIO; - -public class SkinDownloadThread extends Thread -{ - public SkinDownloadThread(NetworkPlayer networkPlayer) - { - super(); - - this.player = networkPlayer; - } - - @Override - public void run() - { - HttpURLConnection connection = null; - - try { - connection = (HttpURLConnection)new URL("http://www.minecraft.net/skin/" + player.name + ".png").openConnection(); - - connection.setDoInput(true); - connection.setDoOutput(false); - - connection.connect(); - - if(connection.getResponseCode() == 404) - { - return; - } - - player.newTexture = ImageIO.read(connection.getInputStream()); - } catch(Exception e) { - e.printStackTrace(); - } finally { - if(connection != null) - { - connection.disconnect(); - } - } - } - - private NetworkPlayer player; -} diff --git a/src/main/java/com/mojang/net/NetworkHandler.java b/src/main/java/com/mojang/net/NetworkHandler.java deleted file mode 100644 index cb6a88b..0000000 --- a/src/main/java/com/mojang/net/NetworkHandler.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.mojang.net; - -import com.mojang.minecraft.net.NetworkManager; -import com.mojang.minecraft.net.PacketType; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketException; -import java.nio.ByteBuffer; -import java.nio.channels.SocketChannel; -import java.util.Arrays; - -public final class NetworkHandler { - - public volatile boolean connected; - public SocketChannel channel; - public ByteBuffer in = ByteBuffer.allocate(1048576); - public ByteBuffer out = ByteBuffer.allocate(1048576); - public NetworkManager netManager; - private Socket sock; - private boolean unused = false; - private byte[] stringBytes = new byte[64]; - - - public NetworkHandler(String var1, int var2) { - try - { - channel = SocketChannel.open(); - this.channel.connect(new InetSocketAddress(var1, var2)); - this.channel.configureBlocking(false); - System.currentTimeMillis(); - this.sock = this.channel.socket(); - this.connected = true; - this.in.clear(); - this.out.clear(); - this.sock.setTcpNoDelay(true); - this.sock.setTrafficClass(24); - this.sock.setKeepAlive(false); - this.sock.setReuseAddress(false); - this.sock.setSoTimeout(100); - this.sock.getInetAddress().toString(); - } catch (SocketException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public final void close() { - try { - if(this.out.position() > 0) { - this.out.flip(); - this.channel.write(this.out); - this.out.compact(); - } - } catch (Exception var2) { - ; - } - - this.connected = false; - - try { - this.channel.close(); - } catch (Exception var1) { - ; - } - - this.sock = null; - this.channel = null; - } - - public final void send(PacketType var1, Object ... var2) { - if(this.connected) { - this.out.put(var1.opcode); - - for(int var3 = 0; var3 < var2.length; ++var3) { - Class var10001 = var1.params[var3]; - Object var4 = var2[var3]; - Class var5 = var10001; - NetworkHandler var6 = this; - if(this.connected) { - try { - if(var5 == Long.TYPE) { - var6.out.putLong(((Long)var4).longValue()); - } else if(var5 == Integer.TYPE) { - var6.out.putInt(((Number)var4).intValue()); - } else if(var5 == Short.TYPE) { - var6.out.putShort(((Number)var4).shortValue()); - } else if(var5 == Byte.TYPE) { - var6.out.put(((Number)var4).byteValue()); - } else if(var5 == Double.TYPE) { - var6.out.putDouble(((Double)var4).doubleValue()); - } else if(var5 == Float.TYPE) { - var6.out.putFloat(((Float)var4).floatValue()); - } else { - byte[] var9; - if(var5 != String.class) { - if(var5 == byte[].class) { - if((var9 = (byte[])((byte[])var4)).length < 1024) { - var9 = Arrays.copyOf(var9, 1024); - } - - var6.out.put(var9); - } - } else { - var9 = ((String)var4).getBytes("UTF-8"); - Arrays.fill(var6.stringBytes, (byte)32); - - int var8; - for(var8 = 0; var8 < 64 && var8 < var9.length; ++var8) { - var6.stringBytes[var8] = var9[var8]; - } - - for(var8 = var9.length; var8 < 64; ++var8) { - var6.stringBytes[var8] = 32; - } - - var6.out.put(var6.stringBytes); - } - } - } catch (Exception var7) { - this.netManager.error(var7); - } - } - } - - } - } - - public Object readObject(Class var1) { - if(!this.connected) { - return null; - } else { - try { - if(var1 == Long.TYPE) { - return Long.valueOf(this.in.getLong()); - } else if(var1 == Integer.TYPE) { - return Integer.valueOf(this.in.getInt()); - } else if(var1 == Short.TYPE) { - return Short.valueOf(this.in.getShort()); - } else if(var1 == Byte.TYPE) { - return Byte.valueOf(this.in.get()); - } else if(var1 == Double.TYPE) { - return Double.valueOf(this.in.getDouble()); - } else if(var1 == Float.TYPE) { - return Float.valueOf(this.in.getFloat()); - } else if(var1 == String.class) { - this.in.get(this.stringBytes); - return (new String(this.stringBytes, "UTF-8")).trim(); - } else if(var1 == byte[].class) { - byte[] var3 = new byte[1024]; - this.in.get(var3); - return var3; - } else { - return null; - } - } catch (Exception var2) { - this.netManager.error(var2); - return null; - } - } - } -}