Remove profiler and sp-server source

This commit is contained in:
catfoolyou
2025-03-13 11:08:36 -04:00
parent 37b05fb97a
commit c42a42f4d1
1254 changed files with 54012 additions and 174871 deletions

View File

@@ -0,0 +1,69 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.IOException;
import java.io.InputStream;
public class IPCInputStream extends InputStream {
private byte[] currentBuffer = null;
private int idx = 0;
private int markIDX = 0;
private String errorName = null;
public void feedBuffer(byte[] b) {
currentBuffer = b;
idx = 0;
errorName = null;
markIDX = 0;
}
public void nameBuffer(String str) {
errorName = str;
}
@Override
public int read() throws IOException {
try {
return ((int)currentBuffer[idx++]) & 0xFF;
}catch(ArrayIndexOutOfBoundsException a) {
throw new IOException("IPCInputStream buffer underflow" + (errorName == null ? "," : (" (while deserializing '" + errorName + "')")) + " no bytes remaining", a);
}
}
@Override
public int read(byte b[], int off, int len) throws IOException {
if(idx + len > currentBuffer.length) {
throw new IOException("IPCInputStream buffer underflow" + (errorName == null ? "," : (" (while deserializing '" + errorName + "')")) + " tried to read " + len + " when there are only " + (currentBuffer.length - idx) + " bytes remaining", new ArrayIndexOutOfBoundsException(idx + len - 1));
}
if(off + len > b.length) {
throw new ArrayIndexOutOfBoundsException(off + len - 1);
}
System.arraycopy(currentBuffer, idx, b, off, len);
idx += len;
return len;
}
public void markIndex() {
markIDX = idx;
}
public void rewindIndex() {
idx = markIDX;
}
public byte[] getLeftover() {
if(currentBuffer.length - idx <= 0) {
return null;
}
byte[] buf = new byte[currentBuffer.length - idx];
System.arraycopy(currentBuffer, idx, buf, 0, currentBuffer.length - idx);
return buf;
}
public int getLeftoverCount() {
return currentBuffer.length - idx;
}
}

View File

@@ -0,0 +1,54 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.IOException;
import java.io.OutputStream;
public class IPCOutputStream extends OutputStream {
private String className = null;
private byte[] currentBuffer = null;
private int idx = 0;
private int originalSize = 0;
public void feedBuffer(byte[] buf, String clazzName) {
currentBuffer = buf;
idx = 0;
originalSize = buf.length;
className = clazzName;
}
public byte[] returnBuffer() {
if(className != null && currentBuffer.length != originalSize) {
System.err.println("WARNING: Packet '" + className + "' was supposed to be " + originalSize + " bytes but buffer has grown by " + (currentBuffer.length - originalSize) + " to " + currentBuffer.length + " bytes");
}
return currentBuffer;
}
void growBuffer(int i) {
int ii = currentBuffer.length;
int iii = i - ii;
if(iii > 0) {
byte[] n = new byte[i];
System.arraycopy(currentBuffer, 0, n, 0, ii);
currentBuffer = n;
}
}
@Override
public void write(int b) throws IOException {
if(idx >= currentBuffer.length) {
growBuffer(idx + 1);
}
currentBuffer[idx++] = (byte) b;
}
@Override
public void write(byte b[], int off, int len) throws IOException {
if(idx + len > currentBuffer.length) {
growBuffer(idx + len);
}
System.arraycopy(b, off, currentBuffer, idx, len);
idx += len;
}
}

View File

@@ -0,0 +1,48 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket00StartServer implements IPCPacketBase {
public static final int ID = 0x00;
public String worldName;
public String ownerName;
public int initialDifficulty;
public IPCPacket00StartServer() {
}
public IPCPacket00StartServer(String worldName, String ownerName, int initialDifficulty) {
this.worldName = worldName;
this.ownerName = ownerName;
this.initialDifficulty = initialDifficulty;
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldName = bin.readUTF();
ownerName = bin.readUTF();
initialDifficulty = bin.readByte();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
bin.writeUTF(ownerName);
bin.writeByte(initialDifficulty);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName) + IPCPacketBase.strLen(ownerName) + 1;
}
}

View File

@@ -0,0 +1,32 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket01StopServer implements IPCPacketBase {
public static final int ID = 0x01;
public IPCPacket01StopServer() {
}
@Override
public void deserialize(DataInput bin) throws IOException {
}
@Override
public void serialize(DataOutput bin) throws IOException {
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return 0;
}
}

View File

@@ -0,0 +1,68 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket02InitWorld implements IPCPacketBase {
public static final int ID = 0x02;
public String worldName;
public byte gamemode;
public byte worldType;
public String worldArgs;
public long seed;
public boolean cheats;
public boolean structures;
public boolean bonusChest;
public IPCPacket02InitWorld() {
}
public IPCPacket02InitWorld(String worldName, int gamemode, int worldType, String worldArgs, long seed, boolean cheats, boolean structures, boolean bonusChest) {
this.worldName = worldName;
this.gamemode = (byte)gamemode;
this.worldType = (byte)worldType;
this.worldArgs = worldArgs;
this.seed = seed;
this.cheats = cheats;
this.structures = structures;
this.bonusChest = bonusChest;
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldName = bin.readUTF();
gamemode = bin.readByte();
worldType = bin.readByte();
worldArgs = bin.readUTF();
seed = bin.readLong();
cheats = bin.readBoolean();
structures = bin.readBoolean();
bonusChest = bin.readBoolean();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
bin.writeByte(gamemode);
bin.writeByte(worldType);
bin.writeUTF(worldArgs);
bin.writeLong(seed);
bin.writeBoolean(cheats);
bin.writeBoolean(structures);
bin.writeBoolean(bonusChest);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName) + 1 + 1 + IPCPacketBase.strLen(worldArgs) + 8 + 1 + 1 + 1;
}
}

View File

@@ -0,0 +1,40 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket03DeleteWorld implements IPCPacketBase {
public static final int ID = 0x03;
public String worldName;
public IPCPacket03DeleteWorld() {
}
public IPCPacket03DeleteWorld(String worldName) {
this.worldName = worldName;
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldName = bin.readUTF();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName);
}
}

View File

