Rewrite multiplayer, fix chunk loading
This commit is contained in:
parent
3bb6fb09c2
commit
ebe6ef8e93
File diff suppressed because one or more lines are too long
|
@ -18,10 +18,11 @@ 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[0];
|
||||
byte[] fileData = new byte[(int) file.length()];
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
fis.read(fileData);
|
||||
} catch(IOException e) {
|
||||
|
@ -73,8 +74,8 @@ public class GameSettings {
|
|||
Minecraft.getMinecraft().gameSettings.anaglyph = var3[1].equals("true");
|
||||
}
|
||||
|
||||
if(var3[0].equals("limitFramerate")) {
|
||||
Minecraft.getMinecraft().gameSettings.limitFramerate = var3[1].equals("true");
|
||||
if(var3[0].equals("showFPS")) {
|
||||
Minecraft.getMinecraft().gameSettings.showFPS = var3[1].equals("true");
|
||||
}
|
||||
|
||||
if(var3[0].equals("difficulty")) {
|
||||
|
@ -92,6 +93,10 @@ 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)) {
|
||||
|
@ -120,10 +125,16 @@ public class GameSettings {
|
|||
var1.println("viewDistance:" + Minecraft.getMinecraft().gameSettings.renderDistance);
|
||||
var1.println("bobView:" + Minecraft.getMinecraft().gameSettings.viewBobbing);
|
||||
var1.println("anaglyph3d:" + Minecraft.getMinecraft().gameSettings.anaglyph);
|
||||
var1.println("limitFramerate:" + Minecraft.getMinecraft().gameSettings.limitFramerate);
|
||||
var1.println("showFPS:" + Minecraft.getMinecraft().gameSettings.showFPS);
|
||||
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);
|
||||
|
|
|
@ -44,6 +44,8 @@ import javax.swing.JOptionPane;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
@ -1087,6 +1089,188 @@ public class EaglerAdapterImpl2 {
|
|||
public static final void syncDisplay(int performanceToFps) {
|
||||
Display.sync(performanceToFps);
|
||||
}
|
||||
|
||||
private static final Set<String> rateLimitedAddresses = new HashSet();
|
||||
private static final Set<String> blockedAddresses = new HashSet();
|
||||
|
||||
private static WebSocketClient clientSocket = null;
|
||||
private static final Object socketSync = new Object();
|
||||
|
||||
private static LinkedList<byte[]> readPackets = new LinkedList();
|
||||
|
||||
private static class EaglerSocketClient extends WebSocketClient {
|
||||
|
||||
private Exception currentException = null;
|
||||
private boolean wasAbleToConnect = false;
|
||||
private String serverUriString;
|
||||
private boolean socketIsAlive = false;
|
||||
|
||||
public EaglerSocketClient(URI serverUri, String str) throws IOException, InterruptedException {
|
||||
super(serverUri);
|
||||
this.setTcpNoDelay(true);
|
||||
this.setConnectionLostTimeout(5);
|
||||
System.out.println("[ws] connecting to " + serverUri.toString());
|
||||
rateLimitStatus = null;
|
||||
if (!this.connectBlocking(5, TimeUnit.SECONDS)) {
|
||||
synchronized (socketSync) {
|
||||
if (rateLimitStatus == null) {
|
||||
if (blockedAddresses.contains(str)) {
|
||||
rateLimitStatus = RateLimit.BLOCKED;
|
||||
} else if (rateLimitedAddresses.contains(str)) {
|
||||
rateLimitStatus = RateLimit.FAILED_POSSIBLY_LOCKED;
|
||||
} else {
|
||||
rateLimitStatus = RateLimit.FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IOException("could not connect socket", currentException);
|
||||
}
|
||||
serverUriString = str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(int arg0, String arg1, boolean arg2) {
|
||||
synchronized (socketSync) {
|
||||
readPackets.clear();
|
||||
System.out.println("[ws] disconnecting - " + currentException);
|
||||
currentException = null;
|
||||
if (!wasAbleToConnect && rateLimitStatus == null) {
|
||||
if (blockedAddresses.contains(serverUriString)) {
|
||||
rateLimitStatus = RateLimit.LOCKED;
|
||||
} else if (rateLimitedAddresses.contains(serverUriString)) {
|
||||
rateLimitStatus = RateLimit.FAILED_POSSIBLY_LOCKED;
|
||||
} else {
|
||||
rateLimitStatus = RateLimit.FAILED;
|
||||
}
|
||||
} else if (!socketIsAlive && (blockedAddresses.contains(serverUriString)
|
||||
|| rateLimitedAddresses.contains(serverUriString))) {
|
||||
rateLimitStatus = RateLimit.LOCKED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception arg0) {
|
||||
currentException = arg0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String arg0) {
|
||||
wasAbleToConnect = true;
|
||||
synchronized (socketSync) {
|
||||
if (arg0.equalsIgnoreCase("BLOCKED")) {
|
||||
rateLimitedAddresses.add(serverUriString);
|
||||
if (rateLimitStatus == null) {
|
||||
rateLimitStatus = RateLimit.BLOCKED;
|
||||
}
|
||||
} else if (arg0.equalsIgnoreCase("LOCKED")) {
|
||||
blockedAddresses.add(serverUriString);
|
||||
rateLimitedAddresses.add(serverUriString);
|
||||
if (rateLimitStatus == null) {
|
||||
rateLimitStatus = RateLimit.NOW_LOCKED;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.close();
|
||||
currentException = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(ByteBuffer arg0) {
|
||||
wasAbleToConnect = true;
|
||||
synchronized (socketSync) {
|
||||
readPackets.add(arg0.array());
|
||||
}
|
||||
currentException = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(ServerHandshake arg0) {
|
||||
System.out.println("[ws] connected.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final boolean startConnection(String uri) {
|
||||
if (clientSocket != null) {
|
||||
clientSocket.close();
|
||||
}
|
||||
rateLimitStatus = null;
|
||||
try {
|
||||
clientSocket = new EaglerSocketClient(new URI(uri), uri);
|
||||
return true;
|
||||
} catch (InterruptedException e) {
|
||||
clientSocket = null;
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final void endConnection() {
|
||||
synchronized (socketSync) {
|
||||
if (clientSocket.isOpen()) {
|
||||
clientSocket.close();
|
||||
}
|
||||
clientSocket = null;
|
||||
readPackets.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean connectionOpen() {
|
||||
return clientSocket != null && clientSocket.isOpen();
|
||||
}
|
||||
|
||||
public static final void writePacket(byte[] packet) {
|
||||
if (clientSocket != null && clientSocket.isOpen()) {
|
||||
clientSocket.send(ByteBuffer.wrap(packet));
|
||||
}
|
||||
}
|
||||
|
||||
public static final byte[] readPacket() {
|
||||
synchronized (socketSync) {
|
||||
if (!readPackets.isEmpty()) {
|
||||
return readPackets.remove(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static RateLimit rateLimitStatus = null;
|
||||
|
||||
public static enum RateLimit {
|
||||
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
|
||||
}
|
||||
|
||||
public static final RateLimit getRateLimitStatus() {
|
||||
RateLimit l = rateLimitStatus;
|
||||
rateLimitStatus = null;
|
||||
return l;
|
||||
}
|
||||
|
||||
public static final void logRateLimit(String addr, RateLimit l) {
|
||||
synchronized (socketSync) {
|
||||
if (l == RateLimit.LOCKED) {
|
||||
blockedAddresses.add(addr);
|
||||
} else {
|
||||
rateLimitedAddresses.add(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final RateLimit checkRateLimitHistory(String addr) {
|
||||
synchronized (socketSync) {
|
||||
if (blockedAddresses.contains(addr)) {
|
||||
return RateLimit.LOCKED;
|
||||
} else if (rateLimitedAddresses.contains(addr)) {
|
||||
return RateLimit.BLOCKED;
|
||||
} else {
|
||||
return RateLimit.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final byte[] loadLocalStorage(String key) {
|
||||
try {
|
||||
|
|
|
@ -6,12 +6,19 @@ import java.util.*;
|
|||
public class ChunkLoader implements IChunkLoader {
|
||||
|
||||
public ChunkLoader(String file, boolean flag) {
|
||||
File file1 = new File("filesystem");
|
||||
saveDir = new File(file1, file);
|
||||
if(file != null) {
|
||||
File file1 = new File("filesystem");
|
||||
saveDir = new File(file1, file);
|
||||
} else {
|
||||
saveDir = null;
|
||||
}
|
||||
createIfNecessary = flag;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -40,6 +47,9 @@ 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 {
|
||||
|
@ -74,6 +84,9 @@ 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()) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.src.EntityRenderer;
|
|||
import net.minecraft.src.FontRenderer;
|
||||
import net.minecraft.src.GLAllocation;
|
||||
import net.minecraft.src.GameSettings;
|
||||
import net.minecraft.src.GuiChat;
|
||||
import net.minecraft.src.GuiConflictWarning;
|
||||
import net.minecraft.src.GuiGameOver;
|
||||
import net.minecraft.src.GuiIngame;
|
||||
|
@ -289,17 +290,13 @@ public class Minecraft implements Runnable {
|
|||
this.sndManager.func_338_a(this.thePlayer, this.timer.renderPartialTicks);
|
||||
this.checkGLError("Pre render");
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(this.theWorld != null) {
|
||||
if(this.theWorld != null && !this.theWorld.multiplayerWorld) {
|
||||
while(this.theWorld.func_6465_g()) {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.gameSettings.limitFramerate) {
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(this.theWorld != null && this.theWorld.multiplayerWorld) {
|
||||
this.theWorld.func_6465_g();
|
||||
}
|
||||
|
||||
if(!(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(8))) {
|
||||
|
@ -351,7 +348,7 @@ public class Minecraft implements Runnable {
|
|||
GL11.optimize();
|
||||
++var3;
|
||||
|
||||
for(this.field_6316_m = true && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L;) {
|
||||
for(this.field_6316_m = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L;) {
|
||||
this.field_6292_I = var3 + " fps, " + WorldRenderer.field_1762_b + " chunk updates";
|
||||
WorldRenderer.field_1762_b = 0;
|
||||
debugFPS = var3;
|
||||
|
@ -715,6 +712,10 @@ 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) {
|
||||
|
@ -774,6 +775,9 @@ public class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
this.theWorld.difficultySetting = this.gameSettings.difficulty;
|
||||
if(this.theWorld.multiplayerWorld) {
|
||||
this.theWorld.difficultySetting = 3;
|
||||
}
|
||||
|
||||
if(!this.field_6316_m) {
|
||||
this.field_9243_r.func_911_a();
|
||||
|
@ -787,7 +791,7 @@ public class Minecraft implements Runnable {
|
|||
this.theWorld.func_633_c();
|
||||
}
|
||||
|
||||
if(!this.field_6316_m) {
|
||||
if(!this.field_6316_m || this.isMultiplayerWorld()) {
|
||||
this.theWorld.tick();
|
||||
}
|
||||
|
||||
|
@ -802,6 +806,10 @@ public class Minecraft implements Runnable {
|
|||
|
||||
this.field_6287_N = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean isMultiplayerWorld() {
|
||||
return this.theWorld != null && this.theWorld.multiplayerWorld;
|
||||
}
|
||||
|
||||
public void func_6247_b(String var1) {
|
||||
this.func_6261_a((World)null);
|
||||
|
@ -869,15 +877,20 @@ public class Minecraft implements Runnable {
|
|||
System.out.println("Player is " + this.thePlayer);
|
||||
if(var1 != null) {
|
||||
this.field_6327_b.func_717_a(var1);
|
||||
//if(!this.isMultiplayerWorld()) {
|
||||
if(!this.isMultiplayerWorld()) {
|
||||
if(var3 == null) {
|
||||
this.thePlayer = (EntityPlayerSP)var1.func_4085_a(EntityPlayerSP.class);
|
||||
}
|
||||
//}
|
||||
} else if(this.thePlayer != null) {
|
||||
this.thePlayer.preparePlayerToSpawn();
|
||||
if(var1 != null) {
|
||||
var1.entityJoinedWorld(this.thePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.func_6255_d(var2);
|
||||
//}
|
||||
}
|
||||
|
||||
System.out.println("Player is now " + this.thePlayer);
|
||||
if(this.thePlayer == null) {
|
||||
|
|
|
@ -290,7 +290,7 @@ public class Block {
|
|||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var7 = this.quantityDropped(var1.rand);
|
||||
|
||||
for(int var8 = 0; var8 < var7; ++var8) {
|
||||
|
@ -308,7 +308,7 @@ public class Block {
|
|||
}
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public float func_227_a(Entity var1) {
|
||||
|
|
|
@ -132,9 +132,9 @@ public class BlockButton extends Block {
|
|||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
//if(var1.multiplayerWorld) {
|
||||
//return true;
|
||||
//} else {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6 & 7;
|
||||
int var8 = 8 - (var6 & 8);
|
||||
|
@ -160,7 +160,7 @@ public class BlockButton extends Block {
|
|||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID);
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
|
@ -203,7 +203,7 @@ public class BlockButton extends Block {
|
|||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 & 7);
|
||||
|
@ -224,7 +224,7 @@ public class BlockButton extends Block {
|
|||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
var1.func_701_b(var2, var3, var4, var2, var3, var4);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_237_e() {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class BlockCrops extends BlockFlower {
|
|||
|
||||
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
|
||||
super.onBlockDestroyedByPlayer(var1, var2, var3, var4, var5);
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
for(int var6 = 0; var6 < 3; ++var6) {
|
||||
if(var1.rand.nextInt(15) <= var5) {
|
||||
float var7 = 0.7F;
|
||||
|
@ -96,7 +96,7 @@ public class BlockCrops extends BlockFlower {
|
|||
var1.entityJoinedWorld(var11);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ public class BlockJukeBox extends Block {
|
|||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if(var5 > 0) {
|
||||
this.ejectRecord(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,9 +133,9 @@ public class BlockLever extends Block {
|
|||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
//if(var1.multiplayerWorld) {
|
||||
//return true;
|
||||
//} else {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6 & 7;
|
||||
int var8 = 8 - (var6 & 8);
|
||||
|
@ -156,7 +156,7 @@ public class BlockLever extends Block {
|
|||
}
|
||||
|
||||
return true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
|
|
|
@ -52,15 +52,15 @@ public class BlockMinecartTrack extends Block {
|
|||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 15);
|
||||
this.func_4031_h(var1, var2, var3, var4);
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = false;
|
||||
if(!var1.isBlockOpaqueCube(var2, var3 - 1, var4)) {
|
||||
|
@ -90,12 +90,12 @@ public class BlockMinecartTrack extends Block {
|
|||
this.func_4031_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private void func_4031_h(World var1, int var2, int var3, int var4) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
(new MinecartTrackLogic(this, var1, var2, var3, var4)).func_792_a(var1.isBlockIndirectlyGettingPowered(var2, var3, var4));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,9 +131,9 @@ public class BlockPortal extends BlockBreakable {
|
|||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
var5.func_4039_q();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
|
|
|
@ -51,19 +51,19 @@ public class BlockPressurePlate extends Block {
|
|||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if(var1.getBlockMetadata(var2, var3, var4) != 0) {
|
||||
this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if(var1.getBlockMetadata(var2, var3, var4) != 1) {
|
||||
this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private void setStateIfMobInteractsWithPlate(World var1, int var2, int var3, int var4) {
|
||||
|
|
|
@ -149,7 +149,7 @@ public class BlockRedstoneWire extends Block {
|
|||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
|
@ -181,12 +181,12 @@ public class BlockRedstoneWire extends Block {
|
|||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
|
||||
|
@ -218,7 +218,7 @@ public class BlockRedstoneWire extends Block {
|
|||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxCurrentStrength(World var1, int var2, int var3, int var4, int var5) {
|
||||
|
@ -231,7 +231,7 @@ public class BlockRedstoneWire extends Block {
|
|||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = this.canPlaceBlockAt(var1, var2, var3, var4);
|
||||
if(!var7) {
|
||||
|
@ -242,7 +242,7 @@ public class BlockRedstoneWire extends Block {
|
|||
}
|
||||
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
|
|
|
@ -30,10 +30,10 @@ public class BlockTNT extends Block {
|
|||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
|
||||
//if(!var1.multiplayerWorld) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
EntityTNTPrimed var6 = new EntityTNTPrimed(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F));
|
||||
var1.entityJoinedWorld(var6);
|
||||
var1.playSoundAtEntity(var6, "random.fuse", 1.0F, 1.0F);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ public class Chunk {
|
|||
int var9 = this.xPosition * 16 + var1;
|
||||
int var10 = this.zPosition * 16 + var3;
|
||||
this.blocks[var1 << 11 | var3 << 7 | var2] = var6;
|
||||
if(var8 != 0) {
|
||||
if(var8 != 0 && !this.worldObj.multiplayerWorld) {
|
||||
Block.blocksList[var8].onBlockRemoval(this.worldObj, var9, var2, var10);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ public class Chunk {
|
|||
this.worldObj.func_616_a(EnumSkyBlock.Sky, var8, var2, var9, var8, var2, var9);
|
||||
this.worldObj.func_616_a(EnumSkyBlock.Block, var8, var2, var9, var8, var2, var9);
|
||||
this.func_996_c(var1, var3);
|
||||
if(var4 != 0) {
|
||||
if(var4 != 0 && !this.worldObj.multiplayerWorld) {
|
||||
Block.blocksList[var4].onBlockAdded(this.worldObj, var8, var2, var9);
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,9 @@ public abstract class Entity {
|
|||
this.field_9307_bi = false;
|
||||
}
|
||||
|
||||
if(this.fire > 0) {
|
||||
if(this.worldObj.multiplayerWorld) {
|
||||
this.fire = 0;
|
||||
} else if(this.fire > 0) {
|
||||
if(this.isImmuneToFire) {
|
||||
this.fire -= 4;
|
||||
if(this.fire < 0) {
|
||||
|
|
|
@ -232,14 +232,14 @@ public class EntityArrow extends Entity {
|
|||
}
|
||||
|
||||
public void onCollideWithPlayer(EntityPlayer var1) {
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
if(this.inGround && this.field_682_g == var1 && this.arrowShake <= 0 && var1.inventory.addItemStackToInventory(new ItemStack(Item.arrow.shiftedIndex, 1))) {
|
||||
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
var1.func_443_a_(this, 1);
|
||||
this.setEntityDead();
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public float func_392_h_() {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class EntityBoat extends Entity {
|
|||
}
|
||||
|
||||
public boolean canAttackEntity(Entity var1, int var2) {
|
||||
if(!this.isDead) {
|
||||
if(!this.worldObj.multiplayerWorld && !this.isDead) {
|
||||
this.field_808_c = -this.field_808_c;
|
||||
this.field_806_b = 10;
|
||||
this.field_807_a += var2 * 10;
|
||||
|
@ -136,41 +136,41 @@ public class EntityBoat extends Entity {
|
|||
double var8;
|
||||
double var10;
|
||||
double var23;
|
||||
//if(this.worldObj.multiplayerWorld) {
|
||||
//if(this.field_9394_d > 0) {
|
||||
//var23 = this.posX + (this.field_9393_e - this.posX) / (double)this.field_9394_d;
|
||||
//var6 = this.posY + (this.field_9392_f - this.posY) / (double)this.field_9394_d;
|
||||
//var8 = this.posZ + (this.field_9391_g - this.posZ) / (double)this.field_9394_d;
|
||||
if(this.worldObj.multiplayerWorld) {
|
||||
if(this.field_9394_d > 0) {
|
||||
var23 = this.posX + (this.field_9393_e - this.posX) / (double)this.field_9394_d;
|
||||
var6 = this.posY + (this.field_9392_f - this.posY) / (double)this.field_9394_d;
|
||||
var8 = this.posZ + (this.field_9391_g - this.posZ) / (double)this.field_9394_d;
|
||||
|
||||
//for(var10 = this.field_9390_h - (double)this.rotationYaw; var10 < -180.0D; var10 += 360.0D) {
|
||||
//}
|
||||
for(var10 = this.field_9390_h - (double)this.rotationYaw; var10 < -180.0D; var10 += 360.0D) {
|
||||
}
|
||||
|
||||
//while(var10 >= 180.0D) {
|
||||
//var10 -= 360.0D;
|
||||
//}
|
||||
while(var10 >= 180.0D) {
|
||||
var10 -= 360.0D;
|
||||
}
|
||||
|
||||
//this.rotationYaw = (float)((double)this.rotationYaw + var10 / (double)this.field_9394_d);
|
||||
//this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9389_i - (double)this.rotationPitch) / (double)this.field_9394_d);
|
||||
//--this.field_9394_d;
|
||||
//this.setPosition(var23, var6, var8);
|
||||
//this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
//} else {
|
||||
//var23 = this.posX + this.motionX;
|
||||
//var6 = this.posY + this.motionY;
|
||||
//var8 = this.posZ + this.motionZ;
|
||||
//this.setPosition(var23, var6, var8);
|
||||
//if(this.onGround) {
|
||||
//this.motionX *= 0.5D;
|
||||
//this.motionY *= 0.5D;
|
||||
//this.motionZ *= 0.5D;
|
||||
//}
|
||||
this.rotationYaw = (float)((double)this.rotationYaw + var10 / (double)this.field_9394_d);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9389_i - (double)this.rotationPitch) / (double)this.field_9394_d);
|
||||
--this.field_9394_d;
|
||||
this.setPosition(var23, var6, var8);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
} else {
|
||||
var23 = this.posX + this.motionX;
|
||||
var6 = this.posY + this.motionY;
|
||||
var8 = this.posZ + this.motionZ;
|
||||
this.setPosition(var23, var6, var8);
|
||||
if(this.onGround) {
|
||||
this.motionX *= 0.5D;
|
||||
this.motionY *= 0.5D;
|
||||
this.motionZ *= 0.5D;
|
||||
}
|
||||
|
||||
//this.motionX *= (double)0.99F;
|
||||
//this.motionY *= (double)0.95F;
|
||||
//this.motionZ *= (double)0.99F;
|
||||
//}
|
||||
this.motionX *= (double)0.99F;
|
||||
this.motionY *= (double)0.95F;
|
||||
this.motionZ *= (double)0.99F;
|
||||
}
|
||||
|
||||
//} else {
|
||||
} else {
|
||||
var23 = var2 * 2.0D - 1.0D;
|
||||
this.motionY += (double)0.04F * var23;
|
||||
if(this.riddenByEntity != null) {
|
||||
|
@ -226,7 +226,7 @@ public class EntityBoat extends Entity {
|
|||
}
|
||||
|
||||
if(this.field_9297_aI && var8 > 0.15D) {
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
this.setEntityDead();
|
||||
|
||||
int var24;
|
||||
|
@ -237,7 +237,7 @@ public class EntityBoat extends Entity {
|
|||
for(var24 = 0; var24 < 2; ++var24) {
|
||||
this.dropItemWithOffset(Item.stick.shiftedIndex, 1, 0.0F);
|
||||
}
|
||||
//}
|
||||
}
|
||||
} else {
|
||||
this.motionX *= (double)0.99F;
|
||||
this.motionY *= (double)0.95F;
|
||||
|
@ -284,7 +284,7 @@ public class EntityBoat extends Entity {
|
|||
this.riddenByEntity = null;
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_366_i_() {
|
||||
|
@ -309,9 +309,9 @@ public class EntityBoat extends Entity {
|
|||
if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != var1) {
|
||||
return true;
|
||||
} else {
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
var1.mountEntity(this);
|
||||
//}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class EntityChicken extends EntityAnimals {
|
|||
}
|
||||
|
||||
this.field_752_b += this.field_755_h * 2.0F;
|
||||
if(--this.timeUntilNextEgg <= 0) {
|
||||
if(!this.worldObj.multiplayerWorld && --this.timeUntilNextEgg <= 0) {
|
||||
this.worldObj.playSoundAtEntity(this, "mob.chickenplop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||
this.dropItem(Item.egg.shiftedIndex, 1);
|
||||
this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
|
||||
|
|
145
src/main/java/net/minecraft/src/EntityClientPlayerMP.java
Normal file
145
src/main/java/net/minecraft/src/EntityClientPlayerMP.java
Normal file
|
@ -0,0 +1,145 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class EntityClientPlayerMP extends EntityPlayerSP {
|
||||
private NetClientHandler field_797_bg;
|
||||
private int field_9380_bx = 0;
|
||||
private double field_9379_by;
|
||||
private double field_9378_bz;
|
||||
private double field_9377_bA;
|
||||
private double field_9376_bB;
|
||||
private float field_9385_bC;
|
||||
private float field_9384_bD;
|
||||
private InventoryPlayer field_9383_bE = new InventoryPlayer((EntityPlayer)null);
|
||||
private boolean field_9382_bF = false;
|
||||
private boolean field_9381_bG = false;
|
||||
private int field_12242_bI = 0;
|
||||
|
||||
public EntityClientPlayerMP(Minecraft var1, World var2, Session var3, NetClientHandler var4) {
|
||||
super(var1, var2, var3, 0);
|
||||
this.field_797_bg = var4;
|
||||
}
|
||||
|
||||
public boolean canAttackEntity(Entity var1, int var2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void heal(int var1) {
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
if(this.worldObj.blockExists(MathHelper.floor_double(this.posX), 64, MathHelper.floor_double(this.posZ))) {
|
||||
super.onUpdate();
|
||||
this.func_4056_N();
|
||||
}
|
||||
}
|
||||
|
||||
public void func_6420_o() {
|
||||
}
|
||||
|
||||
public void func_4056_N() {
|
||||
if(this.field_9380_bx++ == 20) {
|
||||
this.sendInventoryChanged();
|
||||
this.field_9380_bx = 0;
|
||||
}
|
||||
|
||||
boolean var1 = this.func_381_o();
|
||||
if(var1 != this.field_9381_bG) {
|
||||
if(var1) {
|
||||
this.field_797_bg.addToSendQueue(new Packet18ArmAnimation(this, 104));
|
||||
} else {
|
||||
this.field_797_bg.addToSendQueue(new Packet18ArmAnimation(this, 105));
|
||||
}
|
||||
|
||||
this.field_9381_bG = var1;
|
||||
}
|
||||
|
||||
double var2 = this.posX - this.field_9379_by;
|
||||
double var4 = this.boundingBox.minY - this.field_9378_bz;
|
||||
double var6 = this.posY - this.field_9377_bA;
|
||||
double var8 = this.posZ - this.field_9376_bB;
|
||||
double var10 = (double)(this.rotationYaw - this.field_9385_bC);
|
||||
double var12 = (double)(this.rotationPitch - this.field_9384_bD);
|
||||
boolean var14 = var4 != 0.0D || var6 != 0.0D || var2 != 0.0D || var8 != 0.0D;
|
||||
boolean var15 = var10 != 0.0D || var12 != 0.0D;
|
||||
if(this.ridingEntity != null) {
|
||||
if(var15) {
|
||||
this.field_797_bg.addToSendQueue(new Packet11PlayerPosition(this.motionX, -999.0D, -999.0D, this.motionZ, this.onGround));
|
||||
} else {
|
||||
this.field_797_bg.addToSendQueue(new Packet13PlayerLookMove(this.motionX, -999.0D, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround));
|
||||
}
|
||||
|
||||
var14 = false;
|
||||
} else if(var14 && var15) {
|
||||
this.field_797_bg.addToSendQueue(new Packet13PlayerLookMove(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround));
|
||||
this.field_12242_bI = 0;
|
||||
} else if(var14) {
|
||||
this.field_797_bg.addToSendQueue(new Packet11PlayerPosition(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.onGround));
|
||||
this.field_12242_bI = 0;
|
||||
} else if(var15) {
|
||||
this.field_797_bg.addToSendQueue(new Packet12PlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
|
||||
this.field_12242_bI = 0;
|
||||
} else {
|
||||
this.field_797_bg.addToSendQueue(new Packet10Flying(this.onGround));
|
||||
if(this.field_9382_bF == this.onGround && this.field_12242_bI <= 20) {
|
||||
++this.field_12242_bI;
|
||||
} else {
|
||||
this.field_12242_bI = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.field_9382_bF = this.onGround;
|
||||
if(var14) {
|
||||
this.field_9379_by = this.posX;
|
||||
this.field_9378_bz = this.boundingBox.minY;
|
||||
this.field_9377_bA = this.posY;
|
||||
this.field_9376_bB = this.posZ;
|
||||
}
|
||||
|
||||
if(var15) {
|
||||
this.field_9385_bC = this.rotationYaw;
|
||||
this.field_9384_bD = this.rotationPitch;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendInventoryChanged() {
|
||||
if(!this.inventory.compareInventory(this.field_9383_bE)) {
|
||||
this.field_797_bg.addToSendQueue(new Packet5PlayerInventory(-1, this.inventory.mainInventory));
|
||||
this.field_797_bg.addToSendQueue(new Packet5PlayerInventory(-2, this.inventory.craftingInventory));
|
||||
this.field_797_bg.addToSendQueue(new Packet5PlayerInventory(-3, this.inventory.armorInventory));
|
||||
this.field_9383_bE = this.inventory.copyInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void joinEntityItemWithWorld(EntityItem var1) {
|
||||
Packet21PickupSpawn var2 = new Packet21PickupSpawn(var1);
|
||||
this.field_797_bg.addToSendQueue(var2);
|
||||
var1.posX = (double)var2.xPosition / 32.0D;
|
||||
var1.posY = (double)var2.yPosition / 32.0D;
|
||||
var1.posZ = (double)var2.zPosition / 32.0D;
|
||||
var1.motionX = (double)var2.rotation / 128.0D;
|
||||
var1.motionY = (double)var2.pitch / 128.0D;
|
||||
var1.motionZ = (double)var2.roll / 128.0D;
|
||||
}
|
||||
|
||||
public void sendChatMessage(String var1) {
|
||||
this.field_797_bg.addToSendQueue(new Packet3Chat(var1));
|
||||
}
|
||||
|
||||
public void func_457_w() {
|
||||
super.func_457_w();
|
||||
this.field_797_bg.addToSendQueue(new Packet18ArmAnimation(this, 1));
|
||||
}
|
||||
|
||||
public void func_9367_r() {
|
||||
this.sendInventoryChanged();
|
||||
this.field_797_bg.addToSendQueue(new Packet9());
|
||||
}
|
||||
|
||||
protected void damageEntity(int var1) {
|
||||
this.health -= var1;
|
||||
}
|
||||
}
|
|
@ -38,16 +38,16 @@ public class EntityCreeper extends EntityMobs {
|
|||
|
||||
public void onUpdate() {
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
// if(this.worldObj.multiplayerWorld) {
|
||||
// this.timeSinceIgnited += this.creeperState;
|
||||
// if(this.timeSinceIgnited < 0) {
|
||||
// this.timeSinceIgnited = 0;
|
||||
// }
|
||||
//
|
||||
// if(this.timeSinceIgnited >= this.fuseTime) {
|
||||
// this.timeSinceIgnited = this.fuseTime;
|
||||
// }
|
||||
// }
|
||||
if(this.worldObj.multiplayerWorld) {
|
||||
this.timeSinceIgnited += this.creeperState;
|
||||
if(this.timeSinceIgnited < 0) {
|
||||
this.timeSinceIgnited = 0;
|
||||
}
|
||||
|
||||
if(this.timeSinceIgnited >= this.fuseTime) {
|
||||
this.timeSinceIgnited = this.fuseTime;
|
||||
}
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ public class EntityCreeper extends EntityMobs {
|
|||
}
|
||||
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
//if(this.worldObj.multiplayerWorld) {
|
||||
//super.func_418_b_();
|
||||
//} else {
|
||||
if(this.worldObj.multiplayerWorld) {
|
||||
super.func_418_b_();
|
||||
} else {
|
||||
if(this.timeSinceIgnited > 0 && this.creeperState < 0) {
|
||||
--this.timeSinceIgnited;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class EntityCreeper extends EntityMobs {
|
|||
if(this.creeperState != 1) {
|
||||
this.creeperState = -1;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class EntityFish extends Entity {
|
|||
this.setPosition(var21, var22, var23);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
} else {
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
ItemStack var1 = this.field_4097_b.getCurrentEquippedItem();
|
||||
if(this.field_4097_b.isDead || !this.field_4097_b.isEntityAlive() || var1 == null || var1.getItem() != Item.fishingRod || this.getDistanceSqToEntity(this.field_4097_b) > 1024.0D) {
|
||||
this.setEntityDead();
|
||||
|
@ -153,7 +153,7 @@ public class EntityFish extends Entity {
|
|||
|
||||
this.field_4096_c = null;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if(this.field_4098_a > 0) {
|
||||
--this.field_4098_a;
|
||||
|
|
|
@ -178,7 +178,7 @@ public class EntityItem extends Entity {
|
|||
}
|
||||
|
||||
public void onCollideWithPlayer(EntityPlayer var1) {
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
int var2 = this.item.stackSize;
|
||||
if(this.field_805_c == 0 && var1.inventory.addItemStackToInventory(this.item)) {
|
||||
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
|
@ -186,6 +186,6 @@ public class EntityItem extends Entity {
|
|||
this.setEntityDead();
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class EntityLiving extends Entity {
|
|||
this.canAttackEntity((Entity)null, 1);
|
||||
}
|
||||
|
||||
if(this.isImmuneToFire) {
|
||||
if(this.isImmuneToFire || this.worldObj.multiplayerWorld) {
|
||||
this.fire = 0;
|
||||
}
|
||||
|
||||
|
@ -299,9 +299,9 @@ public class EntityLiving extends Entity {
|
|||
}
|
||||
|
||||
public boolean canAttackEntity(Entity var1, int var2) {
|
||||
//if(this.worldObj.multiplayerWorld) {
|
||||
//return false;
|
||||
//} else {
|
||||
if(this.worldObj.multiplayerWorld) {
|
||||
return false;
|
||||
} else {
|
||||
this.field_9344_ag = 0;
|
||||
if(this.health <= 0) {
|
||||
return false;
|
||||
|
@ -355,7 +355,7 @@ public class EntityLiving extends Entity {
|
|||
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_9280_g() {
|
||||
|
@ -404,7 +404,7 @@ public class EntityLiving extends Entity {
|
|||
}
|
||||
|
||||
this.field_9327_S = true;
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
int var2 = this.getDropItemId();
|
||||
if(var2 > 0) {
|
||||
int var3 = this.rand.nextInt(3);
|
||||
|
@ -413,7 +413,7 @@ public class EntityLiving extends Entity {
|
|||
this.dropItem(var2, 1);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
this.worldObj.func_9425_a(this, (byte)3);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
public boolean canAttackEntity(Entity var1, int var2) {
|
||||
if(!this.isDead) {
|
||||
if(!this.worldObj.multiplayerWorld && !this.isDead) {
|
||||
this.c = -this.c;
|
||||
this.b = 10;
|
||||
this.func_9281_M();
|
||||
|
@ -136,30 +136,30 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
double var7;
|
||||
//if(this.worldObj.multiplayerWorld && this.field_9415_k > 0) {
|
||||
//if(this.field_9415_k > 0) {
|
||||
//double var41 = this.posX + (this.field_9414_l - this.posX) / (double)this.field_9415_k;
|
||||
//double var42 = this.posY + (this.field_9413_m - this.posY) / (double)this.field_9415_k;
|
||||
//double var5 = this.posZ + (this.field_9412_n - this.posZ) / (double)this.field_9415_k;
|
||||
if(this.worldObj.multiplayerWorld && this.field_9415_k > 0) {
|
||||
if(this.field_9415_k > 0) {
|
||||
double var41 = this.posX + (this.field_9414_l - this.posX) / (double)this.field_9415_k;
|
||||
double var42 = this.posY + (this.field_9413_m - this.posY) / (double)this.field_9415_k;
|
||||
double var5 = this.posZ + (this.field_9412_n - this.posZ) / (double)this.field_9415_k;
|
||||
|
||||
//for(var7 = this.field_9411_o - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) {
|
||||
//}
|
||||
for(var7 = this.field_9411_o - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) {
|
||||
}
|
||||
|
||||
//while(var7 >= 180.0D) {
|
||||
//var7 -= 360.0D;
|
||||
//}
|
||||
while(var7 >= 180.0D) {
|
||||
var7 -= 360.0D;
|
||||
}
|
||||
|
||||
//this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_9415_k);
|
||||
//this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9410_p - (double)this.rotationPitch) / (double)this.field_9415_k);
|
||||
//--this.field_9415_k;
|
||||
//this.setPosition(var41, var42, var5);
|
||||
//this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
//} else {
|
||||
//this.setPosition(this.posX, this.posY, this.posZ);
|
||||
//this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
//}
|
||||
this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_9415_k);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9410_p - (double)this.rotationPitch) / (double)this.field_9415_k);
|
||||
--this.field_9415_k;
|
||||
this.setPosition(var41, var42, var5);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
} else {
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
}
|
||||
|
||||
//} else {
|
||||
} else {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
@ -408,7 +408,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public Vec3D func_515_a(double var1, double var3, double var5, double var7) {
|
||||
|
@ -551,7 +551,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
public void applyEntityCollision(Entity var1) {
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
if(var1 != this.riddenByEntity) {
|
||||
if(var1 instanceof EntityLiving && !(var1 instanceof EntityPlayer) && this.d == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && var1.ridingEntity == null) {
|
||||
var1.mountEntity(this);
|
||||
|
@ -609,7 +609,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public int getSizeInventory() {
|
||||
|
@ -665,9 +665,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
return true;
|
||||
}
|
||||
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
var1.mountEntity(this);
|
||||
//}
|
||||
}
|
||||
} else if(this.d == 1) {
|
||||
var1.displayGUIChest(this);
|
||||
} else if(this.d == 2) {
|
||||
|
|
102
src/main/java/net/minecraft/src/EntityOtherPlayerMP.java
Normal file
102
src/main/java/net/minecraft/src/EntityOtherPlayerMP.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class EntityOtherPlayerMP extends EntityPlayer {
|
||||
private int field_785_bg;
|
||||
private double field_784_bh;
|
||||
private double field_783_bi;
|
||||
private double field_782_bj;
|
||||
private double field_780_bk;
|
||||
private double field_786_bl;
|
||||
float a = 0.0F;
|
||||
|
||||
public EntityOtherPlayerMP(World var1, String var2) {
|
||||
super(var1);
|
||||
this.field_771_i = var2;
|
||||
this.yOffset = 0.0F;
|
||||
this.field_9286_aZ = 0.0F;
|
||||
if(var2 != null && var2.length() > 0) {
|
||||
this.skinUrl = "http://www.minecraft.net/skin/" + var2 + ".png";
|
||||
System.out.println("Loading texture " + this.skinUrl);
|
||||
}
|
||||
|
||||
this.field_9314_ba = true;
|
||||
this.field_619_ac = 10.0D;
|
||||
}
|
||||
|
||||
public boolean canAttackEntity(Entity var1, int var2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) {
|
||||
this.yOffset = 0.0F;
|
||||
this.field_784_bh = var1;
|
||||
this.field_783_bi = var3;
|
||||
this.field_782_bj = var5;
|
||||
this.field_780_bk = (double)var7;
|
||||
this.field_786_bl = (double)var8;
|
||||
this.field_785_bg = var9;
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
this.field_705_Q = this.field_704_R;
|
||||
double var1 = this.posX - this.prevPosX;
|
||||
double var3 = this.posZ - this.prevPosZ;
|
||||
float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3) * 4.0F;
|
||||
if(var5 > 1.0F) {
|
||||
var5 = 1.0F;
|
||||
}
|
||||
|
||||
this.field_704_R += (var5 - this.field_704_R) * 0.4F;
|
||||
this.field_703_S += this.field_704_R;
|
||||
}
|
||||
|
||||
public float func_392_h_() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public void onLivingUpdate() {
|
||||
super.func_418_b_();
|
||||
if(this.field_785_bg > 0) {
|
||||
double var1 = this.posX + (this.field_784_bh - this.posX) / (double)this.field_785_bg;
|
||||
double var3 = this.posY + (this.field_783_bi - this.posY) / (double)this.field_785_bg;
|
||||
double var5 = this.posZ + (this.field_782_bj - this.posZ) / (double)this.field_785_bg;
|
||||
|
||||
double var7;
|
||||
for(var7 = this.field_780_bk - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) {
|
||||
}
|
||||
|
||||
while(var7 >= 180.0D) {
|
||||
var7 -= 360.0D;
|
||||
}
|
||||
|
||||
this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_785_bg);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch + (this.field_786_bl - (double)this.rotationPitch) / (double)this.field_785_bg);
|
||||
--this.field_785_bg;
|
||||
this.setPosition(var1, var3, var5);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
}
|
||||
|
||||
this.field_775_e = this.field_774_f;
|
||||
float var9 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
float var2 = (float)Math.atan(-this.motionY * (double)0.2F) * 15.0F;
|
||||
if(var9 > 0.1F) {
|
||||
var9 = 0.1F;
|
||||
}
|
||||
|
||||
if(!this.onGround || this.health <= 0) {
|
||||
var9 = 0.0F;
|
||||
}
|
||||
|
||||
if(this.onGround || this.health <= 0) {
|
||||
var2 = 0.0F;
|
||||
}
|
||||
|
||||
this.field_774_f += (var9 - this.field_774_f) * 0.4F;
|
||||
this.field_9328_R += (var2 - this.field_9328_R) * 0.8F;
|
||||
}
|
||||
|
||||
public boolean func_381_o() {
|
||||
return this.field_12240_bw;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ public class EntitySheep extends EntityAnimals {
|
|||
}
|
||||
|
||||
public boolean canAttackEntity(Entity var1, int var2) {
|
||||
if(!this.sheared && var1 instanceof EntityLiving) {
|
||||
if(!this.worldObj.multiplayerWorld && !this.sheared && var1 instanceof EntityLiving) {
|
||||
this.sheared = true;
|
||||
int var3 = 1 + this.rand.nextInt(3);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public class EntitySnowball extends Entity {
|
|||
var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord);
|
||||
}
|
||||
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
Entity var4 = null;
|
||||
List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expands(1.0D, 1.0D, 1.0D));
|
||||
double var6 = 0.0D;
|
||||
|
@ -144,7 +144,7 @@ public class EntitySnowball extends Entity {
|
|||
if(var4 != null) {
|
||||
var3 = new MovingObjectPosition(var4);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if(var3 != null) {
|
||||
if(var3.entityHit != null && var3.entityHit.canAttackEntity(this.field_811_g, 0)) {
|
||||
|
|
|
@ -22,7 +22,7 @@ public class GameSettings {
|
|||
public int renderDistance = 0;
|
||||
public boolean viewBobbing = true;
|
||||
public boolean anaglyph = false;
|
||||
public boolean limitFramerate = false;
|
||||
public boolean showFPS = false;
|
||||
public boolean fancyGraphics = true;
|
||||
public String skin = "Default";
|
||||
public KeyBinding keyBindForward = new KeyBinding("Forward", 17);
|
||||
|
@ -41,6 +41,7 @@ public class GameSettings {
|
|||
public int difficulty = 2;
|
||||
public boolean thirdPersonView = false;
|
||||
public String field_12259_z = "";
|
||||
public String username = "";
|
||||
|
||||
public GameSettings(Minecraft var1) {
|
||||
this.mc = var1;
|
||||
|
@ -94,7 +95,7 @@ public class GameSettings {
|
|||
}
|
||||
|
||||
if(var1 == 7) {
|
||||
this.limitFramerate = !this.limitFramerate;
|
||||
this.showFPS = !this.showFPS;
|
||||
}
|
||||
|
||||
if(var1 == 8) {
|
||||
|
@ -118,8 +119,10 @@ public class GameSettings {
|
|||
}
|
||||
|
||||
public String getOptionDisplayString(int var1) {
|
||||
return var1 == 0 ? "Music: " + (this.musicVolume > 0.0F ? (int)(this.musicVolume * 100.0F) + "%" : "OFF") : (var1 == 1 ? "Sound: " + (this.soundVolume > 0.0F ? (int)(this.soundVolume * 100.0F) + "%" : "OFF") : (var1 == 2 ? "Invert mouse: " + (this.invertMouse ? "ON" : "OFF") : (var1 == 3 ? (this.mouseSensitivity == 0.0F ? "Sensitivity: *yawn*" : (this.mouseSensitivity == 1.0F ? "Sensitivity: HYPERSPEED!!!" : "Sensitivity: " + (int)(this.mouseSensitivity * 200.0F) + "%")) : (var1 == 4 ? "Render distance: " + RENDER_DISTANCES[this.renderDistance] : (var1 == 5 ? "View bobbing: " + (this.viewBobbing ? "ON" : "OFF") : (var1 == 6 ? "3d anaglyph: " + (this.anaglyph ? "ON" : "OFF") : (var1 == 7 ? "Limit framerate: " + (this.limitFramerate ? "ON" : "OFF") : (var1 == 8 ? "Difficulty: " + DIFFICULTY_LEVELS[this.difficulty] : (var1 == 9 ? "Graphics: " + (this.fancyGraphics ? "FANCY" : "FAST") : "")))))))));
|
||||
return var1 == 0 ? "Music: " + (this.musicVolume > 0.0F ? (int)(this.musicVolume * 100.0F) + "%" : "OFF") : (var1 == 1 ? "Sound: " + (this.soundVolume > 0.0F ? (int)(this.soundVolume * 100.0F) + "%" : "OFF") : (var1 == 2 ? "Invert mouse: " + (this.invertMouse ? "ON" : "OFF") : (var1 == 3 ? (this.mouseSensitivity == 0.0F ? "Sensitivity: *yawn*" : (this.mouseSensitivity == 1.0F ? "Sensitivity: HYPERSPEED!!!" : "Sensitivity: " + (int)(this.mouseSensitivity * 200.0F) + "%")) : (var1 == 4 ? "Render distance: " + RENDER_DISTANCES[this.renderDistance] : (var1 == 5 ? "View bobbing: " + (this.viewBobbing ? "ON" : "OFF") : (var1 == 6 ? "3d anaglyph: " + (this.anaglyph ? "ON" : "OFF") : (var1 == 7 ? "Show FPS: " + (this.showFPS ? "ON" : "OFF") : (var1 == 8 ? "Difficulty: " + DIFFICULTY_LEVELS[this.difficulty] : (var1 == 9 ? "Graphics: " + (this.fancyGraphics ? "FANCY" : "FAST") : "")))))))));
|
||||
}
|
||||
|
||||
private boolean loadOptionsFuckedUp = false;
|
||||
|
||||
public void loadOptions() {
|
||||
if(!GL11.isWebGL) {
|
||||
|
@ -174,8 +177,8 @@ public class GameSettings {
|
|||
this.anaglyph = var3[1].equals("true");
|
||||
}
|
||||
|
||||
if(var3[0].equals("limitFramerate")) {
|
||||
this.limitFramerate = var3[1].equals("true");
|
||||
if(var3[0].equals("showFPS")) {
|
||||
this.showFPS = var3[1].equals("true");
|
||||
}
|
||||
|
||||
if(var3[0].equals("difficulty")) {
|
||||
|
@ -189,9 +192,18 @@ public class GameSettings {
|
|||
if(var3[0].equals("skin")) {
|
||||
this.skin = var3[1];
|
||||
}
|
||||
|
||||
if(!loadOptionsFuckedUp) {
|
||||
if(var3[0].equals("username")) {
|
||||
this.username = var3[1];
|
||||
}
|
||||
|
||||
if(var3[0].equals("lastServer")) {
|
||||
this.field_12259_z = var3[1];
|
||||
if(var3[0].equals("lastServer")) {
|
||||
this.field_12259_z = var3[1];
|
||||
}
|
||||
} else {
|
||||
this.username = "";
|
||||
this.field_12259_z = "";
|
||||
}
|
||||
|
||||
for(int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
||||
|
@ -199,10 +211,22 @@ public class GameSettings {
|
|||
this.keyBindings[var4].keyCode = Integer.parseInt(var3[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(loadOptionsFuckedUp) {
|
||||
this.saveOptions();
|
||||
}
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
System.out.println("Failed to load options");
|
||||
var5.printStackTrace();
|
||||
//What the fuck -_-
|
||||
if(!loadOptionsFuckedUp) {
|
||||
loadOptionsFuckedUp = true;
|
||||
this.loadOptions();
|
||||
return;
|
||||
} else {
|
||||
//womp womp
|
||||
System.out.println("Failed to load options");
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -226,10 +250,17 @@ public class GameSettings {
|
|||
var1.println("viewDistance:" + this.renderDistance);
|
||||
var1.println("bobView:" + this.viewBobbing);
|
||||
var1.println("anaglyph3d:" + this.anaglyph);
|
||||
var1.println("limitFramerate:" + this.limitFramerate);
|
||||
var1.println("showFPS:" + this.showFPS);
|
||||
var1.println("difficulty:" + this.difficulty);
|
||||
var1.println("fancyGraphics:" + this.fancyGraphics);
|
||||
var1.println("skin:" + this.skin);
|
||||
|
||||
if(!this.field_12259_z.isEmpty() && !this.field_12259_z.isBlank()) {
|
||||
var1.println("lastServer:" + this.field_12259_z);
|
||||
}
|
||||
if(!this.username.isEmpty() && !this.username.isBlank()) {
|
||||
var1.println("username:" + this.username);
|
||||
}
|
||||
|
||||
for(int var2 = 0; var2 < this.keyBindings.length; ++var2) {
|
||||
var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode);
|
||||
|
|
65
src/main/java/net/minecraft/src/GuiConnecting.java
Normal file
65
src/main/java/net/minecraft/src/GuiConnecting.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class GuiConnecting extends GuiScreen {
|
||||
private NetClientHandler clientHandler;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public GuiConnecting(Minecraft var1, String var2) {
|
||||
var1.func_6261_a((World)null);
|
||||
(new ThreadConnectToServer(this, var1, var2)).start();
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
if(this.clientHandler != null) {
|
||||
this.clientHandler.processReadPackets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void keyTyped(char var1, int var2) {
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.controlList.clear();
|
||||
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Cancel"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
if(var1.id == 0) {
|
||||
this.cancelled = true;
|
||||
if(this.clientHandler != null) {
|
||||
this.clientHandler.disconnect();
|
||||
}
|
||||
|
||||
this.mc.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawDefaultBackground();
|
||||
if(this.clientHandler == null) {
|
||||
this.drawCenteredString(this.fontRenderer, "Connecting to the server...", this.width / 2, this.height / 2 - 50, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215);
|
||||
} else {
|
||||
this.drawCenteredString(this.fontRenderer, "Logging in...", this.width / 2, this.height / 2 - 50, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, this.clientHandler.field_1209_a, this.width / 2, this.height / 2 - 10, 16777215);
|
||||
}
|
||||
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
|
||||
static NetClientHandler setNetClientHandler(GuiConnecting var0, NetClientHandler var1) {
|
||||
return var0.clientHandler = var1;
|
||||
}
|
||||
|
||||
static boolean isCancelled(GuiConnecting var0) {
|
||||
return var0.cancelled;
|
||||
}
|
||||
|
||||
static NetClientHandler getNetClientHandler(GuiConnecting var0) {
|
||||
return var0.clientHandler;
|
||||
}
|
||||
}
|
38
src/main/java/net/minecraft/src/GuiDownloadTerrain.java
Normal file
38
src/main/java/net/minecraft/src/GuiDownloadTerrain.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class GuiDownloadTerrain extends GuiScreen {
|
||||
private NetClientHandler netHandler;
|
||||
private int updateCounter = 0;
|
||||
|
||||
public GuiDownloadTerrain(NetClientHandler var1) {
|
||||
this.netHandler = var1;
|
||||
}
|
||||
|
||||
protected void keyTyped(char var1, int var2) {
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.controlList.clear();
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
++this.updateCounter;
|
||||
if(this.updateCounter % 20 == 0) {
|
||||
this.netHandler.addToSendQueue(new Packet0KeepAlive());
|
||||
}
|
||||
|
||||
if(this.netHandler != null) {
|
||||
this.netHandler.processReadPackets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawBackground(0);
|
||||
this.drawCenteredString(this.fontRenderer, "Downloading terrain", this.width / 2, this.height / 2 - 50, 16777215);
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
}
|
|
@ -143,7 +143,7 @@ public class GuiIngame extends Gui {
|
|||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
String var23;
|
||||
if(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(4)) {
|
||||
if((Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(4)) || this.mc.gameSettings.showFPS) {
|
||||
var8.drawStringWithShadow("Minecraft Alpha v1.2.6 (" + this.mc.field_6292_I + ")", 2, 2, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.func_6241_m(), 2, 12, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.func_6262_n(), 2, 22, 16777215);
|
||||
|
|
|
@ -12,6 +12,10 @@ public class GuiIngameMenu extends GuiScreen {
|
|||
this.updateCounter2 = 0;
|
||||
this.controlList.clear();
|
||||
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 48, "Save and quit to title"));
|
||||
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..."));
|
||||
}
|
||||
|
@ -23,6 +27,10 @@ public class GuiIngameMenu extends GuiScreen {
|
|||
|
||||
if(var1.id == 1) {
|
||||
Minecraft.getMinecraft().justLeftWorld = true;
|
||||
if(this.mc.isMultiplayerWorld()) {
|
||||
this.mc.theWorld.sendQuittingDisconnectingPacket();
|
||||
}
|
||||
|
||||
this.mc.func_6261_a((World)null);
|
||||
this.mc.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
|
|
@ -73,11 +73,12 @@ public class GuiMainMenu extends GuiScreen {
|
|||
}
|
||||
|
||||
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 48, "Singleplayer"));
|
||||
//GuiButton button;
|
||||
//this.controlList.add(button = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, "Multiplayer"));
|
||||
//button.enabled = false;
|
||||
this.controlList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 72, "Mods and Texture Packs"));
|
||||
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) {
|
||||
|
@ -90,7 +91,7 @@ public class GuiMainMenu extends GuiScreen {
|
|||
}
|
||||
|
||||
if(var1.id == 2) {
|
||||
//this.mc.displayGuiScreen(new GuiMultiplayer(this));
|
||||
this.mc.displayGuiScreen(new GuiMultiplayer(this));
|
||||
}
|
||||
|
||||
if(var1.id == 3) {
|
||||
|
|
180
src/main/java/net/minecraft/src/GuiMultiplayer.java
Normal file
180
src/main/java/net/minecraft/src/GuiMultiplayer.java
Normal file
|
@ -0,0 +1,180 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.input.Keyboard;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class GuiMultiplayer extends GuiScreen {
|
||||
private GuiScreen updateCounter;
|
||||
private int parentScreen = 0;
|
||||
private String serverAddress = "";
|
||||
private String username = "";
|
||||
|
||||
private boolean serverTextBox;
|
||||
private boolean usernameTextBox;
|
||||
|
||||
public GuiMultiplayer(GuiScreen var1) {
|
||||
this.updateCounter = var1;
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
++this.parentScreen;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
usernameTextBox = true;
|
||||
serverTextBox = false;
|
||||
this.controlList.clear();
|
||||
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();
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
if(var1.enabled) {
|
||||
if(var1.id == 1) {
|
||||
this.mc.displayGuiScreen(this.updateCounter);
|
||||
} else if(var1.id == 0) {
|
||||
Minecraft.getMinecraft().field_6320_i = new Session(this.username);
|
||||
this.mc.gameSettings.field_12259_z = this.serverAddress.replaceAll(":", "_");
|
||||
this.mc.gameSettings.username = this.username;
|
||||
this.mc.gameSettings.saveOptions();
|
||||
String[] var2 = this.serverAddress.split(":");
|
||||
this.mc.displayGuiScreen(new GuiConnecting(this.mc, serverAddress));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void mouseClicked(int var1, int var2, int var3) {
|
||||
if(var3 == 0) {
|
||||
if(var1 >= this.width / 2 - 100 && var1 < (this.width / 2 - 100) + 200 && var2 >= this.height / 4 - 10 + 10 + 18 && var2 < (this.height / 4 - 10 + 10 + 18) + 20) {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
usernameTextBox = true;
|
||||
serverTextBox = false;
|
||||
} else if(var1 >= this.width / 2 - 100 && var1 < (this.width / 2 - 100) + 200 && var2 >= this.height / 4 - 10 + 50 + 18 && var2 < (this.height / 4 - 10 + 50 + 18) + 20) {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
serverTextBox = true;
|
||||
usernameTextBox = false;
|
||||
} else {
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
usernameTextBox = false;
|
||||
serverTextBox = false;
|
||||
}
|
||||
}
|
||||
super.mouseClicked(var1, var2, var3);
|
||||
}
|
||||
|
||||
private int func_4067_a(String var1, int var2) {
|
||||
try {
|
||||
return Integer.parseInt(var1.trim());
|
||||
} catch (Exception var4) {
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
protected void keyTyped(char var1, int var2) {
|
||||
if(this.serverTextBox) {
|
||||
if(var1 == 22) {
|
||||
String var3 = null;
|
||||
if(var3 == null) {
|
||||
var3 = "";
|
||||
}
|
||||
|
||||
int var4 = 32 - this.serverAddress.length();
|
||||
if(var4 > var3.length()) {
|
||||
var4 = var3.length();
|
||||
}
|
||||
|
||||
if(var4 > 0) {
|
||||
this.serverAddress = this.serverAddress + var3.substring(0, var4);
|
||||
}
|
||||
}
|
||||
|
||||
if(var1 == 13) {
|
||||
this.actionPerformed((GuiButton)this.controlList.get(0));
|
||||
}
|
||||
|
||||
if(var2 == 14 && this.serverAddress.length() > 0) {
|
||||
this.serverAddress = this.serverAddress.substring(0, this.serverAddress.length() - 1);
|
||||
}
|
||||
|
||||
if(" !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\'abcdefghijklmnopqrstuvwxyz{|}~\u2302\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb".indexOf(var1) >= 0 && this.serverAddress.length() < 32) {
|
||||
this.serverAddress = this.serverAddress + var1;
|
||||
}
|
||||
|
||||
((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;
|
||||
if(var3 == null) {
|
||||
var3 = "";
|
||||
}
|
||||
|
||||
int var4 = 16 - this.username.length();
|
||||
if(var4 > var3.length()) {
|
||||
var4 = var3.length();
|
||||
}
|
||||
|
||||
if(var4 > 0) {
|
||||
this.username = this.username + var3.substring(0, var4);
|
||||
}
|
||||
}
|
||||
|
||||
if(var1 == 13) {
|
||||
this.actionPerformed((GuiButton)this.controlList.get(0));
|
||||
}
|
||||
|
||||
if(var2 == 14 && this.username.length() > 0) {
|
||||
this.username = this.username.substring(0, this.username.length() - 1);
|
||||
}
|
||||
|
||||
if(" !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\'abcdefghijklmnopqrstuvwxyz{|}~\u2302\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb".indexOf(var1) >= 0 && this.username.length() < 16) {
|
||||
if(containsOnlyAZ09("" + var1)) {
|
||||
this.username = this.username + var1;
|
||||
}
|
||||
}
|
||||
|
||||
((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();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(this.fontRenderer, "Play Multiplayer", this.width / 2, this.height / 4 - 60 + 20, 16777215);
|
||||
//this.drawString(this.fontRenderer, "Minecraft Multiplayer is currently not finished, but there", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880);
|
||||
//this.drawString(this.fontRenderer, "is some buggy early testing going on.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 9, 10526880);
|
||||
this.drawString(this.fontRenderer, "Server IP:", this.width / 2 - 100, this.height / 4 - 50 + 60 + 36, 10526880);
|
||||
this.drawString(this.fontRenderer, "Username:", this.width / 2 - 100, this.height / 4 - 90 + 60 + 36, 10526880);
|
||||
int var4 = this.width / 2 - 100;
|
||||
int var5 = this.height / 4 - 10 + 50 + 18;
|
||||
short var6 = 200;
|
||||
byte var7 = 20;
|
||||
this.drawRect(var4 - 1, var5 - 1, var4 + var6 + 1, var5 + var7 + 1, -6250336);
|
||||
this.drawRect(var4, var5, var4 + var6, var5 + var7, -16777216);
|
||||
if(this.serverTextBox) {
|
||||
this.drawString(this.fontRenderer, this.serverAddress + (this.parentScreen / 6 % 2 == 0 ? "_" : ""), var4 + 4, var5 + (var7 - 8) / 2, 14737632);
|
||||
} else {
|
||||
this.drawString(this.fontRenderer, this.serverAddress, var4 + 4, var5 + (var7 - 8) / 2, 14737632);
|
||||
}
|
||||
|
||||
int var8 = this.width / 2 - 100;
|
||||
int var9 = this.height / 4 - 10 + 10 + 18;
|
||||
short var10 = 200;
|
||||
byte var11 = 20;
|
||||
this.drawRect(var8 - 1, var9 - 1, var8 + var10 + 1, var9 + var11 + 1, -6250336);
|
||||
this.drawRect(var8, var9, var8 + var10, var9 + var11, -16777216);
|
||||
if(this.usernameTextBox) {
|
||||
this.drawString(this.fontRenderer, this.username + (this.parentScreen / 6 % 2 == 0 ? "_" : ""), var8 + 4, var9 + (var11 - 8) / 2, 14737632);
|
||||
} else {
|
||||
this.drawString(this.fontRenderer, this.username, var8 + 4, var9 + (var11 - 8) / 2, 14737632);
|
||||
}
|
||||
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
|
||||
private boolean containsOnlyAZ09(String input) {
|
||||
return input.matches("[a-z0-9]+") || input.matches("[A-Z0-9]+");
|
||||
}
|
||||
}
|
|
@ -30,9 +30,9 @@ public class ItemBoat extends Item {
|
|||
int var25 = var24.blockX;
|
||||
int var26 = var24.blockY;
|
||||
int var27 = var24.blockZ;
|
||||
//if(!var2.multiplayerWorld) {
|
||||
if(!var2.multiplayerWorld) {
|
||||
var2.entityJoinedWorld(new EntityBoat(var2, (double)((float)var25 + 0.5F), (double)((float)var26 + 1.5F), (double)((float)var27 + 0.5F)));
|
||||
//}
|
||||
}
|
||||
|
||||
--var1.stackSize;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ public class ItemBow extends Item {
|
|||
public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
|
||||
if(var3.inventory.consumeInventoryItem(Item.arrow.shiftedIndex)) {
|
||||
var2.playSoundAtEntity(var3, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
//if(!var2.multiplayerWorld) {
|
||||
if(!var2.multiplayerWorld) {
|
||||
var2.entityJoinedWorld(new EntityArrow(var2, var3));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
return var1;
|
||||
|
|
|
@ -21,9 +21,9 @@ public class ItemFishingRod extends Item {
|
|||
var3.func_457_w();
|
||||
} else {
|
||||
var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
//if(!var2.multiplayerWorld) {
|
||||
if(!var2.multiplayerWorld) {
|
||||
var2.entityJoinedWorld(new EntityFish(var2, var3));
|
||||
//}
|
||||
}
|
||||
|
||||
var3.func_457_w();
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ public class ItemHoe extends Item {
|
|||
} else {
|
||||
Block var10 = Block.tilledField;
|
||||
var3.playSoundEffect((double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), var10.stepSound.func_1145_d(), (var10.stepSound.func_1147_b() + 1.0F) / 2.0F, var10.stepSound.func_1144_c() * 0.8F);
|
||||
//if(var3.multiplayerWorld) {
|
||||
//return true;
|
||||
//} else {
|
||||
if(var3.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
var3.setBlockWithNotify(var4, var5, var6, var10.blockID);
|
||||
var1.damageItem(1);
|
||||
if(var3.rand.nextInt(8) == 0 && var8 == Block.grass.blockID) {
|
||||
|
@ -35,7 +35,7 @@ public class ItemHoe extends Item {
|
|||
}
|
||||
|
||||
return true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ public class ItemMinecart extends Item {
|
|||
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) {
|
||||
int var8 = var3.getBlockId(var4, var5, var6);
|
||||
if(var8 == Block.minecartTrack.blockID) {
|
||||
//(!var3.multiplayerWorld) {
|
||||
if(!var3.multiplayerWorld) {
|
||||
var3.entityJoinedWorld(new EntityMinecart(var3, (double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), this.field_317_a));
|
||||
//}
|
||||
}
|
||||
|
||||
--var1.stackSize;
|
||||
return true;
|
||||
|
|
|
@ -9,9 +9,9 @@ public class ItemSnowball extends Item {
|
|||
public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
|
||||
--var1.stackSize;
|
||||
var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
//if(!var2.multiplayerWorld) {
|
||||
if(!var2.multiplayerWorld) {
|
||||
var2.entityJoinedWorld(new EntitySnowball(var2, var3));
|
||||
//}
|
||||
}
|
||||
|
||||
return var1;
|
||||
}
|
||||
|
|
421
src/main/java/net/minecraft/src/NetClientHandler.java
Normal file
421
src/main/java/net/minecraft/src/NetClientHandler.java
Normal file
|
@ -0,0 +1,421 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class NetClientHandler extends NetHandler {
|
||||
private boolean disconnected = false;
|
||||
private 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 {
|
||||
this.mc = var1;
|
||||
this.netManager = new NetworkManager(var2, this);
|
||||
}
|
||||
|
||||
public void processReadPackets() {
|
||||
if(!this.disconnected) {
|
||||
this.netManager.readPacket();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleLogin(Packet1Login var1) {
|
||||
this.mc.field_6327_b = new PlayerControllerMP(this.mc, this);
|
||||
this.worldClient = new WorldClient(this, var1.field_4074_d, var1.field_4073_e);
|
||||
this.worldClient.multiplayerWorld = true;
|
||||
this.mc.func_6261_a(this.worldClient);
|
||||
this.mc.displayGuiScreen(new GuiDownloadTerrain(this));
|
||||
this.mc.thePlayer.field_620_ab = var1.protocolVersion;
|
||||
System.out.println("clientEntityId: " + var1.protocolVersion);
|
||||
}
|
||||
|
||||
public void handlePickupSpawn(Packet21PickupSpawn var1) {
|
||||
double var2 = (double)var1.xPosition / 32.0D;
|
||||
double var4 = (double)var1.yPosition / 32.0D;
|
||||
double var6 = (double)var1.zPosition / 32.0D;
|
||||
EntityItem var8 = new EntityItem(this.worldClient, var2, var4, var6, new ItemStack(var1.itemId, var1.count));
|
||||
var8.motionX = (double)var1.rotation / 128.0D;
|
||||
var8.motionY = (double)var1.pitch / 128.0D;
|
||||
var8.motionZ = (double)var1.roll / 128.0D;
|
||||
var8.field_9303_br = var1.xPosition;
|
||||
var8.field_9302_bs = var1.yPosition;
|
||||
var8.field_9301_bt = var1.zPosition;
|
||||
this.worldClient.func_712_a(var1.entityId, var8);
|
||||
}
|
||||
|
||||
public void handleVehicleSpawn(Packet23VehicleSpawn var1) {
|
||||
double var2 = (double)var1.xPosition / 32.0D;
|
||||
double var4 = (double)var1.yPosition / 32.0D;
|
||||
double var6 = (double)var1.zPosition / 32.0D;
|
||||
Object var8 = null;
|
||||
if(var1.type == 10) {
|
||||
var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 0);
|
||||
}
|
||||
|
||||
if(var1.type == 11) {
|
||||
var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 1);
|
||||
}
|
||||
|
||||
if(var1.type == 12) {
|
||||
var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 2);
|
||||
}
|
||||
|
||||
if(var1.type == 90) {
|
||||
var8 = new EntityFish(this.worldClient, var2, var4, var6);
|
||||
}
|
||||
|
||||
if(var1.type == 60) {
|
||||
var8 = new EntityArrow(this.worldClient, var2, var4, var6);
|
||||
}
|
||||
|
||||
if(var1.type == 61) {
|
||||
var8 = new EntitySnowball(this.worldClient, var2, var4, var6);
|
||||
}
|
||||
|
||||
if(var1.type == 1) {
|
||||
var8 = new EntityBoat(this.worldClient, var2, var4, var6);
|
||||
}
|
||||
|
||||
if(var1.type == 50) {
|
||||
var8 = new EntityTNTPrimed(this.worldClient, var2, var4, var6);
|
||||
}
|
||||
|
||||
if(var8 != null) {
|
||||
((Entity)var8).field_9303_br = var1.xPosition;
|
||||
((Entity)var8).field_9302_bs = var1.yPosition;
|
||||
((Entity)var8).field_9301_bt = var1.zPosition;
|
||||
((Entity)var8).rotationYaw = 0.0F;
|
||||
((Entity)var8).rotationPitch = 0.0F;
|
||||
((Entity)var8).field_620_ab = var1.entityId;
|
||||
this.worldClient.func_712_a(var1.entityId, (Entity)var8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void func_6498_a(Packet28 var1) {
|
||||
Entity var2 = this.func_12246_a(var1.field_6367_a);
|
||||
if(var2 != null) {
|
||||
var2.setVelocity((double)var1.field_6366_b / 8000.0D, (double)var1.field_6369_c / 8000.0D, (double)var1.field_6368_d / 8000.0D);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleNamedEntitySpawn(Packet20NamedEntitySpawn var1) {
|
||||
double var2 = (double)var1.xPosition / 32.0D;
|
||||
double var4 = (double)var1.yPosition / 32.0D;
|
||||
double var6 = (double)var1.zPosition / 32.0D;
|
||||
float var8 = (float)(var1.rotation * 360) / 256.0F;
|
||||
float var9 = (float)(var1.pitch * 360) / 256.0F;
|
||||
EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.mc.theWorld, var1.name);
|
||||
var10.field_9303_br = var1.xPosition;
|
||||
var10.field_9302_bs = var1.yPosition;
|
||||
var10.field_9301_bt = var1.zPosition;
|
||||
int var11 = var1.currentItem;
|
||||
if(var11 == 0) {
|
||||
var10.inventory.mainInventory[var10.inventory.currentItem] = null;
|
||||
} else {
|
||||
var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(var11);
|
||||
}
|
||||
|
||||
var10.setPositionAndRotation(var2, var4, var6, var8, var9);
|
||||
this.worldClient.func_712_a(var1.entityId, var10);
|
||||
}
|
||||
|
||||
public void handleEntityTeleport(Packet34EntityTeleport var1) {
|
||||
Entity var2 = this.func_12246_a(var1.entityId);
|
||||
if(var2 != null) {
|
||||
var2.field_9303_br = var1.xPosition;
|
||||
var2.field_9302_bs = var1.yPosition;
|
||||
var2.field_9301_bt = var1.zPosition;
|
||||
double var3 = (double)var2.field_9303_br / 32.0D;
|
||||
double var5 = (double)var2.field_9302_bs / 32.0D + 1.0D / 64.0D;
|
||||
double var7 = (double)var2.field_9301_bt / 32.0D;
|
||||
float var9 = (float)(var1.yaw * 360) / 256.0F;
|
||||
float var10 = (float)(var1.pitch * 360) / 256.0F;
|
||||
var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleEntity(Packet30Entity var1) {
|
||||
Entity var2 = this.func_12246_a(var1.entityId);
|
||||
if(var2 != null) {
|
||||
var2.field_9303_br += var1.xPosition;
|
||||
var2.field_9302_bs += var1.yPosition;
|
||||
var2.field_9301_bt += var1.zPosition;
|
||||
double var3 = (double)var2.field_9303_br / 32.0D;
|
||||
double var5 = (double)var2.field_9302_bs / 32.0D + 1.0D / 64.0D;
|
||||
double var7 = (double)var2.field_9301_bt / 32.0D;
|
||||
float var9 = var1.rotating ? (float)(var1.yaw * 360) / 256.0F : var2.rotationYaw;
|
||||
float var10 = var1.rotating ? (float)(var1.pitch * 360) / 256.0F : var2.rotationPitch;
|
||||
var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleDestroyEntity(Packet29DestroyEntity var1) {
|
||||
this.worldClient.func_710_c(var1.entityId);
|
||||
}
|
||||
|
||||
public void handleFlying(Packet10Flying var1) {
|
||||
EntityPlayerSP var2 = this.mc.thePlayer;
|
||||
double var3 = var2.posX;
|
||||
double var5 = var2.posY;
|
||||
double var7 = var2.posZ;
|
||||
float var9 = var2.rotationYaw;
|
||||
float var10 = var2.rotationPitch;
|
||||
if(var1.moving) {
|
||||
var3 = var1.xPosition;
|
||||
var5 = var1.yPosition;
|
||||
var7 = var1.zPosition;
|
||||
}
|
||||
|
||||
if(var1.rotating) {
|
||||
var9 = var1.yaw;
|
||||
var10 = var1.pitch;
|
||||
}
|
||||
|
||||
var2.field_9287_aY = 0.0F;
|
||||
var2.motionX = var2.motionY = var2.motionZ = 0.0D;
|
||||
var2.setPositionAndRotation(var3, var5, var7, var9, var10);
|
||||
var1.xPosition = var2.posX;
|
||||
var1.yPosition = var2.boundingBox.minY;
|
||||
var1.zPosition = var2.posZ;
|
||||
var1.stance = var2.posY;
|
||||
this.netManager.addToSendQueue(var1);
|
||||
if(!this.field_1210_g) {
|
||||
this.mc.thePlayer.prevPosX = this.mc.thePlayer.posX;
|
||||
this.mc.thePlayer.prevPosY = this.mc.thePlayer.posY;
|
||||
this.mc.thePlayer.prevPosZ = this.mc.thePlayer.posZ;
|
||||
this.field_1210_g = true;
|
||||
this.mc.displayGuiScreen((GuiScreen)null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handlePreChunk(Packet50PreChunk var1) {
|
||||
this.worldClient.func_713_a(var1.xPosition, var1.yPosition, var1.mode);
|
||||
}
|
||||
|
||||
public void handleMultiBlockChange(Packet52MultiBlockChange var1) {
|
||||
Chunk var2 = this.worldClient.getChunkFromChunkCoords(var1.xPosition, var1.zPosition);
|
||||
int var3 = var1.xPosition * 16;
|
||||
int var4 = var1.zPosition * 16;
|
||||
|
||||
for(int var5 = 0; var5 < var1.size; ++var5) {
|
||||
short var6 = var1.coordinateArray[var5];
|
||||
int var7 = var1.typeArray[var5] & 255;
|
||||
byte var8 = var1.metadataArray[var5];
|
||||
int var9 = var6 >> 12 & 15;
|
||||
int var10 = var6 >> 8 & 15;
|
||||
int var11 = var6 & 255;
|
||||
var2.setBlockIDWithMetadata(var9, var11, var10, var7, var8);
|
||||
this.worldClient.func_711_c(var9 + var3, var11, var10 + var4, var9 + var3, var11, var10 + var4);
|
||||
this.worldClient.func_701_b(var9 + var3, var11, var10 + var4, var9 + var3, var11, var10 + var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleMapChunk(Packet51MapChunk var1) {
|
||||
this.worldClient.func_711_c(var1.xPosition, var1.yPosition, var1.zPosition, var1.xPosition + var1.xSize - 1, var1.yPosition + var1.ySize - 1, var1.zPosition + var1.zSize - 1);
|
||||
this.worldClient.func_693_a(var1.xPosition, var1.yPosition, var1.zPosition, var1.xSize, var1.ySize, var1.zSize, var1.chunk);
|
||||
}
|
||||
|
||||
public void handleBlockChange(Packet53BlockChange var1) {
|
||||
this.worldClient.func_714_c(var1.xPosition, var1.yPosition, var1.zPosition, var1.type, var1.metadata);
|
||||
}
|
||||
|
||||
public void handleKickDisconnect(Packet255KickDisconnect var1) {
|
||||
this.netManager.networkShutdown("Got kicked");
|
||||
this.disconnected = true;
|
||||
this.mc.func_6261_a((World)null);
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Disconnected by server", var1.reason));
|
||||
}
|
||||
|
||||
public void handleErrorMessage(String var1) {
|
||||
if(!this.disconnected) {
|
||||
this.disconnected = true;
|
||||
this.mc.func_6261_a((World)null);
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Connection lost", var1));
|
||||
}
|
||||
}
|
||||
|
||||
public void addToSendQueue(Packet var1) {
|
||||
if(!this.disconnected) {
|
||||
this.netManager.addToSendQueue(var1);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleCollect(Packet22Collect var1) {
|
||||
Entity var2 = this.func_12246_a(var1.collectedEntityId);
|
||||
Object var3 = (EntityLiving)this.func_12246_a(var1.collectorEntityId);
|
||||
if(var3 == null) {
|
||||
var3 = this.mc.thePlayer;
|
||||
}
|
||||
|
||||
if(var2 != null) {
|
||||
this.worldClient.playSoundAtEntity(var2, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
this.mc.field_6321_h.func_1192_a(new EntityPickupFX(this.mc.theWorld, var2, (Entity)var3, -0.5F));
|
||||
this.worldClient.func_710_c(var1.collectedEntityId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleBlockItemSwitch(Packet16BlockItemSwitch var1) {
|
||||
Entity var2 = this.func_12246_a(var1.unused);
|
||||
if(var2 != null) {
|
||||
EntityPlayer var3 = (EntityPlayer)var2;
|
||||
int var4 = var1.id;
|
||||
if(var4 == 0) {
|
||||
var3.inventory.mainInventory[var3.inventory.currentItem] = null;
|
||||
} else {
|
||||
var3.inventory.mainInventory[var3.inventory.currentItem] = new ItemStack(var4);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void handleChat(Packet3Chat var1) {
|
||||
this.mc.ingameGUI.addChatMessage(var1.message);
|
||||
}
|
||||
|
||||
public void handleArmAnimation(Packet18ArmAnimation var1) {
|
||||
Entity var2 = this.func_12246_a(var1.entityId);
|
||||
if(var2 != null) {
|
||||
if(var1.animate == 1) {
|
||||
EntityPlayer var3 = (EntityPlayer)var2;
|
||||
var3.func_457_w();
|
||||
} else if(var1.animate == 100) {
|
||||
var2.field_9300_bu = true;
|
||||
} else if(var1.animate == 101) {
|
||||
var2.field_9300_bu = false;
|
||||
} else if(var1.animate == 102) {
|
||||
var2.field_9299_bv = true;
|
||||
} else if(var1.animate == 103) {
|
||||
var2.field_9299_bv = false;
|
||||
} else if(var1.animate == 104) {
|
||||
var2.field_12240_bw = true;
|
||||
} else if(var1.animate == 105) {
|
||||
var2.field_12240_bw = false;
|
||||
} else if(var1.animate == 2) {
|
||||
var2.func_9280_g();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void handleAddToInventory(Packet17AddToInventory var1) {
|
||||
this.mc.thePlayer.inventory.addItemStackToInventory(new ItemStack(var1.id, var1.count, var1.durability));
|
||||
}
|
||||
|
||||
public void handleHandshake(Packet2Handshake var1) {
|
||||
this.addToSendQueue(new Packet1Login(this.mc.field_6320_i.inventory, "Password", 6));
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
this.disconnected = true;
|
||||
this.netManager.networkShutdown("Closed");
|
||||
}
|
||||
|
||||
public void handleMobSpawn(Packet24MobSpawn var1) {
|
||||
double var2 = (double)var1.xPosition / 32.0D;
|
||||
double var4 = (double)var1.yPosition / 32.0D;
|
||||
double var6 = (double)var1.zPosition / 32.0D;
|
||||
float var8 = (float)(var1.yaw * 360) / 256.0F;
|
||||
float var9 = (float)(var1.pitch * 360) / 256.0F;
|
||||
EntityLiving var10 = (EntityLiving)EntityList.createEntity(var1.type, this.mc.theWorld);
|
||||
var10.field_9303_br = var1.xPosition;
|
||||
var10.field_9302_bs = var1.yPosition;
|
||||
var10.field_9301_bt = var1.zPosition;
|
||||
var10.field_620_ab = var1.entityId;
|
||||
var10.setPositionAndRotation(var2, var4, var6, var8, var9);
|
||||
var10.field_9343_G = true;
|
||||
this.worldClient.func_712_a(var1.entityId, var10);
|
||||
}
|
||||
|
||||
public void handleUpdateTime(Packet4UpdateTime var1) {
|
||||
this.mc.theWorld.setWorldTime(var1.time);
|
||||
}
|
||||
|
||||
public void handlePlayerInventory(Packet5PlayerInventory var1) {
|
||||
EntityPlayerSP var2 = this.mc.thePlayer;
|
||||
if(var1.type == -1) {
|
||||
var2.inventory.mainInventory = var1.stacks;
|
||||
}
|
||||
|
||||
if(var1.type == -2) {
|
||||
var2.inventory.craftingInventory = var1.stacks;
|
||||
}
|
||||
|
||||
if(var1.type == -3) {
|
||||
var2.inventory.armorInventory = var1.stacks;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleComplexEntity(Packet59ComplexEntity var1) {
|
||||
if(var1.entityNBT.getInteger("x") == var1.xPosition) {
|
||||
if(var1.entityNBT.getInteger("y") == var1.yPosition) {
|
||||
if(var1.entityNBT.getInteger("z") == var1.zPosition) {
|
||||
TileEntity var2 = this.worldClient.getBlockTileEntity(var1.xPosition, var1.yPosition, var1.zPosition);
|
||||
if(var2 != null) {
|
||||
try {
|
||||
var2.readFromNBT(var1.entityNBT);
|
||||
} catch (Exception var4) {
|
||||
}
|
||||
|
||||
this.worldClient.func_701_b(var1.xPosition, var1.yPosition, var1.zPosition, var1.xPosition, var1.yPosition, var1.zPosition);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleSpawnPosition(Packet6SpawnPosition var1) {
|
||||
this.worldClient.spawnX = var1.xPosition;
|
||||
this.worldClient.spawnY = var1.yPosition;
|
||||
this.worldClient.spawnZ = var1.zPosition;
|
||||
}
|
||||
|
||||
public void func_6497_a(Packet39 var1) {
|
||||
Object var2 = this.func_12246_a(var1.field_6365_a);
|
||||
Entity var3 = this.func_12246_a(var1.field_6364_b);
|
||||
if(var1.field_6365_a == this.mc.thePlayer.field_620_ab) {
|
||||
var2 = this.mc.thePlayer;
|
||||
}
|
||||
|
||||
if(var2 != null) {
|
||||
((Entity)var2).mountEntity(var3);
|
||||
}
|
||||
}
|
||||
|
||||
public void func_9447_a(Packet38 var1) {
|
||||
Entity var2 = this.func_12246_a(var1.field_9274_a);
|
||||
if(var2 != null) {
|
||||
var2.func_9282_a(var1.field_9273_b);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Entity func_12246_a(int var1) {
|
||||
return (Entity)(var1 == this.mc.thePlayer.field_620_ab ? this.mc.thePlayer : this.worldClient.func_709_b(var1));
|
||||
}
|
||||
|
||||
public void handleHealth(Packet8 var1) {
|
||||
this.mc.thePlayer.setHealth(var1.healthMP);
|
||||
}
|
||||
|
||||
public void func_9448_a(Packet9 var1) {
|
||||
this.mc.respawn();
|
||||
}
|
||||
|
||||
public void func_12245_a(Packet60 var1) {
|
||||
Explosion var2 = new Explosion(this.mc.theWorld, (Entity)null, var1.field_12236_a, var1.field_12235_b, var1.field_12239_c, var1.field_12238_d);
|
||||
var2.field_12251_g = var1.field_12237_e;
|
||||
var2.func_12247_b();
|
||||
}
|
||||
}
|
140
src/main/java/net/minecraft/src/NetHandler.java
Normal file
140
src/main/java/net/minecraft/src/NetHandler.java
Normal file
|
@ -0,0 +1,140 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class NetHandler {
|
||||
public void handleMapChunk(Packet51MapChunk var1) {
|
||||
}
|
||||
|
||||
public void func_4114_b(Packet var1) {
|
||||
}
|
||||
|
||||
public void handleErrorMessage(String var1) {
|
||||
}
|
||||
|
||||
public void handleKickDisconnect(Packet255KickDisconnect var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleLogin(Packet1Login var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleFlying(Packet10Flying var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleMultiBlockChange(Packet52MultiBlockChange var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleBlockDig(Packet14BlockDig var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleBlockChange(Packet53BlockChange var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handlePreChunk(Packet50PreChunk var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleNamedEntitySpawn(Packet20NamedEntitySpawn var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleEntity(Packet30Entity var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleEntityTeleport(Packet34EntityTeleport var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handlePlace(Packet15Place var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleBlockItemSwitch(Packet16BlockItemSwitch var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleDestroyEntity(Packet29DestroyEntity var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handlePickupSpawn(Packet21PickupSpawn var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleCollect(Packet22Collect var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleChat(Packet3Chat var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleAddToInventory(Packet17AddToInventory var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleVehicleSpawn(Packet23VehicleSpawn var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleArmAnimation(Packet18ArmAnimation var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleHandshake(Packet2Handshake var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleMobSpawn(Packet24MobSpawn var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleUpdateTime(Packet4UpdateTime var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handlePlayerInventory(Packet5PlayerInventory var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleComplexEntity(Packet59ComplexEntity var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleSpawnPosition(Packet6SpawnPosition var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void func_6498_a(Packet28 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void func_6497_a(Packet39 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void func_6499_a(Packet7 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void func_9447_a(Packet38 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void handleHealth(Packet8 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void func_9448_a(Packet9 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
|
||||
public void func_12245_a(Packet60 var1) {
|
||||
this.func_4114_b(var1);
|
||||
}
|
||||
}
|
232
src/main/java/net/minecraft/src/NetworkManager.java
Normal file
232
src/main/java/net/minecraft/src/NetworkManager.java
Normal file
|
@ -0,0 +1,232 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
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;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class NetworkManager {
|
||||
private Object sendQueueLock = new Object();
|
||||
private boolean isRunning = true;
|
||||
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)) {
|
||||
throw new IOException("Websocket to " + uri + " failed!");
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ByteArrayOutputStream sendBuffer;
|
||||
|
||||
private void sendPacket() {
|
||||
try {
|
||||
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);
|
||||
Packet.writePacket(var2, yee);
|
||||
GL11.writePacket(sendBuffer.toByteArray());
|
||||
}
|
||||
|
||||
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);
|
||||
GL11.writePacket(sendBuffer.toByteArray());
|
||||
this.chunkDataSendCounter = 50;
|
||||
}
|
||||
|
||||
if(var1) {
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
} catch (InterruptedException var8) {
|
||||
} catch (Exception var9) {
|
||||
if(!this.isTerminating) {
|
||||
this.onNetworkError(var9);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ByteBuffer oldChunkBuffer = null;
|
||||
private LinkedList<ByteBuffer> readChunks = new LinkedList();
|
||||
|
||||
public void readPacket() {
|
||||
if(this.sendQueueByteLength > 1048576) {
|
||||
this.networkShutdown("Send buffer overflow");
|
||||
}
|
||||
|
||||
readChunks.clear();
|
||||
|
||||
if(oldChunkBuffer != null) {
|
||||
readChunks.add(oldChunkBuffer);
|
||||
}
|
||||
|
||||
byte[] packet;
|
||||
while((packet = GL11.readPacket()) != null) {
|
||||
readChunks.add(ByteBuffer.wrap(packet));
|
||||
}
|
||||
if(!readChunks.isEmpty()) {
|
||||
this.timeSinceLastRead = 0;
|
||||
int cap = 0;
|
||||
for(ByteBuffer b : readChunks) {
|
||||
cap += b.limit();
|
||||
}
|
||||
|
||||
ByteBuffer stream = ByteBuffer.allocate(cap);
|
||||
for(ByteBuffer b : readChunks) {
|
||||
stream.put(b);
|
||||
}
|
||||
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) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(stream.hasRemaining()) {
|
||||
oldChunkBuffer = stream.slice();
|
||||
}else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
var0.sendPacket();
|
||||
}
|
||||
|
||||
private static class ByteBufferDirectInputStream extends InputStream {
|
||||
private ByteBuffer buf;
|
||||
private ByteBufferDirectInputStream(ByteBuffer b) {
|
||||
this.buf = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return buf.remaining() > 0 ? ((int)buf.get() & 0xFF) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() {
|
||||
return buf.remaining();
|
||||
}
|
||||
}
|
||||
}
|
110
src/main/java/net/minecraft/src/Packet.java
Normal file
110
src/main/java/net/minecraft/src/Packet.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class Packet {
|
||||
private static Map packetIdToClassMap = new HashMap();
|
||||
private static Map packetClassToIdMap = new HashMap();
|
||||
public boolean isChunkDataPacket = false;
|
||||
|
||||
static void addIdClassMapping(int var0, Class var1) {
|
||||
if(packetIdToClassMap.containsKey(Integer.valueOf(var0))) {
|
||||
throw new IllegalArgumentException("Duplicate packet id:" + var0);
|
||||
} else if(packetClassToIdMap.containsKey(var1)) {
|
||||
throw new IllegalArgumentException("Duplicate packet class:" + var1);
|
||||
} else {
|
||||
packetIdToClassMap.put(Integer.valueOf(var0), var1);
|
||||
packetClassToIdMap.put(var1, Integer.valueOf(var0));
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet getNewPacket(int var0) {
|
||||
try {
|
||||
Class var1 = (Class)packetIdToClassMap.get(Integer.valueOf(var0));
|
||||
return var1 == null ? null : (Packet)var1.newInstance();
|
||||
} catch (Exception var2) {
|
||||
var2.printStackTrace();
|
||||
System.out.println("Skipping packet with id " + var0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final int getPacketId() {
|
||||
return ((Integer)packetClassToIdMap.get(this.getClass())).intValue();
|
||||
}
|
||||
|
||||
public static Packet readPacket(DataInputStream var0) throws IOException {
|
||||
int var1 = var0.read();
|
||||
if(var1 == -1) {
|
||||
return null;
|
||||
} else {
|
||||
Packet var2 = getNewPacket(var1);
|
||||
if(var2 == null) {
|
||||
throw new IOException("Bad packet id " + var1);
|
||||
} else {
|
||||
var2.readPacketData(var0);
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void writePacket(Packet var0, DataOutputStream var1) throws IOException {
|
||||
var1.write(var0.getPacketId());
|
||||
var0.writePacketData(var1);
|
||||
}
|
||||
|
||||
public abstract void readPacketData(DataInputStream var1) throws IOException;
|
||||
|
||||
public abstract void writePacketData(DataOutputStream var1) throws IOException;
|
||||
|
||||
public abstract void processPacket(NetHandler var1);
|
||||
|
||||
public abstract int getPacketSize();
|
||||
|
||||
static {
|
||||
addIdClassMapping(0, Packet0KeepAlive.class);
|
||||
addIdClassMapping(1, Packet1Login.class);
|
||||
addIdClassMapping(2, Packet2Handshake.class);
|
||||
addIdClassMapping(3, Packet3Chat.class);
|
||||
addIdClassMapping(4, Packet4UpdateTime.class);
|
||||
addIdClassMapping(5, Packet5PlayerInventory.class);
|
||||
addIdClassMapping(6, Packet6SpawnPosition.class);
|
||||
addIdClassMapping(7, Packet7.class);
|
||||
addIdClassMapping(8, Packet8.class);
|
||||
addIdClassMapping(9, Packet9.class);
|
||||
addIdClassMapping(10, Packet10Flying.class);
|
||||
addIdClassMapping(11, Packet11PlayerPosition.class);
|
||||
addIdClassMapping(12, Packet12PlayerLook.class);
|
||||
addIdClassMapping(13, Packet13PlayerLookMove.class);
|
||||
addIdClassMapping(14, Packet14BlockDig.class);
|
||||
addIdClassMapping(15, Packet15Place.class);
|
||||
addIdClassMapping(16, Packet16BlockItemSwitch.class);
|
||||
addIdClassMapping(17, Packet17AddToInventory.class);
|
||||
addIdClassMapping(18, Packet18ArmAnimation.class);
|
||||
addIdClassMapping(20, Packet20NamedEntitySpawn.class);
|
||||
addIdClassMapping(21, Packet21PickupSpawn.class);
|
||||
addIdClassMapping(22, Packet22Collect.class);
|
||||
addIdClassMapping(23, Packet23VehicleSpawn.class);
|
||||
addIdClassMapping(24, Packet24MobSpawn.class);
|
||||
addIdClassMapping(28, Packet28.class);
|
||||
addIdClassMapping(29, Packet29DestroyEntity.class);
|
||||
addIdClassMapping(30, Packet30Entity.class);
|
||||
addIdClassMapping(31, Packet31RelEntityMove.class);
|
||||
addIdClassMapping(32, Packet32EntityLook.class);
|
||||
addIdClassMapping(33, Packet33RelEntityMoveLook.class);
|
||||
addIdClassMapping(34, Packet34EntityTeleport.class);
|
||||
addIdClassMapping(38, Packet38.class);
|
||||
addIdClassMapping(39, Packet39.class);
|
||||
addIdClassMapping(50, Packet50PreChunk.class);
|
||||
addIdClassMapping(51, Packet51MapChunk.class);
|
||||
addIdClassMapping(52, Packet52MultiBlockChange.class);
|
||||
addIdClassMapping(53, Packet53BlockChange.class);
|
||||
addIdClassMapping(59, Packet59ComplexEntity.class);
|
||||
addIdClassMapping(60, Packet60.class);
|
||||
addIdClassMapping(255, Packet255KickDisconnect.class);
|
||||
}
|
||||
}
|
20
src/main/java/net/minecraft/src/Packet0KeepAlive.java
Normal file
20
src/main/java/net/minecraft/src/Packet0KeepAlive.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet0KeepAlive extends Packet {
|
||||
public void processPacket(NetHandler var1) {
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
40
src/main/java/net/minecraft/src/Packet10Flying.java
Normal file
40
src/main/java/net/minecraft/src/Packet10Flying.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet10Flying extends Packet {
|
||||
public double xPosition;
|
||||
public double yPosition;
|
||||
public double zPosition;
|
||||
public double stance;
|
||||
public float yaw;
|
||||
public float pitch;
|
||||
public boolean onGround;
|
||||
public boolean moving;
|
||||
public boolean rotating;
|
||||
|
||||
public Packet10Flying() {
|
||||
}
|
||||
|
||||
public Packet10Flying(boolean var1) {
|
||||
this.onGround = var1;
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleFlying(this);
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.onGround = var1.read() != 0;
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.write(this.onGround ? 1 : 0);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 1;
|
||||
}
|
||||
}
|
40
src/main/java/net/minecraft/src/Packet11PlayerPosition.java
Normal file
40
src/main/java/net/minecraft/src/Packet11PlayerPosition.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet11PlayerPosition extends Packet10Flying {
|
||||
public Packet11PlayerPosition() {
|
||||
this.moving = true;
|
||||
}
|
||||
|
||||
public Packet11PlayerPosition(double var1, double var3, double var5, double var7, boolean var9) {
|
||||
this.xPosition = var1;
|
||||
this.yPosition = var3;
|
||||
this.stance = var5;
|
||||
this.zPosition = var7;
|
||||
this.onGround = var9;
|
||||
this.moving = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readDouble();
|
||||
this.yPosition = var1.readDouble();
|
||||
this.stance = var1.readDouble();
|
||||
this.zPosition = var1.readDouble();
|
||||
super.readPacketData(var1);
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeDouble(this.xPosition);
|
||||
var1.writeDouble(this.yPosition);
|
||||
var1.writeDouble(this.stance);
|
||||
var1.writeDouble(this.zPosition);
|
||||
super.writePacketData(var1);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 33;
|
||||
}
|
||||
}
|
34
src/main/java/net/minecraft/src/Packet12PlayerLook.java
Normal file
34
src/main/java/net/minecraft/src/Packet12PlayerLook.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet12PlayerLook extends Packet10Flying {
|
||||
public Packet12PlayerLook() {
|
||||
this.rotating = true;
|
||||
}
|
||||
|
||||
public Packet12PlayerLook(float var1, float var2, boolean var3) {
|
||||
this.yaw = var1;
|
||||
this.pitch = var2;
|
||||
this.onGround = var3;
|
||||
this.rotating = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.yaw = var1.readFloat();
|
||||
this.pitch = var1.readFloat();
|
||||
super.readPacketData(var1);
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeFloat(this.yaw);
|
||||
var1.writeFloat(this.pitch);
|
||||
super.writePacketData(var1);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 9;
|
||||
}
|
||||
}
|
48
src/main/java/net/minecraft/src/Packet13PlayerLookMove.java
Normal file
48
src/main/java/net/minecraft/src/Packet13PlayerLookMove.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet13PlayerLookMove extends Packet10Flying {
|
||||
public Packet13PlayerLookMove() {
|
||||
this.rotating = true;
|
||||
this.moving = true;
|
||||
}
|
||||
|
||||
public Packet13PlayerLookMove(double var1, double var3, double var5, double var7, float var9, float var10, boolean var11) {
|
||||
this.xPosition = var1;
|
||||
this.yPosition = var3;
|
||||
this.stance = var5;
|
||||
this.zPosition = var7;
|
||||
this.yaw = var9;
|
||||
this.pitch = var10;
|
||||
this.onGround = var11;
|
||||
this.rotating = true;
|
||||
this.moving = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readDouble();
|
||||
this.yPosition = var1.readDouble();
|
||||
this.stance = var1.readDouble();
|
||||
this.zPosition = var1.readDouble();
|
||||
this.yaw = var1.readFloat();
|
||||
this.pitch = var1.readFloat();
|
||||
super.readPacketData(var1);
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeDouble(this.xPosition);
|
||||
var1.writeDouble(this.yPosition);
|
||||
var1.writeDouble(this.stance);
|
||||
var1.writeDouble(this.zPosition);
|
||||
var1.writeFloat(this.yaw);
|
||||
var1.writeFloat(this.pitch);
|
||||
super.writePacketData(var1);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 41;
|
||||
}
|
||||
}
|
48
src/main/java/net/minecraft/src/Packet14BlockDig.java
Normal file
48
src/main/java/net/minecraft/src/Packet14BlockDig.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet14BlockDig extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public int face;
|
||||
public int status;
|
||||
|
||||
public Packet14BlockDig() {
|
||||
}
|
||||
|
||||
public Packet14BlockDig(int var1, int var2, int var3, int var4, int var5) {
|
||||
this.status = var1;
|
||||
this.xPosition = var2;
|
||||
this.yPosition = var3;
|
||||
this.zPosition = var4;
|
||||
this.face = var5;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.status = var1.read();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.read();
|
||||
this.zPosition = var1.readInt();
|
||||
this.face = var1.read();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.write(this.status);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.write(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.write(this.face);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleBlockDig(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 11;
|
||||
}
|
||||
}
|
48
src/main/java/net/minecraft/src/Packet15Place.java
Normal file
48
src/main/java/net/minecraft/src/Packet15Place.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet15Place extends Packet {
|
||||
public int id;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public int direction;
|
||||
|
||||
public Packet15Place() {
|
||||
}
|
||||
|
||||
public Packet15Place(int var1, int var2, int var3, int var4, int var5) {
|
||||
this.id = var1;
|
||||
this.xPosition = var2;
|
||||
this.yPosition = var3;
|
||||
this.zPosition = var4;
|
||||
this.direction = var5;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.id = var1.readShort();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.read();
|
||||
this.zPosition = var1.readInt();
|
||||
this.direction = var1.read();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeShort(this.id);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.write(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.write(this.direction);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handlePlace(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 12;
|
||||
}
|
||||
}
|
36
src/main/java/net/minecraft/src/Packet16BlockItemSwitch.java
Normal file
36
src/main/java/net/minecraft/src/Packet16BlockItemSwitch.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet16BlockItemSwitch extends Packet {
|
||||
public int unused;
|
||||
public int id;
|
||||
|
||||
public Packet16BlockItemSwitch() {
|
||||
}
|
||||
|
||||
public Packet16BlockItemSwitch(int var1, int var2) {
|
||||
this.unused = var1;
|
||||
this.id = var2;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.unused = var1.readInt();
|
||||
this.id = var1.readShort();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.unused);
|
||||
var1.writeShort(this.id);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleBlockItemSwitch(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 6;
|
||||
}
|
||||
}
|
31
src/main/java/net/minecraft/src/Packet17AddToInventory.java
Normal file
31
src/main/java/net/minecraft/src/Packet17AddToInventory.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet17AddToInventory extends Packet {
|
||||
public int id;
|
||||
public int count;
|
||||
public int durability;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.id = var1.readShort();
|
||||
this.count = var1.readByte();
|
||||
this.durability = var1.readShort();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeShort(this.id);
|
||||
var1.writeByte(this.count);
|
||||
var1.writeShort(this.durability);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleAddToInventory(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 5;
|
||||
}
|
||||
}
|
36
src/main/java/net/minecraft/src/Packet18ArmAnimation.java
Normal file
36
src/main/java/net/minecraft/src/Packet18ArmAnimation.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet18ArmAnimation extends Packet {
|
||||
public int entityId;
|
||||
public int animate;
|
||||
|
||||
public Packet18ArmAnimation() {
|
||||
}
|
||||
|
||||
public Packet18ArmAnimation(Entity var1, int var2) {
|
||||
this.entityId = var1.field_620_ab;
|
||||
this.animate = var2;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
this.animate = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
var1.writeByte(this.animate);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleArmAnimation(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 5;
|
||||
}
|
||||
}
|
46
src/main/java/net/minecraft/src/Packet1Login.java
Normal file
46
src/main/java/net/minecraft/src/Packet1Login.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet1Login extends Packet {
|
||||
public int protocolVersion;
|
||||
public String username;
|
||||
public String password;
|
||||
public long field_4074_d;
|
||||
public byte field_4073_e;
|
||||
|
||||
public Packet1Login() {
|
||||
}
|
||||
|
||||
public Packet1Login(String var1, String var2, int var3) {
|
||||
this.username = var1;
|
||||
this.password = var2;
|
||||
this.protocolVersion = var3;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.protocolVersion = var1.readInt();
|
||||
this.username = var1.readUTF();
|
||||
this.password = var1.readUTF();
|
||||
this.field_4074_d = var1.readLong();
|
||||
this.field_4073_e = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.protocolVersion);
|
||||
var1.writeUTF(this.username);
|
||||
var1.writeUTF(this.password);
|
||||
var1.writeLong(this.field_4074_d);
|
||||
var1.writeByte(this.field_4073_e);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleLogin(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 4 + this.username.length() + this.password.length() + 4 + 5;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet20NamedEntitySpawn extends Packet {
|
||||
public int entityId;
|
||||
public String name;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public byte rotation;
|
||||
public byte pitch;
|
||||
public int currentItem;
|
||||
|
||||
public Packet20NamedEntitySpawn() {
|
||||
}
|
||||
|
||||
public Packet20NamedEntitySpawn(EntityPlayer var1) {
|
||||
this.entityId = var1.field_620_ab;
|
||||
this.name = var1.field_771_i;
|
||||
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
|
||||
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
|
||||
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
|
||||
this.rotation = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F));
|
||||
this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F));
|
||||
ItemStack var2 = var1.inventory.getCurrentItem();
|
||||
this.currentItem = var2 == null ? 0 : var2.itemID;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
this.name = var1.readUTF();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
this.rotation = var1.readByte();
|
||||
this.pitch = var1.readByte();
|
||||
this.currentItem = var1.readShort();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
var1.writeUTF(this.name);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.writeByte(this.rotation);
|
||||
var1.writeByte(this.pitch);
|
||||
var1.writeShort(this.currentItem);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleNamedEntitySpawn(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 28;
|
||||
}
|
||||
}
|
64
src/main/java/net/minecraft/src/Packet21PickupSpawn.java
Normal file
64
src/main/java/net/minecraft/src/Packet21PickupSpawn.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet21PickupSpawn extends Packet {
|
||||
public int entityId;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public byte rotation;
|
||||
public byte pitch;
|
||||
public byte roll;
|
||||
public int itemId;
|
||||
public int count;
|
||||
|
||||
public Packet21PickupSpawn() {
|
||||
}
|
||||
|
||||
public Packet21PickupSpawn(EntityItem var1) {
|
||||
this.entityId = var1.field_620_ab;
|
||||
this.itemId = var1.item.itemID;
|
||||
this.count = var1.item.stackSize;
|
||||
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
|
||||
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
|
||||
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
|
||||
this.rotation = (byte)((int)(var1.motionX * 128.0D));
|
||||
this.pitch = (byte)((int)(var1.motionY * 128.0D));
|
||||
this.roll = (byte)((int)(var1.motionZ * 128.0D));
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
this.itemId = var1.readShort();
|
||||
this.count = var1.readByte();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
this.rotation = var1.readByte();
|
||||
this.pitch = var1.readByte();
|
||||
this.roll = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
var1.writeShort(this.itemId);
|
||||
var1.writeByte(this.count);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.writeByte(this.rotation);
|
||||
var1.writeByte(this.pitch);
|
||||
var1.writeByte(this.roll);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handlePickupSpawn(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 22;
|
||||
}
|
||||
}
|
28
src/main/java/net/minecraft/src/Packet22Collect.java
Normal file
28
src/main/java/net/minecraft/src/Packet22Collect.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet22Collect extends Packet {
|
||||
public int collectedEntityId;
|
||||
public int collectorEntityId;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.collectedEntityId = var1.readInt();
|
||||
this.collectorEntityId = var1.readInt();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.collectedEntityId);
|
||||
var1.writeInt(this.collectorEntityId);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleCollect(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 8;
|
||||
}
|
||||
}
|
37
src/main/java/net/minecraft/src/Packet23VehicleSpawn.java
Normal file
37
src/main/java/net/minecraft/src/Packet23VehicleSpawn.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet23VehicleSpawn extends Packet {
|
||||
public int entityId;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public int type;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
this.type = var1.readByte();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
var1.writeByte(this.type);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleVehicleSpawn(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 17;
|
||||
}
|
||||
}
|
56
src/main/java/net/minecraft/src/Packet24MobSpawn.java
Normal file
56
src/main/java/net/minecraft/src/Packet24MobSpawn.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet24MobSpawn extends Packet {
|
||||
public int entityId;
|
||||
public byte type;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public byte yaw;
|
||||
public byte pitch;
|
||||
|
||||
public Packet24MobSpawn() {
|
||||
}
|
||||
|
||||
public Packet24MobSpawn(EntityLiving var1) {
|
||||
this.entityId = var1.field_620_ab;
|
||||
this.type = (byte)EntityList.getEntityID(var1);
|
||||
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
|
||||
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
|
||||
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
|
||||
this.yaw = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F));
|
||||
this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
this.type = var1.readByte();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
this.yaw = var1.readByte();
|
||||
this.pitch = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
var1.writeByte(this.type);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.writeByte(this.yaw);
|
||||
var1.writeByte(this.pitch);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleMobSpawn(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 19;
|
||||
}
|
||||
}
|
32
src/main/java/net/minecraft/src/Packet255KickDisconnect.java
Normal file
32
src/main/java/net/minecraft/src/Packet255KickDisconnect.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet255KickDisconnect extends Packet {
|
||||
public String reason;
|
||||
|
||||
public Packet255KickDisconnect() {
|
||||
}
|
||||
|
||||
public Packet255KickDisconnect(String var1) {
|
||||
this.reason = var1;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.reason = var1.readUTF();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeUTF(this.reason);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleKickDisconnect(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return this.reason.length();
|
||||
}
|
||||
}
|
73
src/main/java/net/minecraft/src/Packet28.java
Normal file
73
src/main/java/net/minecraft/src/Packet28.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet28 extends Packet {
|
||||
public int field_6367_a;
|
||||
public int field_6366_b;
|
||||
public int field_6369_c;
|
||||
public int field_6368_d;
|
||||
|
||||
public Packet28() {
|
||||
}
|
||||
|
||||
public Packet28(Entity var1) {
|
||||
this(var1.field_620_ab, var1.motionX, var1.motionY, var1.motionZ);
|
||||
}
|
||||
|
||||
public Packet28(int var1, double var2, double var4, double var6) {
|
||||
this.field_6367_a = var1;
|
||||
double var8 = 3.9D;
|
||||
if(var2 < -var8) {
|
||||
var2 = -var8;
|
||||
}
|
||||
|
||||
if(var4 < -var8) {
|
||||
var4 = -var8;
|
||||
}
|
||||
|
||||
if(var6 < -var8) {
|
||||
var6 = -var8;
|
||||
}
|
||||
|
||||
if(var2 > var8) {
|
||||
var2 = var8;
|
||||
}
|
||||
|
||||
if(var4 > var8) {
|
||||
var4 = var8;
|
||||
}
|
||||
|
||||
if(var6 > var8) {
|
||||
var6 = var8;
|
||||
}
|
||||
|
||||
this.field_6366_b = (int)(var2 * 8000.0D);
|
||||
this.field_6369_c = (int)(var4 * 8000.0D);
|
||||
this.field_6368_d = (int)(var6 * 8000.0D);
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.field_6367_a = var1.readInt();
|
||||
this.field_6366_b = var1.readShort();
|
||||
this.field_6369_c = var1.readShort();
|
||||
this.field_6368_d = var1.readShort();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.field_6367_a);
|
||||
var1.writeShort(this.field_6366_b);
|
||||
var1.writeShort(this.field_6369_c);
|
||||
var1.writeShort(this.field_6368_d);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.func_6498_a(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 10;
|
||||
}
|
||||
}
|
25
src/main/java/net/minecraft/src/Packet29DestroyEntity.java
Normal file
25
src/main/java/net/minecraft/src/Packet29DestroyEntity.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet29DestroyEntity extends Packet {
|
||||
public int entityId;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleDestroyEntity(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 4;
|
||||
}
|
||||
}
|
32
src/main/java/net/minecraft/src/Packet2Handshake.java
Normal file
32
src/main/java/net/minecraft/src/Packet2Handshake.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet2Handshake extends Packet {
|
||||
public String username;
|
||||
|
||||
public Packet2Handshake() {
|
||||
}
|
||||
|
||||
public Packet2Handshake(String var1) {
|
||||
this.username = var1;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.username = var1.readUTF();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeUTF(this.username);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleHandshake(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 4 + this.username.length() + 4;
|
||||
}
|
||||
}
|
31
src/main/java/net/minecraft/src/Packet30Entity.java
Normal file
31
src/main/java/net/minecraft/src/Packet30Entity.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet30Entity extends Packet {
|
||||
public int entityId;
|
||||
public byte xPosition;
|
||||
public byte yPosition;
|
||||
public byte zPosition;
|
||||
public byte yaw;
|
||||
public byte pitch;
|
||||
public boolean rotating = false;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleEntity(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 4;
|
||||
}
|
||||
}
|
25
src/main/java/net/minecraft/src/Packet31RelEntityMove.java
Normal file
25
src/main/java/net/minecraft/src/Packet31RelEntityMove.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet31RelEntityMove extends Packet30Entity {
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
super.readPacketData(var1);
|
||||
this.xPosition = var1.readByte();
|
||||
this.yPosition = var1.readByte();
|
||||
this.zPosition = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
super.writePacketData(var1);
|
||||
var1.writeByte(this.xPosition);
|
||||
var1.writeByte(this.yPosition);
|
||||
var1.writeByte(this.zPosition);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 7;
|
||||
}
|
||||
}
|
27
src/main/java/net/minecraft/src/Packet32EntityLook.java
Normal file
27
src/main/java/net/minecraft/src/Packet32EntityLook.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet32EntityLook extends Packet30Entity {
|
||||
public Packet32EntityLook() {
|
||||
this.rotating = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
super.readPacketData(var1);
|
||||
this.yaw = var1.readByte();
|
||||
this.pitch = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
super.writePacketData(var1);
|
||||
var1.writeByte(this.yaw);
|
||||
var1.writeByte(this.pitch);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 6;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet33RelEntityMoveLook extends Packet30Entity {
|
||||
public Packet33RelEntityMoveLook() {
|
||||
this.rotating = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
super.readPacketData(var1);
|
||||
this.xPosition = var1.readByte();
|
||||
this.yPosition = var1.readByte();
|
||||
this.zPosition = var1.readByte();
|
||||
this.yaw = var1.readByte();
|
||||
this.pitch = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
super.writePacketData(var1);
|
||||
var1.writeByte(this.xPosition);
|
||||
var1.writeByte(this.yPosition);
|
||||
var1.writeByte(this.zPosition);
|
||||
var1.writeByte(this.yaw);
|
||||
var1.writeByte(this.pitch);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 9;
|
||||
}
|
||||
}
|
52
src/main/java/net/minecraft/src/Packet34EntityTeleport.java
Normal file
52
src/main/java/net/minecraft/src/Packet34EntityTeleport.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet34EntityTeleport extends Packet {
|
||||
public int entityId;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public byte yaw;
|
||||
public byte pitch;
|
||||
|
||||
public Packet34EntityTeleport() {
|
||||
}
|
||||
|
||||
public Packet34EntityTeleport(Entity var1) {
|
||||
this.entityId = var1.field_620_ab;
|
||||
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
|
||||
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
|
||||
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
|
||||
this.yaw = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F));
|
||||
this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.entityId = var1.readInt();
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
this.yaw = (byte)var1.read();
|
||||
this.pitch = (byte)var1.read();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.entityId);
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.write(this.yaw);
|
||||
var1.write(this.pitch);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleEntityTeleport(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 34;
|
||||
}
|
||||
}
|
28
src/main/java/net/minecraft/src/Packet38.java
Normal file
28
src/main/java/net/minecraft/src/Packet38.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet38 extends Packet {
|
||||
public int field_9274_a;
|
||||
public byte field_9273_b;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.field_9274_a = var1.readInt();
|
||||
this.field_9273_b = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.field_9274_a);
|
||||
var1.writeByte(this.field_9273_b);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.func_9447_a(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 5;
|
||||
}
|
||||
}
|
28
src/main/java/net/minecraft/src/Packet39.java
Normal file
28
src/main/java/net/minecraft/src/Packet39.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet39 extends Packet {
|
||||
public int field_6365_a;
|
||||
public int field_6364_b;
|
||||
|
||||
public int getPacketSize() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.field_6365_a = var1.readInt();
|
||||
this.field_6364_b = var1.readInt();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.field_6365_a);
|
||||
var1.writeInt(this.field_6364_b);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.func_6497_a(this);
|
||||
}
|
||||
}
|
32
src/main/java/net/minecraft/src/Packet3Chat.java
Normal file
32
src/main/java/net/minecraft/src/Packet3Chat.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet3Chat extends Packet {
|
||||
public String message;
|
||||
|
||||
public Packet3Chat() {
|
||||
}
|
||||
|
||||
public Packet3Chat(String var1) {
|
||||
this.message = var1;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.message = var1.readUTF();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeUTF(this.message);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleChat(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return this.message.length();
|
||||
}
|
||||
}
|
25
src/main/java/net/minecraft/src/Packet4UpdateTime.java
Normal file
25
src/main/java/net/minecraft/src/Packet4UpdateTime.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet4UpdateTime extends Packet {
|
||||
public long time;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.time = var1.readLong();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeLong(this.time);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleUpdateTime(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 8;
|
||||
}
|
||||
}
|
31
src/main/java/net/minecraft/src/Packet50PreChunk.java
Normal file
31
src/main/java/net/minecraft/src/Packet50PreChunk.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet50PreChunk extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public boolean mode;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.mode = var1.read() != 0;
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.write(this.mode ? 1 : 0);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handlePreChunk(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 9;
|
||||
}
|
||||
}
|
65
src/main/java/net/minecraft/src/Packet51MapChunk.java
Normal file
65
src/main/java/net/minecraft/src/Packet51MapChunk.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class Packet51MapChunk extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int zSize;
|
||||
public byte[] chunk;
|
||||
private int chunkSize;
|
||||
|
||||
public Packet51MapChunk() {
|
||||
this.isChunkDataPacket = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readShort();
|
||||
this.zPosition = var1.readInt();
|
||||
this.xSize = var1.read() + 1;
|
||||
this.ySize = var1.read() + 1;
|
||||
this.zSize = var1.read() + 1;
|
||||
int var2 = var1.readInt();
|
||||
byte[] var3 = new byte[var2];
|
||||
var1.readFully(var3);
|
||||
this.chunk = new byte[this.xSize * this.ySize * this.zSize * 5 / 2];
|
||||
Inflater var4 = new Inflater();
|
||||
var4.setInput(var3);
|
||||
|
||||
try {
|
||||
var4.inflate(this.chunk);
|
||||
} catch (DataFormatException var9) {
|
||||
throw new IOException("Bad compressed data format");
|
||||
} finally {
|
||||
var4.end();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeShort(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.write(this.xSize - 1);
|
||||
var1.write(this.ySize - 1);
|
||||
var1.write(this.zSize - 1);
|
||||
var1.writeInt(this.chunkSize);
|
||||
var1.write(this.chunk, 0, this.chunkSize);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleMapChunk(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 17 + this.chunkSize;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet52MultiBlockChange extends Packet {
|
||||
public int xPosition;
|
||||
public int zPosition;
|
||||
public short[] coordinateArray;
|
||||
public byte[] typeArray;
|
||||
public byte[] metadataArray;
|
||||
public int size;
|
||||
|
||||
public Packet52MultiBlockChange() {
|
||||
this.isChunkDataPacket = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
this.size = var1.readShort() & '\uffff';
|
||||
this.coordinateArray = new short[this.size];
|
||||
this.typeArray = new byte[this.size];
|
||||
this.metadataArray = new byte[this.size];
|
||||
|
||||
for(int var2 = 0; var2 < this.size; ++var2) {
|
||||
this.coordinateArray[var2] = var1.readShort();
|
||||
}
|
||||
|
||||
var1.readFully(this.typeArray);
|
||||
var1.readFully(this.metadataArray);
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.writeShort((short)this.size);
|
||||
|
||||
for(int var2 = 0; var2 < this.size; ++var2) {
|
||||
var1.writeShort(this.coordinateArray[var2]);
|
||||
}
|
||||
|
||||
var1.write(this.typeArray);
|
||||
var1.write(this.metadataArray);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleMultiBlockChange(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 10 + this.size * 4;
|
||||
}
|
||||
}
|
41
src/main/java/net/minecraft/src/Packet53BlockChange.java
Normal file
41
src/main/java/net/minecraft/src/Packet53BlockChange.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet53BlockChange extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public int type;
|
||||
public int metadata;
|
||||
|
||||
public Packet53BlockChange() {
|
||||
this.isChunkDataPacket = true;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.read();
|
||||
this.zPosition = var1.readInt();
|
||||
this.type = var1.read();
|
||||
this.metadata = var1.read();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.write(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.write(this.type);
|
||||
var1.write(this.metadata);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleBlockChange(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 11;
|
||||
}
|
||||
}
|
59
src/main/java/net/minecraft/src/Packet59ComplexEntity.java
Normal file
59
src/main/java/net/minecraft/src/Packet59ComplexEntity.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet59ComplexEntity extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public byte[] entityData;
|
||||
public NBTTagCompound entityNBT;
|
||||
|
||||
public Packet59ComplexEntity() {
|
||||
this.isChunkDataPacket = true;
|
||||
}
|
||||
|
||||
public Packet59ComplexEntity(int var1, int var2, int var3, TileEntity var4) {
|
||||
this.isChunkDataPacket = true;
|
||||
this.xPosition = var1;
|
||||
this.yPosition = var2;
|
||||
this.zPosition = var3;
|
||||
this.entityNBT = new NBTTagCompound();
|
||||
var4.writeToNBT(this.entityNBT);
|
||||
|
||||
try {
|
||||
this.entityData = CompressedStreamTools.func_1142_a(this.entityNBT);
|
||||
} catch (IOException var6) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readShort();
|
||||
this.zPosition = var1.readInt();
|
||||
int var2 = var1.readShort() & '\uffff';
|
||||
this.entityData = new byte[var2];
|
||||
var1.readFully(this.entityData);
|
||||
this.entityNBT = CompressedStreamTools.func_1140_a(this.entityData);
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeShort(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.writeShort((short)this.entityData.length);
|
||||
var1.write(this.entityData);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleComplexEntity(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return this.entityData.length + 2 + 10;
|
||||
}
|
||||
}
|
63
src/main/java/net/minecraft/src/Packet5PlayerInventory.java
Normal file
63
src/main/java/net/minecraft/src/Packet5PlayerInventory.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet5PlayerInventory extends Packet {
|
||||
public int type;
|
||||
public ItemStack[] stacks;
|
||||
|
||||
public Packet5PlayerInventory() {
|
||||
}
|
||||
|
||||
public Packet5PlayerInventory(int var1, ItemStack[] var2) {
|
||||
this.type = var1;
|
||||
this.stacks = new ItemStack[var2.length];
|
||||
|
||||
for(int var3 = 0; var3 < this.stacks.length; ++var3) {
|
||||
this.stacks[var3] = var2[var3] == null ? null : var2[var3].copy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.type = var1.readInt();
|
||||
short var2 = var1.readShort();
|
||||
this.stacks = new ItemStack[var2];
|
||||
|
||||
for(int var3 = 0; var3 < var2; ++var3) {
|
||||
short var4 = var1.readShort();
|
||||
if(var4 >= 0) {
|
||||
byte var5 = var1.readByte();
|
||||
short var6 = var1.readShort();
|
||||
this.stacks[var3] = new ItemStack(var4, var5, var6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.type);
|
||||
var1.writeShort(this.stacks.length);
|
||||
|
||||
for(int var2 = 0; var2 < this.stacks.length; ++var2) {
|
||||
if(this.stacks[var2] == null) {
|
||||
var1.writeShort(-1);
|
||||
} else {
|
||||
var1.writeShort((short)this.stacks[var2].itemID);
|
||||
var1.writeByte((byte)this.stacks[var2].stackSize);
|
||||
var1.writeShort((short)this.stacks[var2].itemDamage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handlePlayerInventory(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 6 + this.stacks.length * 5;
|
||||
}
|
||||
}
|
67
src/main/java/net/minecraft/src/Packet60.java
Normal file
67
src/main/java/net/minecraft/src/Packet60.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public class Packet60 extends Packet {
|
||||
public double field_12236_a;
|
||||
public double field_12235_b;
|
||||
public double field_12239_c;
|
||||
public float field_12238_d;
|
||||
public Set field_12237_e;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.field_12236_a = var1.readDouble();
|
||||
this.field_12235_b = var1.readDouble();
|
||||
this.field_12239_c = var1.readDouble();
|
||||
this.field_12238_d = var1.readFloat();
|
||||
int var2 = var1.readInt();
|
||||
this.field_12237_e = new HashSet();
|
||||
int var3 = (int)this.field_12236_a;
|
||||
int var4 = (int)this.field_12235_b;
|
||||
int var5 = (int)this.field_12239_c;
|
||||
|
||||
for(int var6 = 0; var6 < var2; ++var6) {
|
||||
int var7 = var1.readByte() + var3;
|
||||
int var8 = var1.readByte() + var4;
|
||||
int var9 = var1.readByte() + var5;
|
||||
this.field_12237_e.add(new ChunkPosition(var7, var8, var9));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeDouble(this.field_12236_a);
|
||||
var1.writeDouble(this.field_12235_b);
|
||||
var1.writeDouble(this.field_12239_c);
|
||||
var1.writeFloat(this.field_12238_d);
|
||||
var1.writeInt(this.field_12237_e.size());
|
||||
int var2 = (int)this.field_12236_a;
|
||||
int var3 = (int)this.field_12235_b;
|
||||
int var4 = (int)this.field_12239_c;
|
||||
Iterator var5 = this.field_12237_e.iterator();
|
||||
|
||||
while(var5.hasNext()) {
|
||||
ChunkPosition var6 = (ChunkPosition)var5.next();
|
||||
int var7 = var6.x - var2;
|
||||
int var8 = var6.y - var3;
|
||||
int var9 = var6.z - var4;
|
||||
var1.writeByte(var7);
|
||||
var1.writeByte(var8);
|
||||
var1.writeByte(var9);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.func_12245_a(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 32 + this.field_12237_e.size() * 3;
|
||||
}
|
||||
}
|
31
src/main/java/net/minecraft/src/Packet6SpawnPosition.java
Normal file
31
src/main/java/net/minecraft/src/Packet6SpawnPosition.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet6SpawnPosition extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readInt();
|
||||
this.zPosition = var1.readInt();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeInt(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleSpawnPosition(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 12;
|
||||
}
|
||||
}
|
40
src/main/java/net/minecraft/src/Packet7.java
Normal file
40
src/main/java/net/minecraft/src/Packet7.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet7 extends Packet {
|
||||
public int field_9277_a;
|
||||
public int field_9276_b;
|
||||
public int field_9278_c;
|
||||
|
||||
public Packet7() {
|
||||
}
|
||||
|
||||
public Packet7(int var1, int var2, int var3) {
|
||||
this.field_9277_a = var1;
|
||||
this.field_9276_b = var2;
|
||||
this.field_9278_c = var3;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.field_9277_a = var1.readInt();
|
||||
this.field_9276_b = var1.readInt();
|
||||
this.field_9278_c = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.field_9277_a);
|
||||
var1.writeInt(this.field_9276_b);
|
||||
var1.writeByte(this.field_9278_c);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.func_6499_a(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 9;
|
||||
}
|
||||
}
|
25
src/main/java/net/minecraft/src/Packet8.java
Normal file
25
src/main/java/net/minecraft/src/Packet8.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet8 extends Packet {
|
||||
public int healthMP;
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.healthMP = var1.readByte();
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) throws IOException {
|
||||
var1.writeByte(this.healthMP);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleHealth(this);
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 1;
|
||||
}
|
||||
}
|
20
src/main/java/net/minecraft/src/Packet9.java
Normal file
20
src/main/java/net/minecraft/src/Packet9.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
public class Packet9 extends Packet {
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.func_9448_a(this);
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) {
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream var1) {
|
||||
}
|
||||
|
||||
public int getPacketSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
172
src/main/java/net/minecraft/src/PlayerControllerMP.java
Normal file
172
src/main/java/net/minecraft/src/PlayerControllerMP.java
Normal file
|
@ -0,0 +1,172 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class PlayerControllerMP extends PlayerController {
|
||||
private int field_9445_c = -1;
|
||||
private int field_9444_d = -1;
|
||||
private int field_9443_e = -1;
|
||||
private float field_9442_f = 0.0F;
|
||||
private float field_1080_g = 0.0F;
|
||||
private float field_9441_h = 0.0F;
|
||||
private int field_9440_i = 0;
|
||||
private boolean field_9439_j = false;
|
||||
private NetClientHandler field_9438_k;
|
||||
private int field_1075_l = 0;
|
||||
|
||||
public PlayerControllerMP(Minecraft var1, NetClientHandler var2) {
|
||||
super(var1);
|
||||
this.field_9438_k = var2;
|
||||
}
|
||||
|
||||
public void flipPlayer(EntityPlayer var1) {
|
||||
var1.rotationYaw = -180.0F;
|
||||
}
|
||||
|
||||
public boolean sendBlockRemoved(int var1, int var2, int var3, int var4) {
|
||||
this.field_9438_k.addToSendQueue(new Packet14BlockDig(3, var1, var2, var3, var4));
|
||||
int var5 = this.mc.theWorld.getBlockId(var1, var2, var3);
|
||||
this.mc.theWorld.getBlockMetadata(var1, var2, var3);
|
||||
boolean var7 = super.sendBlockRemoved(var1, var2, var3, var4);
|
||||
ItemStack var8 = this.mc.thePlayer.getCurrentEquippedItem();
|
||||
if(var8 != null) {
|
||||
var8.hitBlock(var5, var1, var2, var3);
|
||||
if(var8.stackSize == 0) {
|
||||
var8.func_1097_a(this.mc.thePlayer);
|
||||
this.mc.thePlayer.destroyCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
|
||||
return var7;
|
||||
}
|
||||
|
||||
public void clickBlock(int var1, int var2, int var3, int var4) {
|
||||
this.field_9439_j = true;
|
||||
this.field_9438_k.addToSendQueue(new Packet14BlockDig(0, var1, var2, var3, var4));
|
||||
int var5 = this.mc.theWorld.getBlockId(var1, var2, var3);
|
||||
if(var5 > 0 && this.field_9442_f == 0.0F) {
|
||||
Block.blocksList[var5].onBlockClicked(this.mc.theWorld, var1, var2, var3, this.mc.thePlayer);
|
||||
}
|
||||
|
||||
if(var5 > 0 && Block.blocksList[var5].func_225_a(this.mc.thePlayer) >= 1.0F) {
|
||||
this.sendBlockRemoved(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void func_6468_a() {
|
||||
if(this.field_9439_j) {
|
||||
this.field_9439_j = false;
|
||||
this.field_9438_k.addToSendQueue(new Packet14BlockDig(2, 0, 0, 0, 0));
|
||||
this.field_9442_f = 0.0F;
|
||||
this.field_9440_i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendBlockRemoving(int var1, int var2, int var3, int var4) {
|
||||
this.field_9439_j = true;
|
||||
this.func_730_e();
|
||||
this.field_9438_k.addToSendQueue(new Packet14BlockDig(1, var1, var2, var3, var4));
|
||||
if(this.field_9440_i > 0) {
|
||||
--this.field_9440_i;
|
||||
} else {
|
||||
if(var1 == this.field_9445_c && var2 == this.field_9444_d && var3 == this.field_9443_e) {
|
||||
int var5 = this.mc.theWorld.getBlockId(var1, var2, var3);
|
||||
if(var5 == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block var6 = Block.blocksList[var5];
|
||||
this.field_9442_f += var6.func_225_a(this.mc.thePlayer);
|
||||
if(this.field_9441_h % 4.0F == 0.0F && var6 != null) {
|
||||
this.mc.sndManager.func_336_b(var6.stepSound.func_1145_d(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var6.stepSound.func_1147_b() + 1.0F) / 8.0F, var6.stepSound.func_1144_c() * 0.5F);
|
||||
}
|
||||
|
||||
++this.field_9441_h;
|
||||
if(this.field_9442_f >= 1.0F) {
|
||||
this.sendBlockRemoved(var1, var2, var3, var4);
|
||||
this.field_9442_f = 0.0F;
|
||||
this.field_1080_g = 0.0F;
|
||||
this.field_9441_h = 0.0F;
|
||||
this.field_9440_i = 5;
|
||||
}
|
||||
} else {
|
||||
this.field_9442_f = 0.0F;
|
||||
this.field_1080_g = 0.0F;
|
||||
this.field_9441_h = 0.0F;
|
||||
this.field_9445_c = var1;
|
||||
this.field_9444_d = var2;
|
||||
this.field_9443_e = var3;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void func_6467_a(float var1) {
|
||||
if(this.field_9442_f <= 0.0F) {
|
||||
this.mc.ingameGUI.field_6446_b = 0.0F;
|
||||
this.mc.field_6323_f.field_1450_i = 0.0F;
|
||||
} else {
|
||||
float var2 = this.field_1080_g + (this.field_9442_f - this.field_1080_g) * var1;
|
||||
this.mc.ingameGUI.field_6446_b = var2;
|
||||
this.mc.field_6323_f.field_1450_i = var2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public float getBlockReachDistance() {
|
||||
return 4.0F;
|
||||
}
|
||||
|
||||
public void func_717_a(World var1) {
|
||||
super.func_717_a(var1);
|
||||
}
|
||||
|
||||
public void func_6474_c() {
|
||||
this.func_730_e();
|
||||
this.field_1080_g = this.field_9442_f;
|
||||
//this.mc.sndManager.func_4033_c();
|
||||
}
|
||||
|
||||
private void func_730_e() {
|
||||
ItemStack var1 = this.mc.thePlayer.inventory.getCurrentItem();
|
||||
int var2 = 0;
|
||||
if(var1 != null) {
|
||||
var2 = var1.itemID;
|
||||
}
|
||||
|
||||
if(var2 != this.field_1075_l) {
|
||||
this.field_1075_l = var2;
|
||||
this.field_9438_k.addToSendQueue(new Packet16BlockItemSwitch(0, this.field_1075_l));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean sendPlaceBlock(EntityPlayer var1, World var2, ItemStack var3, int var4, int var5, int var6, int var7) {
|
||||
this.func_730_e();
|
||||
this.field_9438_k.addToSendQueue(new Packet15Place(var3 != null ? var3.itemID : -1, var4, var5, var6, var7));
|
||||
return super.sendPlaceBlock(var1, var2, var3, var4, var5, var6, var7);
|
||||
}
|
||||
|
||||
public boolean sendUseItem(EntityPlayer var1, World var2, ItemStack var3) {
|
||||
this.func_730_e();
|
||||
this.field_9438_k.addToSendQueue(new Packet15Place(var3 != null ? var3.itemID : -1, -1, -1, -1, 255));
|
||||
return super.sendUseItem(var1, var2, var3);
|
||||
}
|
||||
|
||||
public EntityPlayer func_4087_b(World var1) {
|
||||
return new EntityClientPlayerMP(this.mc, var1, this.mc.field_6320_i, this.field_9438_k);
|
||||
}
|
||||
|
||||
public void func_6472_b(EntityPlayer var1, Entity var2) {
|
||||
this.func_730_e();
|
||||
this.field_9438_k.addToSendQueue(new Packet7(var1.field_620_ab, var2.field_620_ab, 1));
|
||||
var1.attackTargetEntityWithCurrentItem(var2);
|
||||
}
|
||||
|
||||
public void func_6475_a(EntityPlayer var1, Entity var2) {
|
||||
this.func_730_e();
|
||||
this.field_9438_k.addToSendQueue(new Packet7(var1.field_620_ab, var2.field_620_ab, 0));
|
||||
var1.func_6415_a_(var2);
|
||||
}
|
||||
}
|
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()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -109,7 +109,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||
--this.furnaceBurnTime;
|
||||
}
|
||||
|
||||
//if(!this.worldObj.multiplayerWorld) {
|
||||
if(!this.worldObj.multiplayerWorld) {
|
||||
if(this.furnaceBurnTime == 0 && this.canSmelt()) {
|
||||
this.currentItemBurnTime = this.furnaceBurnTime = this.getItemBurnTime(this.furnaceItemStacks[1]);
|
||||
if(this.furnaceBurnTime > 0) {
|
||||
|
@ -138,7 +138,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||
var2 = true;
|
||||
BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if(var2) {
|
||||
this.onInventoryChanged();
|
||||
|
|
|
@ -60,6 +60,7 @@ public class World implements IBlockAccess {
|
|||
private Set field_9427_K;
|
||||
private int field_9426_L;
|
||||
private List field_1012_M;
|
||||
public boolean multiplayerWorld;
|
||||
|
||||
public static NBTTagCompound func_629_a(String var1) {
|
||||
if(!GL11.isWebGL) {
|
||||
|
@ -140,6 +141,7 @@ public class World implements IBlockAccess {
|
|||
this.field_9427_K = new HashSet();
|
||||
this.field_9426_L = this.rand.nextInt(12000);
|
||||
this.field_1012_M = new ArrayList();
|
||||
this.multiplayerWorld = false;
|
||||
this.field_9431_w = var1;
|
||||
this.randomSeed = var3;
|
||||
this.worldProvider = var2;
|
||||
|
@ -175,6 +177,7 @@ public class World implements IBlockAccess {
|
|||
this.field_9427_K = new HashSet();
|
||||
this.field_9426_L = this.rand.nextInt(12000);
|
||||
this.field_1012_M = new ArrayList();
|
||||
this.multiplayerWorld = false;
|
||||
this.field_1054_E = var1.field_1054_E;
|
||||
this.field_9433_s = var1.field_9433_s;
|
||||
this.field_9432_t = var1.field_9432_t;
|
||||
|
@ -222,6 +225,7 @@ public class World implements IBlockAccess {
|
|||
this.field_9427_K = new HashSet();
|
||||
this.field_9426_L = this.rand.nextInt(12000);
|
||||
this.field_1012_M = new ArrayList();
|
||||
this.multiplayerWorld = false;
|
||||
this.field_9433_s = var1;
|
||||
this.field_9431_w = var2;
|
||||
if(!GL11.isWebGL) {
|
||||
|
@ -626,7 +630,7 @@ public class World implements IBlockAccess {
|
|||
}
|
||||
|
||||
private void notifyBlockOfNeighborChange(int var1, int var2, int var3, int var4) {
|
||||
if(!this.field_1043_h) {
|
||||
if(!this.field_1043_h && !this.multiplayerWorld) {
|
||||
Block var5 = Block.blocksList[this.getBlockId(var1, var2, var3)];
|
||||
if(var5 != null) {
|
||||
var5.onNeighborBlockChange(this, var1, var2, var3, var4);
|
||||
|
|
21
src/main/java/net/minecraft/src/WorldBlockPositionType.java
Normal file
21
src/main/java/net/minecraft/src/WorldBlockPositionType.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
class WorldBlockPositionType {
|
||||
int field_1202_a;
|
||||
int field_1201_b;
|
||||
int field_1207_c;
|
||||
int field_1206_d;
|
||||
int field_1205_e;
|
||||
int field_1204_f;
|
||||
final WorldClient field_1203_g;
|
||||
|
||||
public WorldBlockPositionType(WorldClient var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
this.field_1203_g = var1;
|
||||
this.field_1202_a = var2;
|
||||
this.field_1201_b = var3;
|
||||
this.field_1207_c = var4;
|
||||
this.field_1206_d = 80;
|
||||
this.field_1205_e = var5;
|
||||
this.field_1204_f = var6;
|
||||
}
|
||||
}
|
213
src/main/java/net/minecraft/src/WorldClient.java
Normal file
213
src/main/java/net/minecraft/src/WorldClient.java
Normal file
|
@ -0,0 +1,213 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
public class WorldClient extends World {
|
||||
private LinkedList field_1057_z = new LinkedList();
|
||||
private NetClientHandler sendQueue;
|
||||
private ChunkProviderClient C;
|
||||
private boolean D = false;
|
||||
private MCHashTable field_1055_D = new MCHashTable();
|
||||
private Set F = new HashSet();
|
||||
private Set field_1053_F = new HashSet();
|
||||
|
||||
public WorldClient(NetClientHandler var1, long var2, int var4) {
|
||||
super("MpServer", WorldProvider.func_4101_a(var4), var2);
|
||||
this.sendQueue = var1;
|
||||
this.spawnX = 8;
|
||||
this.spawnY = 64;
|
||||
this.spawnZ = 8;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
++this.worldTime;
|
||||
int var1 = this.calculateSkylightSubtracted(1.0F);
|
||||
int var2;
|
||||
if(var1 != this.skylightSubtracted) {
|
||||
this.skylightSubtracted = var1;
|
||||
|
||||
for(var2 = 0; var2 < this.worldAccesses.size(); ++var2) {
|
||||
((IWorldAccess)this.worldAccesses.get(var2)).func_936_e();
|
||||
}
|
||||
}
|
||||
|
||||
for(var2 = 0; var2 < 10 && !this.field_1053_F.isEmpty(); ++var2) {
|
||||
Entity var3 = (Entity)this.field_1053_F.iterator().next();
|
||||
if(!this.loadedEntityList.contains(var3)) {
|
||||
this.entityJoinedWorld(var3);
|
||||
}
|
||||
}
|
||||
|
||||
this.sendQueue.processReadPackets();
|
||||
|
||||
for(var2 = 0; var2 < this.field_1057_z.size(); ++var2) {
|
||||
WorldBlockPositionType var4 = (WorldBlockPositionType)this.field_1057_z.get(var2);
|
||||
if(--var4.field_1206_d == 0) {
|
||||
super.setBlockAndMetadata(var4.field_1202_a, var4.field_1201_b, var4.field_1207_c, var4.field_1205_e, var4.field_1204_f);
|
||||
super.func_665_h(var4.field_1202_a, var4.field_1201_b, var4.field_1207_c);
|
||||
this.field_1057_z.remove(var2--);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void func_711_c(int var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
for(int var7 = 0; var7 < this.field_1057_z.size(); ++var7) {
|
||||
WorldBlockPositionType var8 = (WorldBlockPositionType)this.field_1057_z.get(var7);
|
||||
if(var8.field_1202_a >= var1 && var8.field_1201_b >= var2 && var8.field_1207_c >= var3 && var8.field_1202_a <= var4 && var8.field_1201_b <= var5 && var8.field_1207_c <= var6) {
|
||||
this.field_1057_z.remove(var7--);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected IChunkProvider func_4081_a(File var1) {
|
||||
this.C = new ChunkProviderClient(this);
|
||||
return this.C;
|
||||
}
|
||||
|
||||
public void func_4076_b() {
|
||||
this.spawnX = 8;
|
||||
this.spawnY = 64;
|
||||
this.spawnZ = 8;
|
||||
}
|
||||
|
||||
protected void func_4080_j() {
|
||||
}
|
||||
|
||||
public void scheduleBlockUpdate(int var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public boolean TickUpdates(boolean var1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void func_713_a(int var1, int var2, boolean var3) {
|
||||
if(var3) {
|
||||
this.C.func_538_d(var1, var2);
|
||||
} else {
|
||||
this.C.func_539_c(var1, var2);
|
||||
}
|
||||
|
||||
if(!var3) {
|
||||
this.func_701_b(var1 * 16, 0, var2 * 16, var1 * 16 + 15, 128, var2 * 16 + 15);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean entityJoinedWorld(Entity var1) {
|
||||
boolean var2 = super.entityJoinedWorld(var1);
|
||||
this.F.add(var1);
|
||||
if(!var2) {
|
||||
this.field_1053_F.add(var1);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public void setEntityDead(Entity var1) {
|
||||
super.setEntityDead(var1);
|
||||
this.F.remove(var1);
|
||||
}
|
||||
|
||||
protected void obtainEntitySkin(Entity var1) {
|
||||
super.obtainEntitySkin(var1);
|
||||
if(this.field_1053_F.contains(var1)) {
|
||||
this.field_1053_F.remove(var1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void releaseEntitySkin(Entity var1) {
|
||||
super.releaseEntitySkin(var1);
|
||||
if(this.F.contains(var1)) {
|
||||
this.field_1053_F.add(var1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void func_712_a(int var1, Entity var2) {
|
||||
Entity var3 = this.func_709_b(var1);
|
||||
if(var3 != null) {
|
||||
this.setEntityDead(var3);
|
||||
}
|
||||
|
||||
this.F.add(var2);
|
||||
var2.field_620_ab = var1;
|
||||
if(!this.entityJoinedWorld(var2)) {
|
||||
this.field_1053_F.add(var2);
|
||||
}
|
||||
|
||||
this.field_1055_D.addKey(var1, var2);
|
||||
}
|
||||
|
||||
public Entity func_709_b(int var1) {
|
||||
return (Entity)this.field_1055_D.lookup(var1);
|
||||
}
|
||||
|
||||
public Entity func_710_c(int var1) {
|
||||
Entity var2 = (Entity)this.field_1055_D.removeObject(var1);
|
||||
if(var2 != null) {
|
||||
this.F.remove(var2);
|
||||
this.setEntityDead(var2);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public boolean setBlockMetadata(int var1, int var2, int var3, int var4) {
|
||||
int var5 = this.getBlockId(var1, var2, var3);
|
||||
int var6 = this.getBlockMetadata(var1, var2, var3);
|
||||
if(super.setBlockMetadata(var1, var2, var3, var4)) {
|
||||
this.field_1057_z.add(new WorldBlockPositionType(this, var1, var2, var3, var5, var6));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setBlockAndMetadata(int var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = this.getBlockId(var1, var2, var3);
|
||||
int var7 = this.getBlockMetadata(var1, var2, var3);
|
||||
if(super.setBlockAndMetadata(var1, var2, var3, var4, var5)) {
|
||||
this.field_1057_z.add(new WorldBlockPositionType(this, var1, var2, var3, var6, var7));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setBlock(int var1, int var2, int var3, int var4) {
|
||||
int var5 = this.getBlockId(var1, var2, var3);
|
||||
int var6 = this.getBlockMetadata(var1, var2, var3);
|
||||
if(super.setBlock(var1, var2, var3, var4)) {
|
||||
this.field_1057_z.add(new WorldBlockPositionType(this, var1, var2, var3, var5, var6));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean func_714_c(int var1, int var2, int var3, int var4, int var5) {
|
||||
this.func_711_c(var1, var2, var3, var1, var2, var3);
|
||||
if(super.setBlockAndMetadata(var1, var2, var3, var4, var5)) {
|
||||
this.notifyBlockChange(var1, var2, var3, var4);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void func_698_b(int var1, int var2, int var3, TileEntity var4) {
|
||||
if(!this.D) {
|
||||
this.sendQueue.addToSendQueue(new Packet59ComplexEntity(var1, var2, var3, var4));
|
||||
}
|
||||
}
|
||||
|
||||
public void sendQuittingDisconnectingPacket() {
|
||||
this.sendQueue.addToSendQueue(new Packet255KickDisconnect("Quitting"));
|
||||
}
|
||||
}
|
|
@ -1191,6 +1191,166 @@ 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;
|
||||
}
|
||||
|
||||
private static final Set<String> rateLimitedAddresses = new HashSet();
|
||||
private static final Set<String> blockedAddresses = new HashSet();
|
||||
|
||||
private static WebSocket sock = null;
|
||||
private static boolean sockIsConnecting = false;
|
||||
private static boolean sockIsConnected = false;
|
||||
private static boolean sockIsAlive = false;
|
||||
private static LinkedList<byte[]> readPackets = new LinkedList();
|
||||
private static RateLimit rateLimitStatus = null;
|
||||
private static String currentSockURI = null;
|
||||
|
||||
public static final RateLimit getRateLimitStatus() {
|
||||
RateLimit l = rateLimitStatus;
|
||||
rateLimitStatus = null;
|
||||
return l;
|
||||
}
|
||||
public static final void logRateLimit(String addr, RateLimit l) {
|
||||
if(l == RateLimit.BLOCKED) {
|
||||
blockedAddresses.add(addr);
|
||||
}else {
|
||||
rateLimitedAddresses.add(addr);
|
||||
}
|
||||
}
|
||||
public static final RateLimit checkRateLimitHistory(String addr) {
|
||||
if(blockedAddresses.contains(addr)) {
|
||||
return RateLimit.LOCKED;
|
||||
}else if(rateLimitedAddresses.contains(addr)) {
|
||||
return RateLimit.BLOCKED;
|
||||
}else {
|
||||
return RateLimit.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public static native String connectWebSocket(String sockURI);
|
||||
|
||||
private static void connectWebSocket(String sockURI, final AsyncCallback<String> cb) {
|
||||
sockIsConnecting = true;
|
||||
sockIsConnected = false;
|
||||
sockIsAlive = false;
|
||||
rateLimitStatus = null;
|
||||
currentSockURI = sockURI;
|
||||
try {
|
||||
sock = WebSocket.create(sockURI);
|
||||
} catch(Throwable t) {
|
||||
sockIsConnecting = false;
|
||||
sockIsAlive = false;
|
||||
return;
|
||||
}
|
||||
sock.setBinaryType("arraybuffer");
|
||||
sock.onOpen(new EventListener<Event>() {
|
||||
@Override
|
||||
public void handleEvent(Event evt) {
|
||||
sockIsConnecting = false;
|
||||
sockIsAlive = false;
|
||||
sockIsConnected = true;
|
||||
readPackets.clear();
|
||||
cb.complete("okay");
|
||||
}
|
||||
});
|
||||
sock.onClose(new EventListener<CloseEvent>() {
|
||||
@Override
|
||||
public void handleEvent(CloseEvent evt) {
|
||||
sock = null;
|
||||
if(sockIsConnecting) {
|
||||
if(rateLimitStatus == null) {
|
||||
if(blockedAddresses.contains(currentSockURI)) {
|
||||
rateLimitStatus = RateLimit.LOCKED;
|
||||
}else if(rateLimitedAddresses.contains(currentSockURI)) {
|
||||
rateLimitStatus = RateLimit.FAILED_POSSIBLY_LOCKED;
|
||||
}else {
|
||||
rateLimitStatus = RateLimit.FAILED;
|
||||
}
|
||||
}
|
||||
}else if(!sockIsAlive) {
|
||||
if(rateLimitStatus == null) {
|
||||
if(blockedAddresses.contains(currentSockURI)) {
|
||||
rateLimitStatus = RateLimit.LOCKED;
|
||||
}else if(rateLimitedAddresses.contains(currentSockURI)) {
|
||||
rateLimitStatus = RateLimit.BLOCKED;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean b = sockIsConnecting;
|
||||
sockIsConnecting = false;
|
||||
sockIsConnected = false;
|
||||
sockIsAlive = false;
|
||||
if(b) cb.complete("fail");
|
||||
}
|
||||
});
|
||||
sock.onMessage(new EventListener<MessageEvent>() {
|
||||
@Override
|
||||
public void handleEvent(MessageEvent evt) {
|
||||
sockIsAlive = true;
|
||||
if(isString(evt.getData())) {
|
||||
String stat = evt.getDataAsString();
|
||||
if(stat.equalsIgnoreCase("BLOCKED")) {
|
||||
if(rateLimitStatus == null) {
|
||||
rateLimitStatus = RateLimit.BLOCKED;
|
||||
}
|
||||
rateLimitedAddresses.add(currentSockURI);
|
||||
}else if(stat.equalsIgnoreCase("LOCKED")) {
|
||||
if(rateLimitStatus == null) {
|
||||
rateLimitStatus = RateLimit.NOW_LOCKED;
|
||||
}
|
||||
rateLimitedAddresses.add(currentSockURI);
|
||||
blockedAddresses.add(currentSockURI);
|
||||
}
|
||||
sockIsConnecting = false;
|
||||
sockIsConnected = false;
|
||||
sock.close();
|
||||
return;
|
||||
}
|
||||
Uint8Array a = Uint8Array.create(evt.getDataAsArray());
|
||||
byte[] b = new byte[a.getByteLength()];
|
||||
for(int i = 0; i < b.length; ++i) {
|
||||
b[i] = (byte) (a.get(i) & 0xFF);
|
||||
}
|
||||
readPackets.add(b);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static final boolean startConnection(String uri) {
|
||||
String res = connectWebSocket(uri);
|
||||
return "fail".equals(res) ? false : true;
|
||||
}
|
||||
public static final void endConnection() {
|
||||
if(sock == null || sock.getReadyState() == 3) {
|
||||
sockIsConnecting = false;
|
||||
}
|
||||
if(sock != null && !sockIsConnecting) sock.close();
|
||||
}
|
||||
public static final boolean connectionOpen() {
|
||||
if(sock == null || sock.getReadyState() == 3) {
|
||||
sockIsConnecting = false;
|
||||
}
|
||||
return sock != null && !sockIsConnecting && sock.getReadyState() != 3;
|
||||
}
|
||||
@JSBody(params = { "sock", "buffer" }, script = "sock.send(buffer);")
|
||||
private static native void nativeBinarySend(WebSocket sock, ArrayBuffer buffer);
|
||||
public static final void writePacket(byte[] packet) {
|
||||
if(sock != null && !sockIsConnecting) {
|
||||
Uint8Array arr = Uint8Array.create(packet.length);
|
||||
arr.set(packet);
|
||||
nativeBinarySend(sock, arr.getBuffer());
|
||||
}
|
||||
}
|
||||
public static final byte[] readPacket() {
|
||||
if(!readPackets.isEmpty()) {
|
||||
return readPackets.remove(0);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final byte[] loadLocalStorage(String key) {
|
||||
String s = win.getLocalStorage().getItem("_eaglercraft_beta."+key);
|
||||
if(s != null) {
|
||||
|
|
|
@ -15,6 +15,9 @@ public class ChunkLoader implements IChunkLoader {
|
|||
}
|
||||
|
||||
private String chunkFileForXZ_OLD(int var1, int var2) {
|
||||
if(saveDir == null) {
|
||||
return null;
|
||||
}
|
||||
String var3 = "c." + Integer.toString(var1, 36) + "." + Integer.toString(var2, 36) + ".dat";
|
||||
String var4 = Integer.toString(var1 & 63, 36);
|
||||
String var5 = Integer.toString(var2 & 63, 36);
|
||||
|
@ -30,6 +33,9 @@ public class ChunkLoader implements IChunkLoader {
|
|||
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
public String chunkFileForXZ(int x, int z) {
|
||||
if(saveDir == null) {
|
||||
return null;
|
||||
}
|
||||
boolean oldChunk = false;
|
||||
String oldChunkPath = chunkFileForXZ_OLD(x, z);
|
||||
if(oldChunkPath != null) {
|
||||
|
@ -52,37 +58,32 @@ public class ChunkLoader implements IChunkLoader {
|
|||
return s;
|
||||
}
|
||||
|
||||
public Chunk loadChunk(World var1, int var2, int var3) throws IOException {
|
||||
String var4 = this.chunkFileForXZ(var2, var3);
|
||||
if(GL11.readFile(var4) != null) {
|
||||
public Chunk loadChunk(World var1, int x, int z) throws IOException {
|
||||
if(saveDir == null) {
|
||||
return null;
|
||||
}
|
||||
String var4 = this.chunkFileForXZ(x, z);
|
||||
byte[] data = GL11.readFile(var4);
|
||||
if(data != null) {
|
||||
try {
|
||||
byte[] data = GL11.readFile(var4);
|
||||
ByteArrayInputStream var5 = new ByteArrayInputStream(data);
|
||||
NBTTagCompound var6;
|
||||
if(GL11.isCompressed(data)) {
|
||||
var6 = CompressedStreamTools.func_1138_a(var5);
|
||||
var6 = CompressedStreamTools.func_1138_a(new ByteArrayInputStream(data));
|
||||
} else {
|
||||
var6 = (NBTTagCompound) NBTBase.readTag(new DataInputStream(var5));
|
||||
var6 = (NBTTagCompound) NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
}
|
||||
if(!var6.hasKey("Level")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping");
|
||||
var6 = var6.getCompoundTag("Level");
|
||||
|
||||
int xx = var6.getInteger("xPos");
|
||||
int zz = var6.getInteger("zPos");
|
||||
if(x != xx || z != zz) {
|
||||
System.out.println("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + xx + ", " + zz + ")");
|
||||
String name = chunkFileForXZ(xx, zz);
|
||||
GL11.renameFile(var4, name);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!var6.getCompoundTag("Level").hasKey("Blocks")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing block data, skipping");
|
||||
return null;
|
||||
}
|
||||
|
||||
Chunk var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
if(!var7.isAtLocation(var2, var3)) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is in the wrong location; relocating. (Expected " + var2 + ", " + var3 + ", got " + var7.xPosition + ", " + var7.zPosition + ")");
|
||||
var6.setInteger("xPos", var2);
|
||||
var6.setInteger("zPos", var3);
|
||||
var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
}
|
||||
|
||||
return var7;
|
||||
return loadChunkIntoWorldFromCompound(var1, var6);
|
||||
} catch (Exception var8) {
|
||||
var8.printStackTrace();
|
||||
}
|
||||
|
@ -92,6 +93,9 @@ public class ChunkLoader implements IChunkLoader {
|
|||
}
|
||||
|
||||
public void saveChunk(World var1, Chunk var2) throws IOException {
|
||||
if(saveDir == null) {
|
||||
return;
|
||||
}
|
||||
var1.func_663_l();
|
||||
String var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
|
||||
if(GL11.readFile(var3) != null) {
|
||||
|
|
14433
web/js/app.js
14433
web/js/app.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user