@@ -0,0 +1,52 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket04RenameWorld implements IPCPacketBase {
public static final int ID = 0x04;
public String worldOldName;
public String worldNewName;
public String displayName;
public boolean copy;
public IPCPacket04RenameWorld() {
}
public IPCPacket04RenameWorld(String worldOldName, String worldNewName, String displayName, boolean copy) {
this.worldOldName = worldOldName;
this.worldNewName = worldNewName;
this.displayName = displayName;
this.copy = copy;
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldOldName = bin.readUTF();
worldNewName = bin.readUTF();
displayName = bin.readUTF();
copy = bin.readBoolean();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldOldName);
bin.writeUTF(worldNewName);
bin.writeUTF(displayName);
bin.writeBoolean(copy);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldOldName) + IPCPacketBase.strLen(worldNewName) + IPCPacketBase.strLen(displayName) + 1;
}
}

View File

@@ -0,0 +1,48 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket05RequestData implements IPCPacketBase {
public static final int ID = 0x05;
public static final byte REQUEST_LEVEL_DAT = 0x00;
public static final byte REQUEST_LEVEL_EAG = 0x01;
public static final byte REQUEST_LEVEL_MCA = 0x02;
public String worldName;
public byte request;
public IPCPacket05RequestData() {
}
public IPCPacket05RequestData(String worldName, byte request) {
this.worldName = worldName;
this.request = request;
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldName = bin.readUTF();
request = bin.readByte();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
bin.writeByte(request);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName) + 1;
}
}

View File

@@ -0,0 +1,44 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket06RenameWorldNBT implements IPCPacketBase {
public static final int ID = 0x06;
public String worldName;
public String displayName;
public IPCPacket06RenameWorldNBT() {
}
public IPCPacket06RenameWorldNBT(String worldName, String displayName) {
this.worldName = worldName;
this.displayName = displayName;
}
@Override
public void deserialize(DataInput bin) throws IOException {
this.worldName = bin.readUTF();
this.displayName = bin.readUTF();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
bin.writeUTF(displayName);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName) + IPCPacketBase.strLen(displayName);
}
}

View File

@@ -0,0 +1,53 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket07ImportWorld implements IPCPacketBase {
public static final int ID = 0x07;
public String worldName;
public byte[] worldData;
public byte worldFormat;
public static final byte WORLD_FORMAT_EAG = 0x00;
public static final byte WORLD_FORMAT_MCA = 0x01;
public IPCPacket07ImportWorld() {
}
public IPCPacket07ImportWorld(String worldName, byte[] worldData, byte worldFormat) {
this.worldName = worldName;
this.worldData = worldData;
this.worldFormat = worldFormat;
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldName = bin.readUTF();
worldData = new byte[bin.readInt()];
worldFormat = bin.readByte();
bin.readFully(worldData);
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
bin.writeInt(worldData.length);
bin.writeByte(worldFormat);
bin.write(worldData);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName) + worldData.length + 5;
}
}

View File

@@ -0,0 +1,42 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket09RequestResponse implements IPCPacketBase {
public static final int ID = 0x09;
public byte[] response;
public IPCPacket09RequestResponse() {
}
public IPCPacket09RequestResponse(byte[] dat) {
this.response = dat;
}
@Override
public void deserialize(DataInput bin) throws IOException {
response = new byte[bin.readInt()];
bin.readFully(response);
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeInt(response.length);
bin.write(response);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return 4 + response.length;
}
}

View File

@@ -0,0 +1,40 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket0ASetWorldDifficulty implements IPCPacketBase {
public static final int ID = 0x0A;
public byte difficulty;
public IPCPacket0ASetWorldDifficulty() {
}
public IPCPacket0ASetWorldDifficulty(byte difficulty) {
this.difficulty = difficulty;
}
@Override
public void deserialize(DataInput bin) throws IOException {
difficulty = bin.readByte();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeByte(difficulty);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return 1;
}
}

View File

@@ -0,0 +1,40 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket0BPause implements IPCPacketBase {
public static final int ID = 0x0B;
public boolean pause;
public IPCPacket0BPause() {
}
public IPCPacket0BPause(boolean pause) {
this.pause = pause;
}
@Override
public void deserialize(DataInput bin) throws IOException {
pause = bin.readBoolean();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeBoolean(pause);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return 1;
}
}

View File

@@ -0,0 +1,44 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket0CPlayerChannel implements IPCPacketBase {
public static final int ID = 0x0C;
public String channel;
public boolean open;
public IPCPacket0CPlayerChannel() {
}
public IPCPacket0CPlayerChannel(String channel, boolean open) {
this.channel = channel;
this.open = open;
}
@Override
public void deserialize(DataInput bin) throws IOException {
channel = bin.readUTF();
open = bin.readBoolean();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(channel);
bin.writeBoolean(open);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(channel) + 1;
}
}

View File

@@ -0,0 +1,44 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket0DProgressUpdate implements IPCPacketBase {
public static final int ID = 0x0D;
public String updateMessage;
public float updateProgress;
public IPCPacket0DProgressUpdate() {
}
public IPCPacket0DProgressUpdate(String updateMessage, float updateProgress) {
this.updateMessage = updateMessage == null ? "" : updateMessage;
this.updateProgress = updateProgress;
}
@Override
public void deserialize(DataInput bin) throws IOException {
updateMessage = bin.readUTF();
updateProgress = bin.readFloat();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(updateMessage);
bin.writeFloat(updateProgress);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(updateMessage) + 4;
}
}

View File

@@ -0,0 +1,32 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket0EListWorlds implements IPCPacketBase {
public static final int ID = 0x0E;
public IPCPacket0EListWorlds() {
}
@Override
public void deserialize(DataInput bin) throws IOException {
}
@Override
public void serialize(DataOutput bin) throws IOException {
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return 0;
}
}

View File

@@ -0,0 +1,40 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket0FListFiles implements IPCPacketBase {
public static final int ID = 0x0F;
public String path;
public IPCPacket0FListFiles() {
}
public IPCPacket0FListFiles(String path) {
this.path = path;
}
@Override
public void deserialize(DataInput bin) throws IOException {
this.path = bin.readUTF();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(path);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(path);
}
}

View File

@@ -0,0 +1,40 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket10FileRead implements IPCPacketBase {
public static final int ID = 0x10;
public String file;
public IPCPacket10FileRead() {
}
public IPCPacket10FileRead(String file) {
this.file = file;
}
@Override
public void deserialize(DataInput bin) throws IOException {
file = bin.readUTF();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(file);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(file);
}
}

View File

@@ -0,0 +1,44 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket12FileWrite implements IPCPacketBase {
public static final int ID = 0x12;
public String path;
public byte[] data;
public IPCPacket12FileWrite() {
}
public IPCPacket12FileWrite(String path, byte[] data) {
this.path = path;
this.data = data;
}
@Override
public void deserialize(DataInput bin) throws IOException {
path = bin.readUTF();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(path);
bin.writeInt(data.length);
bin.write(data);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(path) + 4 + data.length;
}
}

View File

@@ -0,0 +1,48 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket13FileCopyMove implements IPCPacketBase {
public static final int ID = 0x13;
public String fileOldName;
public String fileNewName;
public boolean copy;
public IPCPacket13FileCopyMove() {
}
public IPCPacket13FileCopyMove(String fileOldName, String fileNewName, boolean copy) {
this.fileOldName = fileOldName;
this.fileNewName = fileNewName;
this.copy = copy;
}
@Override
public void deserialize(DataInput bin) throws IOException {
fileOldName = bin.readUTF();
fileNewName = bin.readUTF();
copy = bin.readBoolean();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(fileOldName);
bin.writeUTF(fileNewName);
bin.writeBoolean(copy);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(fileOldName) + IPCPacketBase.strLen(fileNewName) + 1;
}
}

View File

@@ -0,0 +1,80 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class IPCPacket14StringList implements IPCPacketBase {
public static final int ID = 0x14;
public static final int FILE_LIST = 0x0;
public static final int LOCALE = 0x1;
public static final int STAT_GUID = 0x2;
public static final int SERVER_TPS = 0x3;
public int opCode;
public final List<String> stringList;
public IPCPacket14StringList() {
stringList = new ArrayList<>();
}
public IPCPacket14StringList(int opcode, String[] list) {
stringList = new ArrayList<>();
for(String s : list) {
s = s.trim();
if(s.length() > 0) {
stringList.add(s);
}
}
this.opCode = opcode;
}
public IPCPacket14StringList(int opcode, List<String> list) {
stringList = new ArrayList<>();
for(String s : list) {
s = s.trim();
if(s.length() > 0) {
stringList.add(s);
}
}
this.opCode = opcode;
}
@Override
public void deserialize(DataInput bin) throws IOException {
stringList.clear();
opCode = bin.readByte();
int len = bin.readInt();
for(int i = 0; i < len; ++i) {
stringList.add(bin.readUTF());
}
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeByte(opCode);
bin.writeInt(stringList.size());
for(String str : stringList) {
bin.writeUTF(str);
}
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
int len = 5;
for(String str : stringList) {
len += IPCPacketBase.strLen(str);
}
return len;
}
}

View File

@@ -0,0 +1,71 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class IPCPacket15ThrowException implements IPCPacketBase {
public static final int ID = 0x15;
public String errorMessage;
public final List<String> stackTrace;
public IPCPacket15ThrowException() {
stackTrace = new ArrayList<>();
}
public IPCPacket15ThrowException(String errorMessage, String[] list) {
stackTrace = new ArrayList<>(Arrays.asList(list));
this.errorMessage = errorMessage;
}
public IPCPacket15ThrowException(String errorMessage, List<String> list) {
stackTrace = list;
this.errorMessage = errorMessage;
}
@Override
public void deserialize(DataInput bin) throws IOException {
stackTrace.clear();
errorMessage = bin.readUTF();
int len = bin.readInt();
for(int i = 0; i < len; ++i) {
stackTrace.add(bin.readUTF());
}
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(errorMessage);
bin.writeInt(stackTrace.size());
for(String str : stackTrace) {
bin.writeUTF(str);
}
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
int len = 4 + IPCPacketBase.strLen(errorMessage);
for(String str : stackTrace) {
len += IPCPacketBase.strLen(str);
}
return len;
}
public void log() {
System.err.println("Integrated server exception: " + errorMessage);
for(String s : stackTrace) {
System.err.println(" at " + s);
}
}
}

View File

@@ -0,0 +1,95 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.src.CompressedStreamTools;
import net.minecraft.src.NBTTagCompound;
public class IPCPacket16NBTList implements IPCPacketBase {
public static final int ID = 0x16;
public static final int WORLD_LIST = 0x0;
public int opCode;
public final List<byte[]> tagList;
public final List<NBTTagCompound> nbtTagList;
public IPCPacket16NBTList() {
tagList = new LinkedList<>();
nbtTagList = new LinkedList<>();
}
public IPCPacket16NBTList(int opcode, NBTTagCompound[] list) {
this(opcode, Arrays.asList(list));
}
public IPCPacket16NBTList(int opcode, List<NBTTagCompound> list) {
tagList = new LinkedList<>();
nbtTagList = list;
for(int i = 0, size = list.size(); i < size; ++i) {
NBTTagCompound tag = list.get(i);
try {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
CompressedStreamTools.write(tag, new DataOutputStream(bao));
tagList.add(bao.toByteArray());
}catch(IOException e) {
System.err.println("Failed to write tag '" + tag.getName() + "' (#" + i + ") in IPCPacket16NBTList");
}
}
opCode = opcode;
}
@Override
public void deserialize(DataInput bin) throws IOException {
tagList.clear();
nbtTagList.clear();
opCode = bin.readInt();
int count = bin.readInt();
for(int i = 0; i < count; ++i) {
byte[] toRead = new byte[bin.readInt()];
bin.readFully(toRead);
tagList.add(toRead);
try {
nbtTagList.add(CompressedStreamTools.read(new DataInputStream(new ByteArrayInputStream(toRead))));
}catch(IOException e) {
System.err.println("Failed to read tag #" + i + " in IPCPacket16NBTList");
}
}
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeInt(opCode);
bin.writeInt(tagList.size());
for(byte[] str : tagList) {
bin.writeInt(str.length);
bin.write(str);
}
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
int len = 8;
for(byte[] str : tagList) {
len += 4;
len += str.length;
}
return len;
}
}

View File

@@ -0,0 +1,63 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class IPCPacket17ConfigureLAN implements IPCPacketBase {
public static final int ID = 0x17;
public int gamemode;
public boolean cheats;
public final List<String> iceServers;
public IPCPacket17ConfigureLAN() {
iceServers = new ArrayList<>();
}
public IPCPacket17ConfigureLAN(int gamemode, boolean cheats, List<String> iceServers) {
this.gamemode = gamemode;
this.cheats = cheats;
this.iceServers = iceServers;
}
@Override
public void deserialize(DataInput bin) throws IOException {
gamemode = bin.readUnsignedByte();
cheats = bin.readBoolean();
iceServers.clear();
int iceCount = bin.readUnsignedByte();
for(int i = 0; i < iceCount; ++i) {
iceServers.add(bin.readUTF());
}
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeByte(gamemode);
bin.writeBoolean(cheats);
bin.writeByte(iceServers.size());
for(int i = 0, l = iceServers.size(); i < l; ++i) {
bin.writeUTF(iceServers.get(i));
}
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
int s = 0;
for(int i = 0, l = iceServers.size(); i < l; ++i) {
s += 2;
s += iceServers.get(i).length();
}
return 2 + 1 + s;
}
}

View File

@@ -0,0 +1,40 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacket18ClearPlayers implements IPCPacketBase {
public static final int ID = 0x18;
public String worldName = null;
public IPCPacket18ClearPlayers(String worldName) {
this.worldName = worldName;
}
public IPCPacket18ClearPlayers() {
}
@Override
public void deserialize(DataInput bin) throws IOException {
worldName = bin.readUTF();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeUTF(worldName);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return IPCPacketBase.strLen(worldName);
}
}

View File

@@ -0,0 +1,33 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public interface IPCPacketBase {
public void deserialize(DataInput bin) throws IOException;
public void serialize(DataOutput bin) throws IOException;
public int id();
public int size();
public static int strLen(String s) {
int strlen = s.length();
int utflen = 2;
int c;
for (int i = 0; i < strlen; ++i) {
c = s.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
++utflen;
} else if (c > 0x07FF) {
utflen += 3;
} else {
utflen += 2;
}
}
return utflen;
}
}

View File

@@ -0,0 +1,43 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IPCPacketFFProcessKeepAlive implements IPCPacketBase {
public static final int ID = 0xFF;
public static final int KEEPALIVE = 0;
public static final int FAILURE = 0xFE;
public int ack;
public IPCPacketFFProcessKeepAlive() {
}
public IPCPacketFFProcessKeepAlive(int ack) {
this.ack = ack;
}
@Override
public void deserialize(DataInput bin) throws IOException {
ack = bin.readUnsignedByte();
}
@Override
public void serialize(DataOutput bin) throws IOException {
bin.writeByte(ack);
}
@Override
public int id() {
return ID;
}
@Override
public int size() {
return 1;
}
}

View File

@@ -0,0 +1,79 @@
package net.lax1dude.eaglercraft.sp.ipc;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.function.Supplier;
public class IPCPacketManager {
public static final HashMap<Integer, Supplier<IPCPacketBase>> mappings = new HashMap<>();
public static final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
public static final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
public static final DataInputStream IPC_DATA_INPUT_STREAM = new DataInputStream(IPC_INPUT_STREAM);
public static final DataOutputStream IPC_DATA_OUTPUT_STREAM = new DataOutputStream(IPC_OUTPUT_STREAM);
static {
mappings.put(IPCPacket00StartServer.ID, () -> new IPCPacket00StartServer());
mappings.put(IPCPacket01StopServer.ID, () -> new IPCPacket01StopServer());
mappings.put(IPCPacket02InitWorld.ID, () -> new IPCPacket02InitWorld());
mappings.put(IPCPacket03DeleteWorld.ID, () -> new IPCPacket03DeleteWorld());
mappings.put(IPCPacket04RenameWorld.ID, () -> new IPCPacket04RenameWorld());
mappings.put(IPCPacket05RequestData.ID, () -> new IPCPacket05RequestData());
mappings.put(IPCPacket06RenameWorldNBT.ID, () -> new IPCPacket06RenameWorldNBT());
mappings.put(IPCPacket07ImportWorld.ID, () -> new IPCPacket07ImportWorld());
mappings.put(IPCPacket09RequestResponse.ID, () -> new IPCPacket09RequestResponse());
mappings.put(IPCPacket0ASetWorldDifficulty.ID, () -> new IPCPacket0ASetWorldDifficulty());
mappings.put(IPCPacket0BPause.ID, () -> new IPCPacket0BPause());
mappings.put(IPCPacket0CPlayerChannel.ID, () -> new IPCPacket0CPlayerChannel());
mappings.put(IPCPacket0DProgressUpdate.ID, () -> new IPCPacket0DProgressUpdate());
mappings.put(IPCPacket0EListWorlds.ID, () -> new IPCPacket0EListWorlds());
mappings.put(IPCPacket0FListFiles.ID, () -> new IPCPacket0FListFiles());
mappings.put(IPCPacket10FileRead.ID, () -> new IPCPacket10FileRead());
mappings.put(IPCPacket12FileWrite.ID, () -> new IPCPacket12FileWrite());
mappings.put(IPCPacket13FileCopyMove.ID, () -> new IPCPacket13FileCopyMove());
mappings.put(IPCPacket14StringList.ID, () -> new IPCPacket14StringList());
mappings.put(IPCPacket15ThrowException.ID, () -> new IPCPacket15ThrowException());
mappings.put(IPCPacket16NBTList.ID, () -> new IPCPacket16NBTList());
mappings.put(IPCPacket17ConfigureLAN.ID, () -> new IPCPacket17ConfigureLAN());
mappings.put(IPCPacket18ClearPlayers.ID, () -> new IPCPacket18ClearPlayers());
mappings.put(IPCPacketFFProcessKeepAlive.ID, () -> new IPCPacketFFProcessKeepAlive());
}
public static byte[] IPCSerialize(IPCPacketBase pkt) throws IOException {
IPC_OUTPUT_STREAM.feedBuffer(new byte[pkt.size() + 1], pkt.getClass().getSimpleName());
IPC_OUTPUT_STREAM.write(pkt.id());
pkt.serialize(IPC_DATA_OUTPUT_STREAM);
return IPC_OUTPUT_STREAM.returnBuffer();
}
public static IPCPacketBase IPCDeserialize(byte[] pkt) throws IOException {
IPC_INPUT_STREAM.feedBuffer(pkt);
int i = IPC_INPUT_STREAM.read();
Supplier<IPCPacketBase> pk = mappings.get(Integer.valueOf(i));
if(pk == null) {
throw new IOException("Packet type 0x" + Integer.toHexString(i) + " doesn't exist");
}
IPCPacketBase p = pk.get();
IPC_INPUT_STREAM.nameBuffer(p.getClass().getSimpleName());
p.deserialize(IPC_DATA_INPUT_STREAM);
int lo = IPC_INPUT_STREAM.getLeftoverCount();
if(lo > 0) {
System.err.println("Packet type 0x" + Integer.toHexString(i) + " class '" + p.getClass().getSimpleName() + "' was size " + (pkt.length - 1) + " but only " + (pkt.length - 1 - lo) + " bytes were read");
}
return p;
}
}

View File

@@ -26,7 +26,6 @@ import net.minecraft.src.IUpdatePlayerListBox;
import net.minecraft.src.MinecraftException;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet4UpdateTime;
import net.minecraft.src.Profiler;
import net.minecraft.src.ServerCommandManager;
import net.minecraft.src.ServerConfigurationManager;
import net.minecraft.src.World;
@@ -51,7 +50,6 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
*/
private final List tickables = new ArrayList();
private final ICommandManager commandManager;
public final Profiler theProfiler = new Profiler();
/** The server's hostname. */
private String hostname;
@@ -234,12 +232,12 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
if (var10 == 0)
{
this.worldServers[var10] = new WorldServer(this, var7, par2Str, var11, var8, this.theProfiler, this.getLogAgent());
this.worldServers[var10] = new WorldServer(this, var7, par2Str, var11, var8, this.getLogAgent());
}
else
{
this.worldServers[var10] = new WorldServerMulti(this, var7, par2Str, var11, var8, this.worldServers[0], this.theProfiler, this.getLogAgent());
this.worldServers[var10] = new WorldServerMulti(this, var7, par2Str, var11, var8, this.worldServers[0], this.getLogAgent());
}
this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10]));
@@ -503,25 +501,14 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
AxisAlignedBB.getAABBPool().cleanPool();
++this.tickCounter;
if (this.startProfiling)
{
this.startProfiling = false;
this.theProfiler.profilingEnabled = false;
this.theProfiler.clearProfiling();
}
this.theProfiler.startSection("root");
this.updateTimeLightAndEntities();
if (this.tickCounter % 900 == 0)
{
this.theProfiler.startSection("save");
this.serverConfigManager.saveAllPlayerData();
this.saveAllWorlds(true);
this.theProfiler.endSection();
}
this.theProfiler.startSection("tallying");
this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - var1;
this.sentPacketCountArray[this.tickCounter % 100] = Packet.sentID - this.lastSentPacketID;
this.lastSentPacketID = Packet.sentID;
@@ -531,13 +518,10 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
this.lastReceivedID = Packet.receivedID;
this.receivedPacketSizeArray[this.tickCounter % 100] = Packet.receivedSize - this.lastReceivedSize;
this.lastReceivedSize = Packet.receivedSize;
this.theProfiler.endSection();
this.theProfiler.endSection();
}
public void updateTimeLightAndEntities()
{
this.theProfiler.startSection("levels");
int var1;
for (var1 = 0; var1 < this.worldServers.length; ++var1)
@@ -547,45 +531,27 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
if (var1 == 0 || this.getAllowNether())
{
WorldServer var4 = this.worldServers[var1];
this.theProfiler.startSection(var4.getWorldInfo().getWorldName());
this.theProfiler.startSection("pools");
var4.getWorldVec3Pool().clear();
this.theProfiler.endSection();
if (this.tickCounter % 20 == 0)
{
this.theProfiler.startSection("timeSync");
this.serverConfigManager.sendPacketToAllPlayersInDimension(new Packet4UpdateTime(var4.getTotalWorldTime(), var4.getWorldTime(), var4.getGameRules().getGameRuleBooleanValue("doDaylightCycle")), var4.provider.dimensionId);
this.theProfiler.endSection();
}
this.theProfiler.startSection("tick");
var4.tick();
var4.updateEntities();
this.theProfiler.endSection();
this.theProfiler.startSection("tracker");
var4.getEntityTracker().updateTrackedEntities();
this.theProfiler.endSection();
this.theProfiler.endSection();
}
this.timeOfLastDimensionTick[var1][this.tickCounter % 100] = System.nanoTime() - var2;
}
this.theProfiler.endStartSection("connection");
this.theProfiler.endStartSection("players");
this.serverConfigManager.sendPlayerInfoToAllPlayers();
this.theProfiler.endStartSection("tickables");
for (var1 = 0; var1 < this.tickables.size(); ++var1)
{
((IUpdatePlayerListBox)this.tickables.get(var1)).update();
}
this.theProfiler.endSection();
}
public boolean getAllowNether()

View File

@@ -49,17 +49,10 @@ public class CommandDebug extends CommandBase
if (par2ArrayOfStr[0].equals("stop"))
{
if (!MinecraftServer.getServer().theProfiler.profilingEnabled)
{
throw new CommandException("commands.debug.notStarted", new Object[0]);
}
long var3 = MinecraftServer.getSystemTimeMillis();
int var5 = MinecraftServer.getServer().getTickCounter();
long var6 = var3 - this.startTime;
int var8 = var5 - this.startTicks;
//this.saveProfilerResults(var6, var8);
MinecraftServer.getServer().theProfiler.profilingEnabled = false;
notifyAdmins(par1ICommandSender, "commands.debug.stop", new Object[] {Float.valueOf((float)var6 / 1000.0F), Integer.valueOf(var8)});
return;
}

View File

@@ -12,14 +12,11 @@ public class EntityAITasks
/** A list of EntityAITaskEntrys that are currently being executed. */
private List executingTaskEntries = new ArrayList();
/** Instance of Profiler. */
private final Profiler theProfiler;
private int tickCount;
private int tickRate = 3;
public EntityAITasks(Profiler par1Profiler)
public EntityAITasks()
{
this.theProfiler = par1Profiler;
}
public void addTask(int par1, EntityAIBase par2EntityAIBase)
@@ -101,19 +98,14 @@ public class EntityAITasks
}
}
this.theProfiler.startSection("goalStart");
var2 = var1.iterator();
while (var2.hasNext())
{
var3 = (EntityAITaskEntry)var2.next();
this.theProfiler.startSection(var3.action.getClass().getSimpleName());
var3.action.startExecuting();
this.theProfiler.endSection();
}
this.theProfiler.endSection();
this.theProfiler.startSection("goalTick");
var2 = this.executingTaskEntries.iterator();
while (var2.hasNext())
@@ -121,8 +113,6 @@ public class EntityAITasks
var3 = (EntityAITaskEntry)var2.next();
var3.action.updateTask();
}
this.theProfiler.endSection();
}
/**
@@ -130,9 +120,7 @@ public class EntityAITasks
*/
private boolean canContinue(EntityAITaskEntry par1EntityAITaskEntry)
{
this.theProfiler.startSection("canContinue");
boolean var2 = par1EntityAITaskEntry.action.continueExecuting();
this.theProfiler.endSection();
return var2;
}
@@ -142,7 +130,6 @@ public class EntityAITasks
*/
private boolean canUse(EntityAITaskEntry par1EntityAITaskEntry)
{
this.theProfiler.startSection("canUse");
Iterator var2 = this.taskEntries.iterator();
while (var2.hasNext())
@@ -155,19 +142,16 @@ public class EntityAITasks
{
if (this.executingTaskEntries.contains(var3) && !this.areTasksCompatible(par1EntityAITaskEntry, var3))
{
this.theProfiler.endSection();
return false;
}
}
else if (this.executingTaskEntries.contains(var3) && !var3.action.isInterruptible())
{
this.theProfiler.endSection();
return false;
}
}
}
this.theProfiler.endSection();
return true;
}

View File

@@ -51,8 +51,8 @@ public abstract class EntityLiving extends EntityLivingBase
public EntityLiving(World par1World)
{
super(par1World);
this.tasks = new EntityAITasks(null);
this.targetTasks = new EntityAITasks(null);
this.tasks = new EntityAITasks();
this.targetTasks = new EntityAITasks();
this.lookHelper = new EntityLookHelper(this);
this.moveHelper = new EntityMoveHelper(this);
this.jumpHelper = new EntityJumpHelper(this);

View File

@@ -922,14 +922,11 @@ public class EntityRenderer
*/
public void updateCameraAndRender(float par1)
{
this.mc.mcProfiler.startSection("lightTex");
if (this.lightmapUpdateNeeded)
{
this.updateLightmap(par1);
}
this.mc.mcProfiler.endSection();
boolean var2 = EaglerAdapter.isFocused();
if (!var2 && this.mc.gameSettings.pauseOnLostFocus)
@@ -944,8 +941,6 @@ public class EntityRenderer
this.prevFrameTime = Minecraft.getSystemTime();
}
this.mc.mcProfiler.startSection("mouse");
if (this.mc.inGameHasFocus && var2)
{
this.mc.mouseHelper.mouseXYChange();
@@ -976,8 +971,6 @@ public class EntityRenderer
}
}
this.mc.mcProfiler.endSection();
if (!this.mc.skipRenderWorld)
{
anaglyphEnable = this.mc.gameSettings.anaglyph;
@@ -990,8 +983,6 @@ public class EntityRenderer
if (this.mc.theWorld != null)
{
this.mc.mcProfiler.startSection("level");
if (this.mc.gameSettings.limitFramerate == 0)
{
this.renderWorld(par1, 0L);
@@ -1011,14 +1002,12 @@ public class EntityRenderer
// }
this.renderEndNanoTime = System.nanoTime();
this.mc.mcProfiler.endStartSection("gui");
if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null)
{
this.mc.ingameGUI.renderGameOverlay(par1, this.mc.currentScreen != null, var16, var17);
}
this.mc.mcProfiler.endSection();
}
else
{
@@ -1042,8 +1031,6 @@ public class EntityRenderer
public void renderWorld(float par1, long par2)
{
this.mc.mcProfiler.startSection("lightTex");
if (this.lightmapUpdateNeeded)
{
this.updateLightmap(par1);
@@ -1057,7 +1044,6 @@ public class EntityRenderer
this.mc.renderViewEntity = this.mc.thePlayer;
}
this.mc.mcProfiler.endStartSection("pick");
this.getMouseOver(par1);
EntityLivingBase var4 = this.mc.renderViewEntity;
RenderGlobal var5 = this.mc.renderGlobal;
@@ -1086,21 +1072,17 @@ public class EntityRenderer
}
}
this.mc.mcProfiler.endStartSection("clear");
EaglerAdapter.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
this.updateFogColor(par1);
EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT);
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
this.mc.mcProfiler.endStartSection("camera");
this.setupCameraTransform(par1, var13);
ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2);
this.mc.mcProfiler.endStartSection("frustrum");
ClippingHelperImpl.getInstance();
if (this.mc.gameSettings.renderDistance < 2)
{
this.setupFog(-1, par1);
this.mc.mcProfiler.endStartSection("sky");
var5.renderSky(par1);
}
@@ -1112,15 +1094,12 @@ public class EntityRenderer
EaglerAdapter.glShadeModel(EaglerAdapter.GL_SMOOTH);
}
this.mc.mcProfiler.endStartSection("culling");
Frustrum var14 = new Frustrum();
var14.setPosition(var7, var9, var11);
this.mc.renderGlobal.clipRenderersByFrustum(var14, par1);
if (var13 == 0)
{
this.mc.mcProfiler.endStartSection("updatechunks");
while (!this.mc.renderGlobal.updateRenderers(var4, false) && par2 != 0L)
{
long var15 = par2 - System.nanoTime();
@@ -1137,13 +1116,11 @@ public class EntityRenderer
this.renderCloudsCheck(var5, par1);
}
this.mc.mcProfiler.endStartSection("prepareterrain");
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
this.setupFog(0, par1);
EaglerAdapter.glEnable(EaglerAdapter.GL_FOG);
TextureMap.locationBlocksTexture.bindTexture();
RenderHelper.disableStandardItemLighting();
this.mc.mcProfiler.endStartSection("terrain");
var5.sortAndRender(var4, 0, (double)par1);
EaglerAdapter.glShadeModel(EaglerAdapter.GL_FLAT);
EntityPlayer var17;
@@ -1152,14 +1129,11 @@ public class EntityRenderer
if (this.debugViewDirection == 0)
{
RenderHelper.enableStandardItemLighting2();
this.mc.mcProfiler.endStartSection("entities");
var5.renderEntities(var4.getPosition(par1), var14, par1);
this.enableLightmap((double)par1);
this.mc.mcProfiler.endStartSection("litParticles");
var6.renderLitParticles(var4, par1);
RenderHelper.disableStandardItemLighting();
this.setupFog(0, par1);
this.mc.mcProfiler.endStartSection("particles");
var6.renderParticles(var4, par1);
this.disableLightmap((double)par1);
@@ -1167,7 +1141,6 @@ public class EntityRenderer
{
var17 = (EntityPlayer)var4;
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
this.mc.mcProfiler.endStartSection("outline");
var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, par1);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
}
@@ -1229,17 +1202,14 @@ public class EntityRenderer
{
var17 = (EntityPlayer)var4;
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
this.mc.mcProfiler.endStartSection("outline");
var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, par1);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
}
this.mc.mcProfiler.endStartSection("destroyProgress");
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE);
var5.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)var4, par1);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
this.mc.mcProfiler.endStartSection("weather");
this.renderRainSnow(par1);
EaglerAdapter.glDisable(EaglerAdapter.GL_FOG);
@@ -1248,8 +1218,6 @@ public class EntityRenderer
this.renderCloudsCheck(var5, par1);
}
this.mc.mcProfiler.endStartSection("hand");
if (this.cameraZoom == 1.0D)
{
EaglerAdapter.glClear(EaglerAdapter.GL_DEPTH_BUFFER_BIT);
@@ -1258,7 +1226,6 @@ public class EntityRenderer
if (!this.mc.gameSettings.anaglyph)
{
this.mc.mcProfiler.endSection();
return;
}
}
@@ -1274,7 +1241,6 @@ public class EntityRenderer
{
if (this.mc.gameSettings.shouldRenderClouds())
{
this.mc.mcProfiler.endStartSection("clouds");
EaglerAdapter.glPushMatrix();
this.setupFog(0, par2);
EaglerAdapter.glEnable(EaglerAdapter.GL_FOG);

View File

@@ -28,24 +28,24 @@ public class FontRenderer {
* Array of RGB triplets defining the 16 standard chat colors followed by 16
* darker version of the same colors for drop shadows.
*/
private int[] colorCode = new int[32];
private final TextureLocation fontTexture;
protected int[] colorCode = new int[32];
protected final TextureLocation fontTexture;
private final String fontTextureName;
/** The RenderEngine used to load and setup glyph textures. */
private final RenderEngine renderEngine;
/** Current X coordinate at which to draw the next character. */
private float posX;
protected float posX;
/** Current Y coordinate at which to draw the next character. */
private float posY;
protected float posY;
/**
* If true, strings should be rendered with Unicode fonts instead of the
* default.png font
*/
private boolean unicodeFlag = false;
protected boolean unicodeFlag = false;
/**
* If true, the Unicode Bidirectional Algorithm should be run before rendering
@@ -54,38 +54,52 @@ public class FontRenderer {
private boolean bidiFlag;
/** Used to specify new red value for the current color. */
private float red;
protected float red;
/** Used to specify new blue value for the current color. */
private float blue;
protected float blue;
/** Used to specify new green value for the current color. */
private float green;
protected float green;
/** Used to speify new alpha value for the current color. */
private float alpha;
protected float alpha;
/** Text color of the currently rendering string. */
private int textColor;
protected int textColor;
/** Set if the "k" style (random) is active in currently rendering string */
private boolean randomStyle = false;
protected boolean randomStyle = false;
/** Set if the "l" style (bold) is active in currently rendering string */
private boolean boldStyle = false;
protected boolean boldStyle = false;
/** Set if the "o" style (italic) is active in currently rendering string */
private boolean italicStyle = false;
protected boolean italicStyle = false;
/**
* Set if the "n" style (underlined) is active in currently rendering string
*/
private boolean underlineStyle = false;
protected boolean underlineStyle = false;
/**
* Set if the "m" style (strikethrough) is active in currently rendering string
*/
private boolean strikethroughStyle = false;
protected boolean strikethroughStyle = false;
protected static char[] codepointLookup = new char[] { 192, 193, 194, 200, 202, 203, 205, 211, 212, 213, 218, 223,
227, 245, 287, 304, 305, 338, 339, 350, 351, 372, 373, 382, 519, 0, 0, 0, 0, 0, 0, 0, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 0, 199, 252, 233, 226, 228, 224, 229, 231,
234, 235, 232, 239, 238, 236, 196, 197, 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 248, 163,
216, 215, 402, 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187, 9617, 9618,
9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500,
9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554,
9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 945, 946, 915, 960, 931, 963, 956, 964, 934,
920, 937, 948, 8734, 8709, 8712, 8745, 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730,
8319, 178, 9632, 0 };
public FontRenderer(GameSettings par1GameSettings, String par2Str, RenderEngine par3RenderEngine, boolean par4) {
this.fontTexture = new TextureLocation(par2Str);
@@ -278,7 +292,7 @@ public class FontRenderer {
* Reset all style flag fields in the class to false; called at the start of
* string rendering
*/
private void resetStyles() {
protected void resetStyles() {
this.randomStyle = false;
this.boldStyle = false;
this.italicStyle = false;
@@ -289,7 +303,7 @@ public class FontRenderer {
/**
* Render a single line string at the current (posX,posY) and update posX
*/
private void renderStringAtPos(String par1Str, boolean par2) {
protected void renderStringAtPos(String par1Str, boolean par2) {
Tessellator t = Tessellator.instance;
this.fontTexture.bindTexture();
t.startDrawingQuads();

View File

@@ -126,14 +126,12 @@ public class GuiIngame extends Gui
RenderHelper.disableStandardItemLighting();
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
this.mc.mcProfiler.endSection();
}
int var32;
if (this.mc.thePlayer.getSleepTimer() > 0)
{
this.mc.mcProfiler.startSection("sleep");
EaglerAdapter.glDisable(EaglerAdapter.GL_DEPTH_TEST);
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
var32 = this.mc.thePlayer.getSleepTimer();
@@ -148,7 +146,7 @@ public class GuiIngame extends Gui
drawRect(0, 0, var6, var7, var12);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glEnable(EaglerAdapter.GL_DEPTH_TEST);
this.mc.mcProfiler.endSection();
}
var32 = 16777215;
@@ -163,7 +161,6 @@ public class GuiIngame extends Gui
if (this.mc.thePlayer.isRidingHorse())
{
this.mc.mcProfiler.startSection("jumpBar");
Gui.icons.bindTexture();
var34 = this.mc.thePlayer.getHorseJumpPower();
var35 = 182;
@@ -176,11 +173,10 @@ public class GuiIngame extends Gui
this.drawTexturedModalRect(var11, var15, 0, 89, var14, 5);
}
this.mc.mcProfiler.endSection();
}
else if (this.mc.playerController.func_78763_f())
{
this.mc.mcProfiler.startSection("expBar");
Gui.icons.bindTexture();
var12 = this.mc.thePlayer.xpBarCap();
@@ -197,11 +193,10 @@ public class GuiIngame extends Gui
}
}
this.mc.mcProfiler.endSection();
if (this.mc.thePlayer.experienceLevel > 0)
{
this.mc.mcProfiler.startSection("expLevel");
boolean var37 = false;
var14 = var37 ? 16777215 : 8453920;
String var39 = "" + this.mc.thePlayer.experienceLevel;
@@ -213,7 +208,7 @@ public class GuiIngame extends Gui
var8.drawString(var39, var16, var17 + 1, 0);
var8.drawString(var39, var16, var17 - 1, 0);
var8.drawString(var39, var16, var17, var14);
this.mc.mcProfiler.endSection();
}
}
@@ -221,7 +216,6 @@ public class GuiIngame extends Gui
if (this.mc.gameSettings.heldItemTooltips)
{
this.mc.mcProfiler.startSection("toolHighlight");
if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null)
{
@@ -252,7 +246,7 @@ public class GuiIngame extends Gui
}
}
this.mc.mcProfiler.endSection();
}
int var21;
@@ -349,7 +343,6 @@ public class GuiIngame extends Gui
if (this.recordPlayingUpFor > 0)
{
this.mc.mcProfiler.startSection("overlayMessage");
var34 = (float)this.recordPlayingUpFor - par1;
var13 = (int)(var34 * 255.0F / 20.0F);
@@ -376,7 +369,7 @@ public class GuiIngame extends Gui
EaglerAdapter.glPopMatrix();
}
this.mc.mcProfiler.endSection();
}
ScoreObjective var40 = this.mc.theWorld.getScoreboard().func_96539_a(1);
@@ -391,15 +384,12 @@ public class GuiIngame extends Gui
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(0.0F, (float)(var7 - 48), 0.0F);
this.mc.mcProfiler.startSection("chat");
this.persistantChatGUI.drawChat(this.updateCounter);
this.mc.mcProfiler.endSection();
EaglerAdapter.glPopMatrix();
var40 = this.mc.theWorld.getScoreboard().func_96539_a(0);
if (this.mc.gameSettings.keyBindPlayerList.pressed && (!this.mc.isIntegratedServerRunning() || this.mc.thePlayer.sendQueue.playerInfoList.size() > 1 || var40 != null))
{
this.mc.mcProfiler.startSection("playerList");
NetClientHandler var42 = this.mc.thePlayer.sendQueue;
List var44 = var42.playerInfoList;
var15 = var42.currentServerMaxPlayers;
@@ -574,7 +564,6 @@ public class GuiIngame extends Gui
var21 = this.updateCounter % MathHelper.ceiling_float_int(var14 + 5.0F);
}
this.mc.mcProfiler.startSection("armor");
int var22;
int var23;
@@ -601,7 +590,6 @@ public class GuiIngame extends Gui
}
}
this.mc.mcProfiler.endStartSection("health");
int var25;
int var26;
int var27;
@@ -694,7 +682,6 @@ public class GuiIngame extends Gui
if (var34 == null)
{
this.mc.mcProfiler.endStartSection("food");
for (var23 = 0; var23 < 10; ++var23)
{
@@ -747,7 +734,6 @@ public class GuiIngame extends Gui
}
else if (var34 instanceof EntityLivingBase)
{
this.mc.mcProfiler.endStartSection("mountHealth");
EntityLivingBase var37 = (EntityLivingBase)var34;
var35 = (int)Math.ceil((double)var37.getHealth());
float var38 = var37.getMaxHealth();
@@ -793,8 +779,6 @@ public class GuiIngame extends Gui
}
}
this.mc.mcProfiler.endStartSection("air");
if (this.mc.thePlayer.isInsideOfMaterial(Material.water))
{
var23 = this.mc.thePlayer.getAir();
@@ -813,8 +797,6 @@ public class GuiIngame extends Gui
}
}
}
this.mc.mcProfiler.endSection();
}
/**

View File

@@ -113,8 +113,6 @@ public class Minecraft
private INetworkManager myNetworkManager;
private boolean integratedServerIsRunning;
/** The profiler instance */
public final Profiler mcProfiler = new Profiler();
private long field_83002_am = -1L;
private List defaultResourcePacks = new ArrayList<>();

View File

@@ -66,9 +66,7 @@ public class NetServerHandler extends NetHandler
{
this.field_72584_h = false;
++this.currentTicks;
this.mcServer.theProfiler.startSection("packetflow");
this.netManager.processReadPackets();
this.mcServer.theProfiler.endStartSection("keepAlive");
if ((long)this.currentTicks - this.ticksOfLastKeepAlive > 20L)
{
@@ -87,9 +85,6 @@ public class NetServerHandler extends NetHandler
{
--this.creativeItemCreationSpamThresholdTally;
}
this.mcServer.theProfiler.endStartSection("playerTick");
this.mcServer.theProfiler.endSection();
}
public void kickPlayerFromServer(String par1Str)

View File

@@ -1,57 +0,0 @@
package net.minecraft.src;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Profiler
{
/** List of parent sections */
private final List sectionList = new ArrayList();
/** List of timestamps (System.nanoTime) */
private final List timestampList = new ArrayList();
/** Flag profiling enabled */
public boolean profilingEnabled;
/** Current profiling section */
private String profilingSection = "";
/** Profiling map */
private final Map profilingMap = new HashMap();
/**
* Clear profiling.
*/
public void clearProfiling()
{
this.profilingMap.clear();
this.profilingSection = "";
this.sectionList.clear();
}
/**
* Start section
*/
public void startSection(String par1Str)
{
}
/**
* End section
*/
public void endSection()
{
}
/**
* End current section and start a new section
*/
public void endStartSection(String par1Str)
{
}
}

View File

@@ -45,7 +45,7 @@ public class WorldServer extends World
/** An IntHashMap of entity IDs (integers) to their Entity objects. */
private IntHashMap entityIdMap;
public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, Profiler par6Profiler, ILogAgent par7ILogAgent)
public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, ILogAgent par7ILogAgent)
{
super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4));
this.mcServer = par1MinecraftServer;

View File

@@ -4,9 +4,9 @@ import net.minecraft.server.MinecraftServer;
public class WorldServerMulti extends WorldServer
{
public WorldServerMulti(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, WorldServer par6WorldServer, Profiler par7Profiler, ILogAgent par8ILogAgent)
public WorldServerMulti(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, WorldServer par6WorldServer, ILogAgent par8ILogAgent)
{
super(par1MinecraftServer, par2ISaveHandler, par3Str, par4, par5WorldSettings, par7Profiler, par8ILogAgent);
super(par1MinecraftServer, par2ISaveHandler, par3Str, par4, par5WorldSettings, par8ILogAgent);
this.mapStorage = par6WorldServer.mapStorage;
this.worldScoreboard = par6WorldServer.getScoreboard();
this.worldInfo = new DerivedWorldInfo(par6WorldServer.getWorldInfo());