Merge branch 'main' of https://github.com/LAX1DUDE/eaglercraft into LAX1DUDE-main
This commit is contained in:
commit
582a3bb925
|
@ -60,6 +60,7 @@ import net.md_5.bungee.command.CommandSend;
|
||||||
import net.md_5.bungee.command.CommandPerms;
|
import net.md_5.bungee.command.CommandPerms;
|
||||||
import net.md_5.bungee.command.CommandBungee;
|
import net.md_5.bungee.command.CommandBungee;
|
||||||
import net.md_5.bungee.command.CommandClearRatelimit;
|
import net.md_5.bungee.command.CommandClearRatelimit;
|
||||||
|
import net.md_5.bungee.command.CommandConfirmCode;
|
||||||
import net.md_5.bungee.command.CommandAlert;
|
import net.md_5.bungee.command.CommandAlert;
|
||||||
import net.md_5.bungee.command.CommandIP;
|
import net.md_5.bungee.command.CommandIP;
|
||||||
import net.md_5.bungee.command.CommandServer;
|
import net.md_5.bungee.command.CommandServer;
|
||||||
|
@ -154,6 +155,7 @@ public class BungeeCord extends ProxyServer {
|
||||||
this.getPluginManager().registerCommand(null, new CommandSend());
|
this.getPluginManager().registerCommand(null, new CommandSend());
|
||||||
this.getPluginManager().registerCommand(null, new CommandFind());
|
this.getPluginManager().registerCommand(null, new CommandFind());
|
||||||
this.getPluginManager().registerCommand(null, new CommandClearRatelimit());
|
this.getPluginManager().registerCommand(null, new CommandClearRatelimit());
|
||||||
|
this.getPluginManager().registerCommand(null, new CommandConfirmCode());
|
||||||
this.registerChannel("BungeeCord");
|
this.registerChannel("BungeeCord");
|
||||||
Log.setOutput(new PrintStream(ByteStreams.nullOutputStream()));
|
Log.setOutput(new PrintStream(ByteStreams.nullOutputStream()));
|
||||||
AnsiConsole.systemInstall();
|
AnsiConsole.systemInstall();
|
||||||
|
|
|
@ -12,7 +12,7 @@ public enum ChatColor {
|
||||||
BLACK('0'), DARK_BLUE('1'), DARK_GREEN('2'), DARK_AQUA('3'), DARK_RED('4'), DARK_PURPLE('5'), GOLD('6'), GRAY('7'), DARK_GRAY('8'), BLUE('9'), GREEN('a'), AQUA('b'), RED('c'), LIGHT_PURPLE('d'), YELLOW('e'), WHITE('f'), MAGIC('k'),
|
BLACK('0'), DARK_BLUE('1'), DARK_GREEN('2'), DARK_AQUA('3'), DARK_RED('4'), DARK_PURPLE('5'), GOLD('6'), GRAY('7'), DARK_GRAY('8'), BLUE('9'), GREEN('a'), AQUA('b'), RED('c'), LIGHT_PURPLE('d'), YELLOW('e'), WHITE('f'), MAGIC('k'),
|
||||||
BOLD('l'), STRIKETHROUGH('m'), UNDERLINE('n'), ITALIC('o'), RESET('r');
|
BOLD('l'), STRIKETHROUGH('m'), UNDERLINE('n'), ITALIC('o'), RESET('r');
|
||||||
|
|
||||||
public static final char COLOR_CHAR = '§';
|
public static final char COLOR_CHAR = '\u00A7';
|
||||||
private static final Pattern STRIP_COLOR_PATTERN;
|
private static final Pattern STRIP_COLOR_PATTERN;
|
||||||
private static final Map<Character, ChatColor> BY_CHAR;
|
private static final Map<Character, ChatColor> BY_CHAR;
|
||||||
private final char code;
|
private final char code;
|
||||||
|
@ -20,7 +20,7 @@ public enum ChatColor {
|
||||||
|
|
||||||
private ChatColor(final char code) {
|
private ChatColor(final char code) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.toString = new String(new char[] { '§', code });
|
this.toString = new String(new char[] { '\u00A7', code });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,7 +39,7 @@ public enum ChatColor {
|
||||||
final char[] b = textToTranslate.toCharArray();
|
final char[] b = textToTranslate.toCharArray();
|
||||||
for (int i = 0; i < b.length - 1; ++i) {
|
for (int i = 0; i < b.length - 1; ++i) {
|
||||||
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
|
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
|
||||||
b[i] = '§';
|
b[i] = '\u00A7';
|
||||||
b[i + 1] = Character.toLowerCase(b[i + 1]);
|
b[i + 1] = Character.toLowerCase(b[i + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public enum ChatColor {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('§') + "[0-9A-FK-OR]");
|
STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('\u00A7') + "[0-9A-FK-OR]");
|
||||||
BY_CHAR = new HashMap<Character, ChatColor>();
|
BY_CHAR = new HashMap<Character, ChatColor>();
|
||||||
for (final ChatColor colour : values()) {
|
for (final ChatColor colour : values()) {
|
||||||
ChatColor.BY_CHAR.put(colour.code, colour);
|
ChatColor.BY_CHAR.put(colour.code, colour);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package net.md_5.bungee.command;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
|
import net.md_5.bungee.eaglercraft.QueryConnectionImpl;
|
||||||
|
import net.md_5.bungee.eaglercraft.SHA1Digest;
|
||||||
|
|
||||||
|
public class CommandConfirmCode extends Command {
|
||||||
|
|
||||||
|
public CommandConfirmCode() {
|
||||||
|
super("confirm-code", "bungeecord.command.eag.confirmcode", "confirmcode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender p0, String[] p1) {
|
||||||
|
if(p1.length != 1) {
|
||||||
|
p0.sendMessage(ChatColor.RED + "How to use: " + ChatColor.WHITE + "/confirm-code <code>");
|
||||||
|
}else {
|
||||||
|
p0.sendMessage(ChatColor.YELLOW + "Server list 2FA code has been set to: " + ChatColor.GREEN + p1[0]);
|
||||||
|
p0.sendMessage(ChatColor.YELLOW + "You can now return to the server list site and continue");
|
||||||
|
byte[] bts = p1[0].getBytes(StandardCharsets.US_ASCII);
|
||||||
|
SHA1Digest dg = new SHA1Digest();
|
||||||
|
dg.update(bts, 0, bts.length);
|
||||||
|
byte[] f = new byte[20];
|
||||||
|
dg.doFinal(f, 0);
|
||||||
|
QueryConnectionImpl.confirmHash = SHA1Digest.hash2string(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
package net.md_5.bungee.eaglercraft;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* base implementation of MD4 family style digest as outlined in
|
||||||
|
* "Handbook of Applied Cryptography", pages 344 - 347.
|
||||||
|
*/
|
||||||
|
public abstract class GeneralDigest {
|
||||||
|
private byte[] xBuf;
|
||||||
|
private int xBufOff;
|
||||||
|
|
||||||
|
private long byteCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard constructor
|
||||||
|
*/
|
||||||
|
protected GeneralDigest()
|
||||||
|
{
|
||||||
|
xBuf = new byte[4];
|
||||||
|
xBufOff = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor. We are using copy constructors in place
|
||||||
|
* of the Object.clone() interface as this interface is not
|
||||||
|
* supported by J2ME.
|
||||||
|
*/
|
||||||
|
protected GeneralDigest(GeneralDigest t)
|
||||||
|
{
|
||||||
|
xBuf = new byte[t.xBuf.length];
|
||||||
|
System.arraycopy(t.xBuf, 0, xBuf, 0, t.xBuf.length);
|
||||||
|
|
||||||
|
xBufOff = t.xBufOff;
|
||||||
|
byteCount = t.byteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(
|
||||||
|
byte in)
|
||||||
|
{
|
||||||
|
xBuf[xBufOff++] = in;
|
||||||
|
|
||||||
|
if (xBufOff == xBuf.length)
|
||||||
|
{
|
||||||
|
processWord(xBuf, 0);
|
||||||
|
xBufOff = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
byteCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(
|
||||||
|
byte[] in,
|
||||||
|
int inOff,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// fill the current word
|
||||||
|
//
|
||||||
|
while ((xBufOff != 0) && (len > 0))
|
||||||
|
{
|
||||||
|
update(in[inOff]);
|
||||||
|
|
||||||
|
inOff++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// process whole words.
|
||||||
|
//
|
||||||
|
while (len > xBuf.length)
|
||||||
|
{
|
||||||
|
processWord(in, inOff);
|
||||||
|
|
||||||
|
inOff += xBuf.length;
|
||||||
|
len -= xBuf.length;
|
||||||
|
byteCount += xBuf.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// load in the remainder.
|
||||||
|
//
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
update(in[inOff]);
|
||||||
|
|
||||||
|
inOff++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finish()
|
||||||
|
{
|
||||||
|
long bitLength = (byteCount << 3);
|
||||||
|
|
||||||
|
//
|
||||||
|
// add the pad bytes.
|
||||||
|
//
|
||||||
|
update((byte)128);
|
||||||
|
|
||||||
|
while (xBufOff != 0)
|
||||||
|
{
|
||||||
|
update((byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
processLength(bitLength);
|
||||||
|
|
||||||
|
processBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
byteCount = 0;
|
||||||
|
|
||||||
|
xBufOff = 0;
|
||||||
|
for ( int i = 0; i < xBuf.length; i++ ) {
|
||||||
|
xBuf[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void processWord(byte[] in, int inOff);
|
||||||
|
|
||||||
|
protected abstract void processLength(long bitLength);
|
||||||
|
|
||||||
|
protected abstract void processBlock();
|
||||||
|
}
|
|
@ -20,6 +20,8 @@ public class QueryConnectionImpl implements QueryConnection {
|
||||||
protected long creationTime;
|
protected long creationTime;
|
||||||
protected boolean keepAlive = false;
|
protected boolean keepAlive = false;
|
||||||
|
|
||||||
|
public static String confirmHash = null;
|
||||||
|
|
||||||
public QueryConnectionImpl(ListenerInfo listener, InetAddress addr, WebSocket socket, String accept) {
|
public QueryConnectionImpl(ListenerInfo listener, InetAddress addr, WebSocket socket, String accept) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.addr = addr;
|
this.addr = addr;
|
||||||
|
|
|
@ -0,0 +1,270 @@
|
||||||
|
package net.md_5.bungee.eaglercraft;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349.
|
||||||
|
*
|
||||||
|
* It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5
|
||||||
|
* is the "endienness" of the word processing!
|
||||||
|
*/
|
||||||
|
public class SHA1Digest
|
||||||
|
extends GeneralDigest
|
||||||
|
{
|
||||||
|
private static final int DIGEST_LENGTH = 20;
|
||||||
|
|
||||||
|
private int H1, H2, H3, H4, H5;
|
||||||
|
|
||||||
|
private int[] X = new int[80];
|
||||||
|
private int xOff;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard constructor
|
||||||
|
*/
|
||||||
|
public SHA1Digest()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor. This will copy the state of the provided
|
||||||
|
* message digest.
|
||||||
|
*/
|
||||||
|
public SHA1Digest(SHA1Digest t)
|
||||||
|
{
|
||||||
|
super(t);
|
||||||
|
|
||||||
|
H1 = t.H1;
|
||||||
|
H2 = t.H2;
|
||||||
|
H3 = t.H3;
|
||||||
|
H4 = t.H4;
|
||||||
|
H5 = t.H5;
|
||||||
|
|
||||||
|
System.arraycopy(t.X, 0, X, 0, t.X.length);
|
||||||
|
xOff = t.xOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlgorithmName()
|
||||||
|
{
|
||||||
|
return "SHA-1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDigestSize()
|
||||||
|
{
|
||||||
|
return DIGEST_LENGTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void processWord(
|
||||||
|
byte[] in,
|
||||||
|
int inOff)
|
||||||
|
{
|
||||||
|
X[xOff++] = ((in[inOff] & 0xff) << 24) | ((in[inOff + 1] & 0xff) << 16)
|
||||||
|
| ((in[inOff + 2] & 0xff) << 8) | ((in[inOff + 3] & 0xff));
|
||||||
|
|
||||||
|
if (xOff == 16)
|
||||||
|
{
|
||||||
|
processBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unpackWord(
|
||||||
|
int word,
|
||||||
|
byte[] out,
|
||||||
|
int outOff)
|
||||||
|
{
|
||||||
|
out[outOff] = (byte)(word >>> 24);
|
||||||
|
out[outOff + 1] = (byte)(word >>> 16);
|
||||||
|
out[outOff + 2] = (byte)(word >>> 8);
|
||||||
|
out[outOff + 3] = (byte)word;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void processLength(
|
||||||
|
long bitLength)
|
||||||
|
{
|
||||||
|
if (xOff > 14)
|
||||||
|
{
|
||||||
|
processBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
X[14] = (int)(bitLength >>> 32);
|
||||||
|
X[15] = (int)(bitLength & 0xffffffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int doFinal(
|
||||||
|
byte[] out,
|
||||||
|
int outOff)
|
||||||
|
{
|
||||||
|
finish();
|
||||||
|
|
||||||
|
unpackWord(H1, out, outOff);
|
||||||
|
unpackWord(H2, out, outOff + 4);
|
||||||
|
unpackWord(H3, out, outOff + 8);
|
||||||
|
unpackWord(H4, out, outOff + 12);
|
||||||
|
unpackWord(H5, out, outOff + 16);
|
||||||
|
|
||||||
|
reset();
|
||||||
|
|
||||||
|
return DIGEST_LENGTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset the chaining variables
|
||||||
|
*/
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
super.reset();
|
||||||
|
|
||||||
|
H1 = 0x67452301;
|
||||||
|
H2 = 0xefcdab89;
|
||||||
|
H3 = 0x98badcfe;
|
||||||
|
H4 = 0x10325476;
|
||||||
|
H5 = 0xc3d2e1f0;
|
||||||
|
|
||||||
|
xOff = 0;
|
||||||
|
for (int i = 0; i != X.length; i++)
|
||||||
|
{
|
||||||
|
X[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Additive constants
|
||||||
|
//
|
||||||
|
private static final int Y1 = 0x5a827999;
|
||||||
|
private static final int Y2 = 0x6ed9eba1;
|
||||||
|
private static final int Y3 = 0x8f1bbcdc;
|
||||||
|
private static final int Y4 = 0xca62c1d6;
|
||||||
|
|
||||||
|
private int f(
|
||||||
|
int u,
|
||||||
|
int v,
|
||||||
|
int w)
|
||||||
|
{
|
||||||
|
return ((u & v) | ((~u) & w));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int h(
|
||||||
|
int u,
|
||||||
|
int v,
|
||||||
|
int w)
|
||||||
|
{
|
||||||
|
return (u ^ v ^ w);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int g(
|
||||||
|
int u,
|
||||||
|
int v,
|
||||||
|
int w)
|
||||||
|
{
|
||||||
|
return ((u & v) | (u & w) | (v & w));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int rotateLeft(
|
||||||
|
int x,
|
||||||
|
int n)
|
||||||
|
{
|
||||||
|
return (x << n) | (x >>> (32 - n));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void processBlock()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// expand 16 word block into 80 word block.
|
||||||
|
//
|
||||||
|
for (int i = 16; i <= 79; i++)
|
||||||
|
{
|
||||||
|
X[i] = rotateLeft((X[i - 3] ^ X[i - 8] ^ X[i - 14] ^ X[i - 16]), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// set up working variables.
|
||||||
|
//
|
||||||
|
int A = H1;
|
||||||
|
int B = H2;
|
||||||
|
int C = H3;
|
||||||
|
int D = H4;
|
||||||
|
int E = H5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// round 1
|
||||||
|
//
|
||||||
|
for (int j = 0; j <= 19; j++)
|
||||||
|
{
|
||||||
|
int t = rotateLeft(A, 5) + f(B, C, D) + E + X[j] + Y1;
|
||||||
|
|
||||||
|
E = D;
|
||||||
|
D = C;
|
||||||
|
C = rotateLeft(B, 30);
|
||||||
|
B = A;
|
||||||
|
A = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// round 2
|
||||||
|
//
|
||||||
|
for (int j = 20; j <= 39; j++)
|
||||||
|
{
|
||||||
|
int t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y2;
|
||||||
|
|
||||||
|
E = D;
|
||||||
|
D = C;
|
||||||
|
C = rotateLeft(B, 30);
|
||||||
|
B = A;
|
||||||
|
A = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// round 3
|
||||||
|
//
|
||||||
|
for (int j = 40; j <= 59; j++)
|
||||||
|
{
|
||||||
|
int t = rotateLeft(A, 5) + g(B, C, D) + E + X[j] + Y3;
|
||||||
|
|
||||||
|
E = D;
|
||||||
|
D = C;
|
||||||
|
C = rotateLeft(B, 30);
|
||||||
|
B = A;
|
||||||
|
A = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// round 4
|
||||||
|
//
|
||||||
|
for (int j = 60; j <= 79; j++)
|
||||||
|
{
|
||||||
|
int t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y4;
|
||||||
|
|
||||||
|
E = D;
|
||||||
|
D = C;
|
||||||
|
C = rotateLeft(B, 30);
|
||||||
|
B = A;
|
||||||
|
A = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
H1 += A;
|
||||||
|
H2 += B;
|
||||||
|
H3 += C;
|
||||||
|
H4 += D;
|
||||||
|
H5 += E;
|
||||||
|
|
||||||
|
//
|
||||||
|
// reset the offset and clean out the word buffer.
|
||||||
|
//
|
||||||
|
xOff = 0;
|
||||||
|
for (int i = 0; i != X.length; i++)
|
||||||
|
{
|
||||||
|
X[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String hex = "0123456789abcdef";
|
||||||
|
|
||||||
|
public static String hash2string(byte[] b) {
|
||||||
|
char[] ret = new char[b.length * 2];
|
||||||
|
for(int i = 0; i < b.length; ++i) {
|
||||||
|
int bb = (int)b[i] & 0xFF;
|
||||||
|
ret[i * 2] = hex.charAt((bb >> 4) & 0xF);
|
||||||
|
ret[i * 2 + 1] = hex.charAt(bb & 0xF);
|
||||||
|
}
|
||||||
|
return new String(ret);
|
||||||
|
}
|
||||||
|
}
|
|
@ -95,9 +95,9 @@ public class WebSocketListener extends WebSocketServer {
|
||||||
if(o instanceof PendingSocket) {
|
if(o instanceof PendingSocket) {
|
||||||
InetAddress realAddr = ((PendingSocket)o).realAddress;
|
InetAddress realAddr = ((PendingSocket)o).realAddress;
|
||||||
arg1 = arg1.trim().toLowerCase();
|
arg1 = arg1.trim().toLowerCase();
|
||||||
|
QueryConnectionImpl con;
|
||||||
if(arg1.startsWith("accept:")) {
|
if(arg1.startsWith("accept:")) {
|
||||||
arg1 = arg1.substring(7).trim();
|
arg1 = arg1.substring(7).trim();
|
||||||
QueryConnectionImpl con;
|
|
||||||
WebsocketQueryEvent evt;
|
WebsocketQueryEvent evt;
|
||||||
if(arg1.startsWith("motd")) {
|
if(arg1.startsWith("motd")) {
|
||||||
if(info.isAllowMOTD()) {
|
if(info.isAllowMOTD()) {
|
||||||
|
@ -121,7 +121,12 @@ public class WebSocketListener extends WebSocketServer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(info.isAllowQuery()) {
|
if(QueryConnectionImpl.confirmHash != null && arg1.equalsIgnoreCase(QueryConnectionImpl.confirmHash)) {
|
||||||
|
QueryConnectionImpl.confirmHash = null;
|
||||||
|
arg0.send("OK");
|
||||||
|
arg0.close();
|
||||||
|
return;
|
||||||
|
}else if(info.isAllowQuery()) {
|
||||||
if(ratelimitQuery != null && !BanList.isBlockedBan(realAddr)) {
|
if(ratelimitQuery != null && !BanList.isBlockedBan(realAddr)) {
|
||||||
RateLimit l = ratelimitQuery.rateLimit(realAddr);
|
RateLimit l = ratelimitQuery.rateLimit(realAddr);
|
||||||
if(l.blocked()) {
|
if(l.blocked()) {
|
||||||
|
|
47996
javascript/classes.js
47996
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
232
samples/ayunami2000/MapPacketCodec.java
Normal file
232
samples/ayunami2000/MapPacketCodec.java
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
package ayunami2000;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.zip.Deflater;
|
||||||
|
import java.util.zip.DeflaterOutputStream;
|
||||||
|
|
||||||
|
public class MapPacketCodec {
|
||||||
|
|
||||||
|
public interface FragmentHandler {
|
||||||
|
void sendFragment(byte[] data, boolean isLastFragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PixelFormat {
|
||||||
|
R5_G6_B5, R8_G8_B8
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int mapId;
|
||||||
|
private Deflater deflate = null;
|
||||||
|
private PixelFormat pixelFormat = PixelFormat.R5_G6_B5;
|
||||||
|
private int[] pixels = null;
|
||||||
|
private int[] pallete = null;
|
||||||
|
private boolean palleteIsSet = false;
|
||||||
|
private boolean palleteIsDirty = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mapId the ID of the map item to write to
|
||||||
|
*/
|
||||||
|
public MapPacketCodec(int mapId) {
|
||||||
|
this.mapId = mapId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param enable enables java.util.zip deflate on packets encoded by this class
|
||||||
|
*/
|
||||||
|
public MapPacketCodec deflate(boolean enable) {
|
||||||
|
deflate(enable ? 5 : 0);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param level sets or disables compression level (0-9)
|
||||||
|
*/
|
||||||
|
public MapPacketCodec deflate(int level) {
|
||||||
|
deflate = level > 0 ? new Deflater(level) : null;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pix sets if pixels should be encoded as 16 bits per pixel or 24 bits per pixel
|
||||||
|
*/
|
||||||
|
public MapPacketCodec pixelFormat(PixelFormat pix) {
|
||||||
|
pixelFormat = pix == null ? PixelFormat.R5_G6_B5 : pix;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pixels If pallete is disabled, array of 16384 integers each containing the RGB of a pixel. If
|
||||||
|
* pallete is enabled, array of 16384 integers each containing an index in the current pallete between 0 and 255
|
||||||
|
*/
|
||||||
|
public MapPacketCodec setPixels(int[] pixels) {
|
||||||
|
if(pixels != null && pixels.length != 16384) {
|
||||||
|
throw new IllegalArgumentException("Pixel array must be 16384 pixels long");
|
||||||
|
}
|
||||||
|
this.pixels = pixels;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pixels a 128x128 RGB java.awt.image.BufferedImage, this will disable the pallete
|
||||||
|
*/
|
||||||
|
public MapPacketCodec setPixels(BufferedImage pixels) {
|
||||||
|
if(pixels.getWidth() != 128 || pixels.getHeight() != 128) {
|
||||||
|
throw new IllegalArgumentException("BufferedImage must be 128x128 pixels");
|
||||||
|
}
|
||||||
|
palleteIsSet = false;
|
||||||
|
this.pallete = null;
|
||||||
|
palleteIsDirty = false;
|
||||||
|
int[] pxls = new int[16384];
|
||||||
|
pixels.getRGB(0, 0, 128, 128, pxls, 0, 128);
|
||||||
|
setPixels(pxls);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets and enables the pallete, or disables it if 'pallete' is null
|
||||||
|
*
|
||||||
|
* @param pallete an array of any size between 1 and 256 containing integers each representing a single RGB color
|
||||||
|
*/
|
||||||
|
public MapPacketCodec setPallete(int[] pallete) {
|
||||||
|
boolean b = pallete != null;
|
||||||
|
if(b) {
|
||||||
|
palleteIsSet = true;
|
||||||
|
this.pallete = pallete;
|
||||||
|
palleteIsDirty = true;
|
||||||
|
}else {
|
||||||
|
if(pixels != null && this.pallete != null) {
|
||||||
|
int[] px = pixels;
|
||||||
|
pixels = new int[16384];
|
||||||
|
for(int i = 0; i < 16384; ++i) {
|
||||||
|
int j = px[i];
|
||||||
|
pixels[i] = this.pallete[j >= this.pallete.length ? 0 : j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.pallete = null;
|
||||||
|
palleteIsSet = false;
|
||||||
|
palleteIsDirty = false;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the pallete
|
||||||
|
*/
|
||||||
|
public MapPacketCodec clearPallete() {
|
||||||
|
setPallete(null);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Operations:
|
||||||
|
*
|
||||||
|
* - 0: disable engine
|
||||||
|
* - 1: compressed data
|
||||||
|
*
|
||||||
|
* - 2: set pixels R8_G8_B8
|
||||||
|
* - 3: set pixels R5_G6_B5
|
||||||
|
* - 4: set pallete R8_G8_B8
|
||||||
|
* - 5: set pallete R5_G6_B5
|
||||||
|
* - 6: set pixels via pallete
|
||||||
|
* - 7: set pallete and pixels R8_G8_B8
|
||||||
|
* - 8: set pallete and pixels R5_G6_B5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* takes the current pixels array and writes it to a packet and returns it, or returns null if the current pixels array has not changed
|
||||||
|
*/
|
||||||
|
public byte[] getNextPacket() {
|
||||||
|
if(pixels == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ByteArrayOutputStream o = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream s;
|
||||||
|
if(deflate != null) {
|
||||||
|
o.write(1);
|
||||||
|
s = new DataOutputStream(new DeflaterOutputStream(o, deflate));
|
||||||
|
}else {
|
||||||
|
s = new DataOutputStream(o);
|
||||||
|
}
|
||||||
|
if(!palleteIsSet || pallete == null) {
|
||||||
|
palleteIsSet = false;
|
||||||
|
if(pixelFormat == PixelFormat.R5_G6_B5) {
|
||||||
|
s.write(3);
|
||||||
|
for(int i = 0; i < 16384; ++i) {
|
||||||
|
int j = pixels[i];
|
||||||
|
int r = (j >> 19) & 0x1F;
|
||||||
|
int g = (j >> 10) & 0x3F;
|
||||||
|
int b = (j >> 3) & 0x1F;
|
||||||
|
s.writeShort((r << 11) | (g << 5) | b);
|
||||||
|
}
|
||||||
|
}else if(pixelFormat == PixelFormat.R8_G8_B8) {
|
||||||
|
s.write(2);
|
||||||
|
for(int i = 0; i < 16384; ++i) {
|
||||||
|
int j = pixels[i];
|
||||||
|
s.write((j >> 16) & 0xFF);
|
||||||
|
s.write((j >> 8) & 0xFF);
|
||||||
|
s.write(j & 0xFF);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return null; // ?
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(palleteIsDirty) {
|
||||||
|
if(pixelFormat == PixelFormat.R5_G6_B5) {
|
||||||
|
s.write(8);
|
||||||
|
s.write(pallete.length);
|
||||||
|
for(int i = 0; i < pallete.length; ++i) {
|
||||||
|
int j = pallete[i];
|
||||||
|
int r = (j >> 19) & 0x1F;
|
||||||
|
int g = (j >> 10) & 0x3F;
|
||||||
|
int b = (j >> 3) & 0x1F;
|
||||||
|
s.writeShort((r << 11) | (g << 5) | b);
|
||||||
|
}
|
||||||
|
}else if(pixelFormat == PixelFormat.R8_G8_B8) {
|
||||||
|
s.write(7);
|
||||||
|
s.write(pallete.length);
|
||||||
|
for(int i = 0; i < pallete.length; ++i) {
|
||||||
|
int j = pallete[i];
|
||||||
|
s.write((j >> 16) & 0xFF);
|
||||||
|
s.write((j >> 8) & 0xFF);
|
||||||
|
s.write(j & 0xFF);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return null; // ?
|
||||||
|
}
|
||||||
|
palleteIsDirty = false;
|
||||||
|
}else {
|
||||||
|
s.write(6);
|
||||||
|
}
|
||||||
|
for(int i = 0; i < 16384; ++i) {
|
||||||
|
s.write(pixels[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pixels = null;
|
||||||
|
s.close();
|
||||||
|
return o.toByteArray();
|
||||||
|
}catch(IOException e) {
|
||||||
|
throw new RuntimeException("Failed to write ayunami map packet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getDisablePacket() {
|
||||||
|
try {
|
||||||
|
palleteIsSet = false;
|
||||||
|
palleteIsDirty = false;
|
||||||
|
pallete = null;
|
||||||
|
pixels = null;
|
||||||
|
ByteArrayOutputStream o = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream s = new DataOutputStream(o);
|
||||||
|
s.writeShort(mapId);
|
||||||
|
s.write(0);
|
||||||
|
return o.toByteArray();
|
||||||
|
}catch(IOException e) {
|
||||||
|
throw new RuntimeException("Failed to write ayunami map packet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
samples/ayunami2000/MapPacketCodecBukkit.java
Normal file
76
samples/ayunami2000/MapPacketCodecBukkit.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
package ayunami2000;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_5_R3.Packet;
|
||||||
|
import net.minecraft.server.v1_5_R3.Packet131ItemData;
|
||||||
|
|
||||||
|
public class MapPacketCodecBukkit extends MapPacketCodec {
|
||||||
|
|
||||||
|
public MapPacketCodecBukkit(int mapId) {
|
||||||
|
super(mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getNextBukkitPacket() {
|
||||||
|
byte[] pkt = getNextPacket();
|
||||||
|
if(pkt == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Packet131ItemData((short)103, (short)mapId, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getDisableBukkitPacket() {
|
||||||
|
byte[] pkt = getDisablePacket();
|
||||||
|
if(pkt == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Packet131ItemData((short)103, (short)mapId, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendNextPacketToPlayer(Player p) {
|
||||||
|
nativeSendPacketToPlayer(p, getNextBukkitPacket());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendDisablePacketToPlayer(Player p) {
|
||||||
|
nativeSendPacketToPlayer(p, getDisableBukkitPacket());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendNextPacketToPlayers(Player... p) {
|
||||||
|
Object pkt = getNextBukkitPacket();
|
||||||
|
for(Player pl : p) {
|
||||||
|
nativeSendPacketToPlayer(pl, pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendDisablePacketToPlayers(Player... p) {
|
||||||
|
Object pkt = getDisableBukkitPacket();
|
||||||
|
for(Player pl : p) {
|
||||||
|
nativeSendPacketToPlayer(pl, pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendNextPacketToPlayers(List<Player> p) {
|
||||||
|
Object pkt = getNextBukkitPacket();
|
||||||
|
for(Player pl : p) {
|
||||||
|
nativeSendPacketToPlayer(pl, pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendDisablePacketToPlayers(List<Player> p) {
|
||||||
|
Object pkt = getDisableBukkitPacket();
|
||||||
|
for(Player pl : p) {
|
||||||
|
nativeSendPacketToPlayer(pl, pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void nativeSendPacketToPlayer(Player player, Object obj) {
|
||||||
|
if(obj == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
((CraftPlayer)player).getHandle().playerConnection.sendPacket((Packet)obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
samples/plugin.yml
Normal file
11
samples/plugin.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
name: EaglerSamplesPlugin
|
||||||
|
main: plugin.EaglerSamplesPlugin
|
||||||
|
version: 1.0
|
||||||
|
author: lax1dude
|
||||||
|
description: eagler
|
||||||
|
depend: []
|
||||||
|
commands:
|
||||||
|
samplemap:
|
||||||
|
description: test ayunami map system
|
||||||
|
usage: /samplemap <get|disable|set> [mapid] [image file] [16bpp|24bpp] [compress]
|
||||||
|
permission: eaglersamples.samplemap
|
116
samples/plugin/CommandSampleMap.java
Normal file
116
samples/plugin/CommandSampleMap.java
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
package plugin;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import ayunami2000.MapPacketCodec.PixelFormat;
|
||||||
|
import ayunami2000.MapPacketCodecBukkit;
|
||||||
|
|
||||||
|
public class CommandSampleMap implements CommandExecutor {
|
||||||
|
|
||||||
|
public final EaglerSamplesPlugin plugin;
|
||||||
|
|
||||||
|
public CommandSampleMap(EaglerSamplesPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender arg0, Command arg01, String arg1, String[] arg2) {
|
||||||
|
if(!(arg0 instanceof Player)) {
|
||||||
|
arg0.sendMessage(ChatColor.RED + "Internal Error: " + ChatColor.WHITE + "CommmandSender must be a Player");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
arg0.sendMessage(ChatColor.YELLOW + "Note: test packets are only sent to the player running this command");
|
||||||
|
Player p = (Player)arg0;
|
||||||
|
try {
|
||||||
|
int mapId = -1;
|
||||||
|
if(arg2.length >= 2) {
|
||||||
|
mapId = Integer.parseInt(arg2[1]);
|
||||||
|
}else {
|
||||||
|
ItemStack i = p.getInventory().getItemInHand();
|
||||||
|
if(i.getType() == Material.MAP) {
|
||||||
|
mapId = (int)i.getDurability() & 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mapId != -1) {
|
||||||
|
if(arg2.length == 1) {
|
||||||
|
if(arg2[0].equalsIgnoreCase("get")) {
|
||||||
|
arg0.sendMessage(ChatColor.GREEN + "Current map ID: " + ChatColor.WHITE + mapId);
|
||||||
|
return true;
|
||||||
|
}else if(arg2[0].equalsIgnoreCase("disable")) {
|
||||||
|
MapPacketCodecBukkit pkt = new MapPacketCodecBukkit(mapId);
|
||||||
|
pkt.sendDisablePacketToPlayer(p);
|
||||||
|
arg0.sendMessage(ChatColor.GREEN + "Reset map: " + ChatColor.WHITE + mapId);
|
||||||
|
return true;
|
||||||
|
}else if(arg2[0].equalsIgnoreCase("set")) {
|
||||||
|
arg0.sendMessage(ChatColor.RED + "Use: " + ChatColor.WHITE + "/samplemap set <file> [compress]");
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
MapPacketCodecBukkit pkt = new MapPacketCodecBukkit(mapId);
|
||||||
|
BufferedImage img = ImageIO.read(new File(arg2[0]));
|
||||||
|
pkt.setPixels(img);
|
||||||
|
pkt.sendNextPacketToPlayer(p);
|
||||||
|
arg0.sendMessage(ChatColor.GREEN + "Wrote image " + ChatColor.WHITE + arg2[0] + ChatColor.GREEN + " to map " + ChatColor.WHITE + mapId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}else if(arg2.length == 2) {
|
||||||
|
int j = Integer.parseInt(arg2[1]);
|
||||||
|
if(arg2[0].equalsIgnoreCase("disable")) {
|
||||||
|
MapPacketCodecBukkit pkt = new MapPacketCodecBukkit(j);
|
||||||
|
pkt.sendDisablePacketToPlayer(p);
|
||||||
|
arg0.sendMessage(ChatColor.GREEN + "Reset map: " + ChatColor.WHITE + j);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}else if(arg2.length >= 3) {
|
||||||
|
int j = Integer.parseInt(arg2[1]);
|
||||||
|
MapPacketCodecBukkit pkt = new MapPacketCodecBukkit(j);
|
||||||
|
BufferedImage img = ImageIO.read(new File(arg2[2]));
|
||||||
|
if(arg2.length == 4 || arg2.length == 5) {
|
||||||
|
if(arg2[3].equalsIgnoreCase("16bpp")) {
|
||||||
|
pkt.pixelFormat(PixelFormat.R5_G6_B5);
|
||||||
|
if(arg2.length == 5) {
|
||||||
|
if(arg2[4].equalsIgnoreCase("true")) {
|
||||||
|
pkt.deflate(true);
|
||||||
|
}else {
|
||||||
|
pkt.deflate(Integer.parseInt(arg2[4]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(arg2[3].equalsIgnoreCase("24bpp")) {
|
||||||
|
pkt.pixelFormat(PixelFormat.R8_G8_B8);
|
||||||
|
if(arg2.length == 5) {
|
||||||
|
if(arg2[4].equalsIgnoreCase("true")) {
|
||||||
|
pkt.deflate(true);
|
||||||
|
}else {
|
||||||
|
pkt.deflate(Integer.parseInt(arg2[4]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(arg2[3].equalsIgnoreCase("true")) {
|
||||||
|
pkt.deflate(true);
|
||||||
|
}else {
|
||||||
|
pkt.deflate(Integer.parseInt(arg2[3]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pkt.setPixels(img);
|
||||||
|
pkt.sendNextPacketToPlayer(p);
|
||||||
|
arg0.sendMessage(ChatColor.GREEN + "Wrote image " + ChatColor.WHITE + arg2[2] + ChatColor.GREEN + " to map " + ChatColor.WHITE + mapId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Throwable t) {
|
||||||
|
arg0.sendMessage(ChatColor.RED + "Internal Error: " + ChatColor.WHITE + t.toString());
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
14
samples/plugin/EaglerSamplesPlugin.java
Normal file
14
samples/plugin/EaglerSamplesPlugin.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package plugin;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class EaglerSamplesPlugin extends JavaPlugin {
|
||||||
|
|
||||||
|
public void onEnable() {
|
||||||
|
getCommand("samplemap").setExecutor(new CommandSampleMap(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
samples/readme.txt
Normal file
1
samples/readme.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
These are sample source files to assist the process of integrating Eaglercraft into other projects, or to assist the process of integrating other projects into Eaglercraft
|
|
@ -213,7 +213,7 @@ public class EaglerAdapterImpl2 {
|
||||||
public static final int _wGL_SRC_COLOR = GL11.GL_SRC_COLOR;
|
public static final int _wGL_SRC_COLOR = GL11.GL_SRC_COLOR;
|
||||||
public static final int _wGL_ONE = GL11.GL_ONE;
|
public static final int _wGL_ONE = GL11.GL_ONE;
|
||||||
public static final int _wGL_NEAREST = GL11.GL_NEAREST;
|
public static final int _wGL_NEAREST = GL11.GL_NEAREST;
|
||||||
public static final int _wGL_CLAMP = GL11.GL_REPEAT;
|
public static final int _wGL_CLAMP = GL12.GL_CLAMP_TO_EDGE;
|
||||||
public static final int _wGL_TEXTURE_WRAP_S = GL11.GL_TEXTURE_WRAP_S;
|
public static final int _wGL_TEXTURE_WRAP_S = GL11.GL_TEXTURE_WRAP_S;
|
||||||
public static final int _wGL_TEXTURE_WRAP_T = GL11.GL_TEXTURE_WRAP_T;
|
public static final int _wGL_TEXTURE_WRAP_T = GL11.GL_TEXTURE_WRAP_T;
|
||||||
public static final int _wGL_TEXTURE_MAX_LEVEL = GL12.GL_TEXTURE_MAX_LEVEL;
|
public static final int _wGL_TEXTURE_MAX_LEVEL = GL12.GL_TEXTURE_MAX_LEVEL;
|
||||||
|
@ -936,7 +936,7 @@ public class EaglerAdapterImpl2 {
|
||||||
}else {
|
}else {
|
||||||
rateLimitStatus = RateLimit.FAILED;
|
rateLimitStatus = RateLimit.FAILED;
|
||||||
}
|
}
|
||||||
}else if(!socketIsAlive) {
|
}else if(!socketIsAlive && (blockedAddresses.contains(serverUriString) || rateLimitedAddresses.contains(serverUriString))) {
|
||||||
rateLimitStatus = RateLimit.LOCKED;
|
rateLimitStatus = RateLimit.LOCKED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ public class ConfigConstants {
|
||||||
|
|
||||||
public static boolean profanity = false;
|
public static boolean profanity = false;
|
||||||
|
|
||||||
public static final String version = "22w14b";
|
public static final String version = "22w15d";
|
||||||
public static final String mainMenuString = "ayuncraft " + version;
|
public static final String mainMenuString = "ayuncraft " + version;
|
||||||
|
|
||||||
public static final String forkMe = "https://github.com/ayunami2000/ayuncraft";
|
public static final String forkMe = "https://github.com/ayunami2000/ayuncraft";
|
||||||
|
|
|
@ -54,10 +54,10 @@ public class TextureTerrainMap implements IconRegister {
|
||||||
this.maxV = (float)(originY + 48) / (float)map.height;
|
this.maxV = (float)(originY + 48) / (float)map.height;
|
||||||
this.originX_center = originX + 16;
|
this.originX_center = originX + 16;
|
||||||
this.originY_center = originY + 16;
|
this.originY_center = originY + 16;
|
||||||
this.minU_center = (float)originX_center / (float)map.width;
|
this.minU_center = (float)(originX_center + 0.1f) / (float)map.width;
|
||||||
this.minV_center = (float)originY_center / (float)map.height;
|
this.minV_center = (float)(originY_center + 0.1f) / (float)map.height;
|
||||||
this.maxU_center = (float)(originX_center + 16) / (float)map.width;
|
this.maxU_center = (float)(originX_center + 16 - 0.1f) / (float)map.width;
|
||||||
this.maxV_center = (float)(originY_center + 16) / (float)map.height;
|
this.maxV_center = (float)(originY_center + 16 - 0.1f) / (float)map.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class Minecraft implements Runnable {
|
||||||
|
|
||||||
String s = EaglerAdapter.getServerToJoinOnLaunch();
|
String s = EaglerAdapter.getServerToJoinOnLaunch();
|
||||||
if(s != null) {
|
if(s != null) {
|
||||||
this.displayGuiScreen(new GuiScreenEditProfile(new GuiConnecting(new GuiMainMenu(), this, new ServerData("Eaglercraft Server", s))));
|
this.displayGuiScreen(new GuiScreenEditProfile(new GuiConnecting(new GuiMainMenu(), this, new ServerData("Eaglercraft Server", s, false))));
|
||||||
}else {
|
}else {
|
||||||
this.displayGuiScreen(new GuiScreenEditProfile(new GuiMainMenu()));
|
this.displayGuiScreen(new GuiScreenEditProfile(new GuiMainMenu()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,10 +142,11 @@ public class EntityFX extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
|
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||||
float var8 = (float) this.particleTextureIndexX / 16.0F;
|
float fix = 0.001f;
|
||||||
float var9 = var8 + 0.0624375F;
|
float var8 = (float) this.particleTextureIndexX / 16.0F + fix;
|
||||||
float var10 = (float) this.particleTextureIndexY / 16.0F;
|
float var9 = var8 + 0.0624375F - fix;
|
||||||
float var11 = var10 + 0.0624375F;
|
float var10 = (float) this.particleTextureIndexY / 16.0F + fix;
|
||||||
|
float var11 = var10 + 0.0624375F - fix;
|
||||||
float var12 = 0.1F * this.particleScale;
|
float var12 = 0.1F * this.particleScale;
|
||||||
|
|
||||||
if (this.particleIcon != null) {
|
if (this.particleIcon != null) {
|
||||||
|
|
|
@ -191,12 +191,12 @@ public class FontRenderer {
|
||||||
float var3 = (float) (par1 % 16 * 8);
|
float var3 = (float) (par1 % 16 * 8);
|
||||||
float var4 = (float) (par1 / 16 * 8);
|
float var4 = (float) (par1 / 16 * 8);
|
||||||
float var5 = par2 ? 1.0F : 0.0F;
|
float var5 = par2 ? 1.0F : 0.0F;
|
||||||
float var6 = (float) this.charWidth[par1] - 0.02F;
|
float var6 = (float) this.charWidth[par1] - 0.2F;
|
||||||
Tessellator t = Tessellator.instance;
|
Tessellator t = Tessellator.instance;
|
||||||
t.addVertexWithUV(this.posX + 0.02F + var5, this.posY + 0.02F, 0.0F, (var3 + 0.02F) / 128.0F, (var4 + 0.02F) / 128.0F);
|
t.addVertexWithUV(this.posX + 0.05F + var5, this.posY + 0.05F, 0.0F, (var3 + 0.1F) / 128.0F, (var4 + 0.1F) / 128.0F);
|
||||||
t.addVertexWithUV(this.posX + 0.02F - var5, this.posY + 7.98F, 0.0F, (var3 + 0.02F) / 128.0F, (var4 + 7.98F) / 128.0F);
|
t.addVertexWithUV(this.posX + 0.05F - var5, this.posY + 7.95F, 0.0F, (var3 + 0.1F) / 128.0F, (var4 + 7.8F) / 128.0F);
|
||||||
t.addVertexWithUV(this.posX + var6 - var5, this.posY + 7.98F, 0.0F, (var3 + var6) / 128.0F, (var4 + 7.98F) / 128.0F);
|
t.addVertexWithUV(this.posX + var6 - var5, this.posY + 7.95F, 0.0F, (var3 + var6) / 128.0F, (var4 + 7.8F) / 128.0F);
|
||||||
t.addVertexWithUV(this.posX + var6 + var5, this.posY + 0.02F, 0.0F, (var3 + var6) / 128.0F, (var4 + 0.02F) / 128.0F);
|
t.addVertexWithUV(this.posX + var6 + var5, this.posY + 0.05F, 0.0F, (var3 + var6) / 128.0F, (var4 + 0.1F) / 128.0F);
|
||||||
return (float) this.charWidth[par1];
|
return (float) this.charWidth[par1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,14 +174,14 @@ public class GuiMultiplayer extends GuiScreen {
|
||||||
this.joinServer(this.selectedServer);
|
this.joinServer(this.selectedServer);
|
||||||
} else if (par1GuiButton.id == 4) {
|
} else if (par1GuiButton.id == 4) {
|
||||||
this.directClicked = true;
|
this.directClicked = true;
|
||||||
this.mc.displayGuiScreen(new GuiScreenServerList(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "")));
|
this.mc.displayGuiScreen(new GuiScreenServerList(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "", false)));
|
||||||
} else if (par1GuiButton.id == 3) {
|
} else if (par1GuiButton.id == 3) {
|
||||||
this.addClicked = true;
|
this.addClicked = true;
|
||||||
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "")));
|
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "", false)));
|
||||||
} else if (par1GuiButton.id == 7) {
|
} else if (par1GuiButton.id == 7) {
|
||||||
this.editClicked = true;
|
this.editClicked = true;
|
||||||
ServerData var9 = this.internetServerList.getServerData(this.selectedServer);
|
ServerData var9 = this.internetServerList.getServerData(this.selectedServer);
|
||||||
this.theServerData = new ServerData(var9.serverName, var9.serverIP);
|
this.theServerData = new ServerData(var9.serverName, var9.serverIP, false);
|
||||||
this.theServerData.setHideAddress(var9.isHidingAddress());
|
this.theServerData.setHideAddress(var9.isHidingAddress());
|
||||||
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData));
|
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData));
|
||||||
} else if (par1GuiButton.id == 0) {
|
} else if (par1GuiButton.id == 0) {
|
||||||
|
@ -255,7 +255,7 @@ public class GuiMultiplayer extends GuiScreen {
|
||||||
this.mc.gameSettings.saveOptions();
|
this.mc.gameSettings.saveOptions();
|
||||||
} else {
|
} else {
|
||||||
if (isShiftKeyDown() && par2 == 200) {
|
if (isShiftKeyDown() && par2 == 200) {
|
||||||
if (var3 > 0 && var3 < this.internetServerList.countServers()) {
|
if (var3 > ServerList.forcedServers.size() && var3 < this.internetServerList.countServers()) {
|
||||||
this.internetServerList.swapServers(var3, var3 - 1);
|
this.internetServerList.swapServers(var3, var3 - 1);
|
||||||
--this.selectedServer;
|
--this.selectedServer;
|
||||||
|
|
||||||
|
@ -361,6 +361,10 @@ public class GuiMultiplayer extends GuiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getSelectedServer(GuiMultiplayer par0GuiMultiplayer) {
|
static int getSelectedServer(GuiMultiplayer par0GuiMultiplayer) {
|
||||||
|
int i = internetServerList.countServers();
|
||||||
|
if(par0GuiMultiplayer.selectedServer >= i && par0GuiMultiplayer.selectedServer > 0) {
|
||||||
|
par0GuiMultiplayer.selectedServer = i - 1;
|
||||||
|
}
|
||||||
return par0GuiMultiplayer.selectedServer;
|
return par0GuiMultiplayer.selectedServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class GuiSlotServer extends GuiSlot {
|
||||||
|
|
||||||
if (par2 && var5) {
|
if (par2 && var5) {
|
||||||
GuiMultiplayer.func_74008_b(this.parentGui, par1);
|
GuiMultiplayer.func_74008_b(this.parentGui, par1);
|
||||||
} else if (var6 && GuiScreen.isShiftKeyDown() && var3 >= 0 && var3 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers()) {
|
} else if (var6 && GuiScreen.isShiftKeyDown() && var3 > ServerList.forcedServers.size() && var3 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers()) {
|
||||||
GuiMultiplayer.getInternetServerList(this.parentGui).swapServers(var3, GuiMultiplayer.getSelectedServer(this.parentGui));
|
GuiMultiplayer.getInternetServerList(this.parentGui).swapServers(var3, GuiMultiplayer.getSelectedServer(this.parentGui));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ItemMap extends ItemMapBase {
|
public class ItemMap extends ItemMapBase {
|
||||||
protected ItemMap(int par1) {
|
protected ItemMap(int par1) {
|
||||||
super(par1);
|
super(par1);
|
||||||
|
@ -256,4 +256,21 @@ public class ItemMap extends ItemMapBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void readAyunamiMapPacket(WorldClient theWorld, short mapId, byte[] data) {
|
||||||
|
try {
|
||||||
|
String var2 = "map_" + mapId;
|
||||||
|
MapData var3 = (MapData) theWorld.loadItemData(MapData.class, var2);
|
||||||
|
|
||||||
|
if (var3 == null) {
|
||||||
|
var3 = new MapData(var2);
|
||||||
|
theWorld.setItemData(var2, var3);
|
||||||
|
}
|
||||||
|
|
||||||
|
var3.readAyunamiMapPacket(new ByteArrayInputStream(data));
|
||||||
|
}catch(IOException e) {
|
||||||
|
System.err.println("Failed to read AyunamiMap packet! " + e.toString());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,9 +108,9 @@ public class ItemRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
|
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
|
||||||
}
|
|
||||||
|
|
||||||
EaglerAdapter.flipLightMatrix();
|
EaglerAdapter.flipLightMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
EaglerAdapter.glPopMatrix();
|
EaglerAdapter.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.jcraft.jzlib.InflaterInputStream;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class MapData extends WorldSavedData {
|
public class MapData extends WorldSavedData {
|
||||||
|
@ -240,4 +246,130 @@ public class MapData extends WorldSavedData {
|
||||||
|
|
||||||
return var2;
|
return var2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean enableAyunami = false;
|
||||||
|
public int[] ayunamiPixels = null;
|
||||||
|
private int[] ayunamiPallete = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operations:
|
||||||
|
*
|
||||||
|
* - 0: disable engine
|
||||||
|
* - 1: compressed data
|
||||||
|
*
|
||||||
|
* - 2: set pixels R8_G8_B8
|
||||||
|
* - 3: set pixels R5_G6_B5
|
||||||
|
* - 4: set pallete R8_G8_B8
|
||||||
|
* - 5: set pallete R5_G6_B5
|
||||||
|
* - 6: set pixels via pallete
|
||||||
|
* - 7: set pallete and pixels R8_G8_B8
|
||||||
|
* - 8: set pallete and pixels R5_G6_B5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void readAyunamiMapPacket(InputStream dat) throws IOException {
|
||||||
|
int operation = dat.read();
|
||||||
|
DataInputStream ddat;
|
||||||
|
switch(operation) {
|
||||||
|
case 0:
|
||||||
|
ayunamiDisable();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
readAyunamiMapPacket(new InflaterInputStream(dat));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ayunamiSetPixels_R8_G8_B8(new DataInputStream(dat));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ayunamiSetPixels_R5_G6_B5(new DataInputStream(dat));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
ayunamiSetPallete_R8_G8_B8(new DataInputStream(dat));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
ayunamiSetPallete_R5_G6_B5(new DataInputStream(dat));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
ayunamiSetPixelsFromPallete(new DataInputStream(dat));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
ddat = new DataInputStream(dat);
|
||||||
|
ayunamiSetPallete_R8_G8_B8(ddat);
|
||||||
|
ayunamiSetPixelsFromPallete(ddat);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
ddat = new DataInputStream(dat);
|
||||||
|
ayunamiSetPallete_R5_G6_B5(ddat);
|
||||||
|
ayunamiSetPixelsFromPallete(ddat);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IOException("Unknown map packet type: " + operation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiDisable() {
|
||||||
|
if(enableAyunami) {
|
||||||
|
enableAyunami = false;
|
||||||
|
ayunamiPixels = null;
|
||||||
|
ayunamiPallete = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiEnable() {
|
||||||
|
if(!enableAyunami) {
|
||||||
|
enableAyunami = true;
|
||||||
|
ayunamiPixels = new int[16384];
|
||||||
|
ayunamiPallete = new int[256];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiSetPixels_R8_G8_B8(DataInputStream dat) throws IOException {
|
||||||
|
ayunamiEnable();
|
||||||
|
for(int i = 0; i < ayunamiPixels.length; ++i) {
|
||||||
|
ayunamiPixels[i] = -16777216 | (dat.read() << 16) | (dat.read() << 8) | dat.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiSetPixels_R5_G6_B5(DataInputStream dat) throws IOException {
|
||||||
|
ayunamiEnable();
|
||||||
|
for(int i = 0; i < ayunamiPixels.length; ++i) {
|
||||||
|
int j = (int)dat.readShort() & 0xFFFF;
|
||||||
|
int r = ((j >> 11) & 0x1F);
|
||||||
|
int g = ((j >> 5) & 0x3F);
|
||||||
|
int b = (j & 0x1F);
|
||||||
|
ayunamiPixels[i] = -16777216 | (r << 19) | (g << 10) | (b << 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiSetPallete_R8_G8_B8(DataInputStream dat) throws IOException {
|
||||||
|
ayunamiEnable();
|
||||||
|
int len = dat.read();
|
||||||
|
ayunamiPallete = new int[len];
|
||||||
|
for(int i = 0; i < len; ++i) {
|
||||||
|
ayunamiPallete[i] = -16777216 | (dat.read() << 16) | (dat.read() << 8) | dat.read();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiSetPallete_R5_G6_B5(DataInputStream dat) throws IOException {
|
||||||
|
ayunamiEnable();
|
||||||
|
int len = dat.read();
|
||||||
|
ayunamiPallete = new int[len];
|
||||||
|
for(int i = 0; i < len; ++i) {
|
||||||
|
int j = (int)dat.readShort() & 0xFFFF;
|
||||||
|
int r = ((j >> 11) & 0x1F);
|
||||||
|
int g = ((j >> 5) & 0x3F);
|
||||||
|
int b = (j & 0x1F);
|
||||||
|
ayunamiPixels[i] = -16777216 | (r << 19) | (g << 10) | (b << 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ayunamiSetPixelsFromPallete(DataInputStream dat) throws IOException {
|
||||||
|
ayunamiEnable();
|
||||||
|
for(int i = 0; i < ayunamiPixels.length; ++i) {
|
||||||
|
ayunamiPixels[i] = ayunamiPallete[dat.read()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,38 +26,42 @@ public class MapItemRenderer {
|
||||||
private static final TextureLocation mapicons = new TextureLocation("/misc/mapicons.png");
|
private static final TextureLocation mapicons = new TextureLocation("/misc/mapicons.png");
|
||||||
|
|
||||||
public void renderMap(EntityPlayer par1EntityPlayer, RenderEngine par2RenderEngine, MapData par3MapData) {
|
public void renderMap(EntityPlayer par1EntityPlayer, RenderEngine par2RenderEngine, MapData par3MapData) {
|
||||||
for (int var4 = 0; var4 < 16384; ++var4) {
|
if(par3MapData.enableAyunami) {
|
||||||
byte var5 = par3MapData.colors[var4];
|
System.arraycopy(par3MapData.ayunamiPixels, 0, intArray, 0, intArray.length);
|
||||||
|
}else {
|
||||||
|
for (int var4 = 0; var4 < 16384; ++var4) {
|
||||||
|
byte var5 = par3MapData.colors[var4];
|
||||||
|
|
||||||
if (var5 / 4 == 0) {
|
if (var5 / 4 == 0) {
|
||||||
this.intArray[var4] = (var4 + var4 / 128 & 1) * 8 + 16 << 24;
|
this.intArray[var4] = (var4 + var4 / 128 & 1) * 8 + 16 << 24;
|
||||||
} else {
|
} else {
|
||||||
int var6 = MapColor.mapColorArray[var5 / 4].colorValue;
|
int var6 = MapColor.mapColorArray[var5 / 4].colorValue;
|
||||||
int var7 = var5 & 3;
|
int var7 = var5 & 3;
|
||||||
short var8 = 220;
|
short var8 = 220;
|
||||||
|
|
||||||
if (var7 == 2) {
|
if (var7 == 2) {
|
||||||
var8 = 255;
|
var8 = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var7 == 0) {
|
||||||
|
var8 = 180;
|
||||||
|
}
|
||||||
|
|
||||||
|
int var9 = (var6 >> 16 & 255) * var8 / 255;
|
||||||
|
int var10 = (var6 >> 8 & 255) * var8 / 255;
|
||||||
|
int var11 = (var6 & 255) * var8 / 255;
|
||||||
|
|
||||||
|
if (this.gameSettings.anaglyph) {
|
||||||
|
int var12 = (var9 * 30 + var10 * 59 + var11 * 11) / 100;
|
||||||
|
int var13 = (var9 * 30 + var10 * 70) / 100;
|
||||||
|
int var14 = (var9 * 30 + var11 * 70) / 100;
|
||||||
|
var9 = var12;
|
||||||
|
var10 = var13;
|
||||||
|
var11 = var14;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.intArray[var4] = -16777216 | var9 << 16 | var10 << 8 | var11;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var7 == 0) {
|
|
||||||
var8 = 180;
|
|
||||||
}
|
|
||||||
|
|
||||||
int var9 = (var6 >> 16 & 255) * var8 / 255;
|
|
||||||
int var10 = (var6 >> 8 & 255) * var8 / 255;
|
|
||||||
int var11 = (var6 & 255) * var8 / 255;
|
|
||||||
|
|
||||||
if (this.gameSettings.anaglyph) {
|
|
||||||
int var12 = (var9 * 30 + var10 * 59 + var11 * 11) / 100;
|
|
||||||
int var13 = (var9 * 30 + var10 * 70) / 100;
|
|
||||||
int var14 = (var9 * 30 + var11 * 70) / 100;
|
|
||||||
var9 = var12;
|
|
||||||
var10 = var13;
|
|
||||||
var11 = var14;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.intArray[var4] = -16777216 | var9 << 16 | var10 << 8 | var11;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,32 +83,30 @@ public class MapItemRenderer {
|
||||||
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||||
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
||||||
par2RenderEngine.resetBoundTexture();
|
par2RenderEngine.resetBoundTexture();
|
||||||
mapicons.bindTexture();
|
|
||||||
int var19 = 0;
|
|
||||||
|
|
||||||
for (Iterator var20 = par3MapData.playersVisibleOnMap.values().iterator(); var20.hasNext(); ++var19) {
|
if(!par3MapData.enableAyunami) {
|
||||||
MapCoord var21 = (MapCoord) var20.next();
|
mapicons.bindTexture();
|
||||||
EaglerAdapter.glPushMatrix();
|
int var19 = 0;
|
||||||
EaglerAdapter.glTranslatef((float) var15 + (float) var21.centerX / 2.0F + 64.0F, (float) var16 + (float) var21.centerZ / 2.0F + 64.0F, -0.02F);
|
|
||||||
EaglerAdapter.glRotatef((float) (var21.iconRotation * 360) / 16.0F, 0.0F, 0.0F, 1.0F);
|
for (Iterator var20 = par3MapData.playersVisibleOnMap.values().iterator(); var20.hasNext(); ++var19) {
|
||||||
EaglerAdapter.glScalef(4.0F, 4.0F, 3.0F);
|
MapCoord var21 = (MapCoord) var20.next();
|
||||||
EaglerAdapter.glTranslatef(-0.125F, 0.125F, 0.0F);
|
EaglerAdapter.glPushMatrix();
|
||||||
float var22 = (float) (var21.iconSize % 4 + 0) / 4.0F;
|
EaglerAdapter.glTranslatef((float) var15 + (float) var21.centerX / 2.0F + 64.0F, (float) var16 + (float) var21.centerZ / 2.0F + 64.0F, -0.02F);
|
||||||
float var23 = (float) (var21.iconSize / 4 + 0) / 4.0F;
|
EaglerAdapter.glRotatef((float) (var21.iconRotation * 360) / 16.0F, 0.0F, 0.0F, 1.0F);
|
||||||
float var24 = (float) (var21.iconSize % 4 + 1) / 4.0F;
|
EaglerAdapter.glScalef(4.0F, 4.0F, 3.0F);
|
||||||
float var25 = (float) (var21.iconSize / 4 + 1) / 4.0F;
|
EaglerAdapter.glTranslatef(-0.125F, 0.125F, 0.0F);
|
||||||
var17.startDrawingQuads();
|
float var22 = (float) (var21.iconSize % 4 + 0) / 4.0F;
|
||||||
var17.addVertexWithUV(-1.0D, 1.0D, (double) ((float) var19 * 0.001F), (double) var22, (double) var23);
|
float var23 = (float) (var21.iconSize / 4 + 0) / 4.0F;
|
||||||
var17.addVertexWithUV(1.0D, 1.0D, (double) ((float) var19 * 0.001F), (double) var24, (double) var23);
|
float var24 = (float) (var21.iconSize % 4 + 1) / 4.0F;
|
||||||
var17.addVertexWithUV(1.0D, -1.0D, (double) ((float) var19 * 0.001F), (double) var24, (double) var25);
|
float var25 = (float) (var21.iconSize / 4 + 1) / 4.0F;
|
||||||
var17.addVertexWithUV(-1.0D, -1.0D, (double) ((float) var19 * 0.001F), (double) var22, (double) var25);
|
var17.startDrawingQuads();
|
||||||
var17.draw();
|
var17.addVertexWithUV(-1.0D, 1.0D, (double) ((float) var19 * 0.001F), (double) var22, (double) var23);
|
||||||
EaglerAdapter.glPopMatrix();
|
var17.addVertexWithUV(1.0D, 1.0D, (double) ((float) var19 * 0.001F), (double) var24, (double) var23);
|
||||||
|
var17.addVertexWithUV(1.0D, -1.0D, (double) ((float) var19 * 0.001F), (double) var24, (double) var25);
|
||||||
|
var17.addVertexWithUV(-1.0D, -1.0D, (double) ((float) var19 * 0.001F), (double) var22, (double) var25);
|
||||||
|
var17.draw();
|
||||||
|
EaglerAdapter.glPopMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EaglerAdapter.glPushMatrix();
|
|
||||||
EaglerAdapter.glTranslatef(0.0F, 0.0F, -0.04F);
|
|
||||||
EaglerAdapter.glScalef(1.0F, 1.0F, 1.0F);
|
|
||||||
EaglerAdapter.glPopMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1017,8 +1017,10 @@ public class NetClientHandler extends NetHandler {
|
||||||
public void handleMapData(Packet131MapData par1Packet131MapData) {
|
public void handleMapData(Packet131MapData par1Packet131MapData) {
|
||||||
if (par1Packet131MapData.itemID == Item.map.itemID) {
|
if (par1Packet131MapData.itemID == Item.map.itemID) {
|
||||||
ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData);
|
ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData);
|
||||||
|
} else if (par1Packet131MapData.itemID == 103) {
|
||||||
|
ItemMap.readAyunamiMapPacket(this.mc.theWorld, par1Packet131MapData.uniqueID, par1Packet131MapData.itemData);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Unknown itemid: " + par1Packet131MapData.uniqueID);
|
System.err.println("Unknown itemid: " + par1Packet131MapData.itemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,11 @@ public abstract class Render {
|
||||||
*/
|
*/
|
||||||
private void renderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
private void renderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||||
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
||||||
|
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
|
||||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
shadow.bindTexture();
|
shadow.bindTexture();
|
||||||
|
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_WRAP_S, EaglerAdapter.GL_CLAMP);
|
||||||
|
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_WRAP_T, EaglerAdapter.GL_CLAMP);
|
||||||
World var10 = this.getWorldFromRenderManager();
|
World var10 = this.getWorldFromRenderManager();
|
||||||
EaglerAdapter.glDepthMask(false);
|
EaglerAdapter.glDepthMask(false);
|
||||||
float var11 = this.shadowSize;
|
float var11 = this.shadowSize;
|
||||||
|
@ -150,6 +153,7 @@ public abstract class Render {
|
||||||
var30.draw();
|
var30.draw();
|
||||||
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
||||||
|
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||||
EaglerAdapter.glDepthMask(true);
|
EaglerAdapter.glDepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,16 @@ public class RenderArrow extends Render {
|
||||||
EaglerAdapter.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
|
EaglerAdapter.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
|
||||||
Tessellator var10 = Tessellator.instance;
|
Tessellator var10 = Tessellator.instance;
|
||||||
byte var11 = 0;
|
byte var11 = 0;
|
||||||
float var12 = 0.0F;
|
float fix = 0.002f;
|
||||||
float var13 = 0.5F;
|
float var12 = 0.0F + fix;
|
||||||
float var14 = (float) (0 + var11 * 10) / 32.0F;
|
float var13 = 0.5F - fix;
|
||||||
float var15 = (float) (5 + var11 * 10) / 32.0F;
|
float var14 = (float) (0 + var11 * 10) / 32.0F + fix;
|
||||||
float var16 = 0.0F;
|
float var15 = (float) (5 + var11 * 10) / 32.0F - fix;
|
||||||
float var17 = 0.15625F;
|
float var16 = 0.0F + fix;
|
||||||
float var18 = (float) (5 + var11 * 10) / 32.0F;
|
float var17 = 0.15625F - fix;
|
||||||
float var19 = (float) (10 + var11 * 10) / 32.0F;
|
float var18 = (float) (5 + var11 * 10) / 32.0F + fix;
|
||||||
float var20 = 0.05625F;
|
float var19 = (float) (10 + var11 * 10) / 32.0F - fix;
|
||||||
|
float var20 = 0.05625F + fix;
|
||||||
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
|
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
|
||||||
float var21 = (float) par1EntityArrow.arrowShake - par9;
|
float var21 = (float) par1EntityArrow.arrowShake - par9;
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ public class RenderArrow extends Render {
|
||||||
|
|
||||||
for (int var23 = 0; var23 < 4; ++var23) {
|
for (int var23 = 0; var23 < 4; ++var23) {
|
||||||
EaglerAdapter.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
EaglerAdapter.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||||
EaglerAdapter.glNormal3f(0.0F, 0.0F, var20);
|
EaglerAdapter.glNormal3f(0.0F, 0.0F, -var20);
|
||||||
var10.startDrawingQuads();
|
var10.startDrawingQuads();
|
||||||
var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) var12, (double) var14);
|
var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) var12, (double) var14);
|
||||||
var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) var13, (double) var14);
|
var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) var13, (double) var14);
|
||||||
|
|
|
@ -22,17 +22,17 @@ public class RenderFish extends Render {
|
||||||
byte var11 = 2;
|
byte var11 = 2;
|
||||||
tex.bindTexture();
|
tex.bindTexture();
|
||||||
Tessellator var12 = Tessellator.instance;
|
Tessellator var12 = Tessellator.instance;
|
||||||
float var13 = (float) (var10 * 8 + 0) / 128.0F;
|
float var13 = (float) (var10 * 8 + 0 + 0.15f) / 128.0F;
|
||||||
float var14 = (float) (var10 * 8 + 8) / 128.0F;
|
float var14 = (float) (var10 * 8 + 8 - 0.15f) / 128.0F;
|
||||||
float var15 = (float) (var11 * 8 + 0) / 128.0F;
|
float var15 = (float) (var11 * 8 + 0 + 0.15f) / 128.0F;
|
||||||
float var16 = (float) (var11 * 8 + 8) / 128.0F;
|
float var16 = (float) (var11 * 8 + 8 - 0.15f) / 128.0F;
|
||||||
float var17 = 1.0F;
|
float var17 = 1.0F;
|
||||||
float var18 = 0.5F;
|
float var18 = 0.5F;
|
||||||
float var19 = 0.5F;
|
float var19 = 0.5F;
|
||||||
EaglerAdapter.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
EaglerAdapter.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||||
EaglerAdapter.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
EaglerAdapter.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||||
var12.startDrawingQuads();
|
var12.startDrawingQuads();
|
||||||
var12.setNormal(0.0F, 1.0F, 0.0F);
|
var12.setNormal(0.0F, -1.0F, 0.0F);
|
||||||
var12.addVertexWithUV((double) (0.0F - var18), (double) (0.0F - var19), 0.0D, (double) var13, (double) var16);
|
var12.addVertexWithUV((double) (0.0F - var18), (double) (0.0F - var19), 0.0D, (double) var13, (double) var16);
|
||||||
var12.addVertexWithUV((double) (var17 - var18), (double) (0.0F - var19), 0.0D, (double) var14, (double) var16);
|
var12.addVertexWithUV((double) (var17 - var18), (double) (0.0F - var19), 0.0D, (double) var14, (double) var16);
|
||||||
var12.addVertexWithUV((double) (var17 - var18), (double) (1.0F - var19), 0.0D, (double) var14, (double) var15);
|
var12.addVertexWithUV((double) (var17 - var18), (double) (1.0F - var19), 0.0D, (double) var14, (double) var15);
|
||||||
|
|
|
@ -113,10 +113,11 @@ public class RenderItemFrame extends Render {
|
||||||
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
|
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
|
||||||
var4.startDrawingQuads();
|
var4.startDrawingQuads();
|
||||||
byte var5 = 7;
|
byte var5 = 7;
|
||||||
var4.addVertexWithUV((double) (0 - var5), (double) (128 + var5), 0.0D, 0.0D, 1.0D);
|
double d = 0.001d;
|
||||||
var4.addVertexWithUV((double) (128 + var5), (double) (128 + var5), 0.0D, 1.0D, 1.0D);
|
var4.addVertexWithUV((double) (0 - var5), (double) (128 + var5), 0.0D, 0.0D + d, 1.0D - d);
|
||||||
var4.addVertexWithUV((double) (128 + var5), (double) (0 - var5), 0.0D, 1.0D, 0.0D);
|
var4.addVertexWithUV((double) (128 + var5), (double) (128 + var5), 0.0D, 1.0D - d, 1.0D - d);
|
||||||
var4.addVertexWithUV((double) (0 - var5), (double) (0 - var5), 0.0D, 0.0D, 0.0D);
|
var4.addVertexWithUV((double) (128 + var5), (double) (0 - var5), 0.0D, 1.0D - d, 0.0D + d);
|
||||||
|
var4.addVertexWithUV((double) (0 - var5), (double) (0 - var5), 0.0D, 0.0D + d, 0.0D + d);
|
||||||
var4.draw();
|
var4.draw();
|
||||||
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
|
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
|
||||||
EaglerAdapter.glTranslatef(0.0F, 0.0F, -2.0F);
|
EaglerAdapter.glTranslatef(0.0F, 0.0F, -2.0F);
|
||||||
|
|
|
@ -23,10 +23,10 @@ public class RenderXPOrb extends Render {
|
||||||
int var10 = par1EntityXPOrb.getTextureByXP();
|
int var10 = par1EntityXPOrb.getTextureByXP();
|
||||||
tex_xporb.bindTexture();
|
tex_xporb.bindTexture();
|
||||||
Tessellator var11 = Tessellator.instance;
|
Tessellator var11 = Tessellator.instance;
|
||||||
float var12 = (float) (var10 % 4 * 16 + 0) / 64.0F;
|
float var12 = (float) (var10 % 4 * 16 + 0 + 0.2f) / 64.0F;
|
||||||
float var13 = (float) (var10 % 4 * 16 + 16) / 64.0F;
|
float var13 = (float) (var10 % 4 * 16 + 16 - 0.2f) / 64.0F;
|
||||||
float var14 = (float) (var10 / 4 * 16 + 0) / 64.0F;
|
float var14 = (float) (var10 / 4 * 16 + 0 + 0.2f) / 64.0F;
|
||||||
float var15 = (float) (var10 / 4 * 16 + 16) / 64.0F;
|
float var15 = (float) (var10 / 4 * 16 + 16 - 0.2f) / 64.0F;
|
||||||
float var16 = 1.0F;
|
float var16 = 1.0F;
|
||||||
float var17 = 0.5F;
|
float var17 = 0.5F;
|
||||||
float var18 = 0.25F;
|
float var18 = 0.25F;
|
||||||
|
|
|
@ -15,6 +15,9 @@ import net.minecraft.client.Minecraft;
|
||||||
public class ServerData {
|
public class ServerData {
|
||||||
public String serverName;
|
public String serverName;
|
||||||
public String serverIP;
|
public String serverIP;
|
||||||
|
private final int id;
|
||||||
|
|
||||||
|
private static int idCounter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the string indicating number of players on and capacity of the server that is
|
* the string indicating number of players on and capacity of the server that is
|
||||||
|
@ -46,13 +49,24 @@ public class ServerData {
|
||||||
public boolean hasError = false;
|
public boolean hasError = false;
|
||||||
public List<String> playerList = new ArrayList();
|
public List<String> playerList = new ArrayList();
|
||||||
public int serverIconGL = -1;
|
public int serverIconGL = -1;
|
||||||
|
public final boolean isDefault;
|
||||||
|
|
||||||
/** Whether to hide the IP address for this server. */
|
/** Whether to hide the IP address for this server. */
|
||||||
private boolean hideAddress = false;
|
private boolean hideAddress = false;
|
||||||
|
|
||||||
public ServerData(String par1Str, String par2Str) {
|
public ServerData(String par1Str, String par2Str, boolean isDefault) {
|
||||||
this.serverName = par1Str;
|
this.serverName = par1Str;
|
||||||
this.serverIP = par2Str;
|
this.serverIP = par2Str;
|
||||||
|
this.isDefault = isDefault;
|
||||||
|
this.id = ++idCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return o instanceof ServerData && id == ((ServerData)o).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +108,7 @@ public class ServerData {
|
||||||
* instance.
|
* instance.
|
||||||
*/
|
*/
|
||||||
public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound) {
|
public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound) {
|
||||||
ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"));
|
ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"), par0NBTTagCompound.getBoolean("default"));
|
||||||
var1.hideAddress = par0NBTTagCompound.getBoolean("hideAddress");
|
var1.hideAddress = par0NBTTagCompound.getBoolean("hideAddress");
|
||||||
return var1;
|
return var1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.minecraft.src;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -20,10 +21,13 @@ public class ServerList {
|
||||||
|
|
||||||
/** List of ServerData instances. */
|
/** List of ServerData instances. */
|
||||||
private final List<ServerData> servers = new ArrayList();
|
private final List<ServerData> servers = new ArrayList();
|
||||||
|
private final List<ServerData> allServers = new ArrayList();
|
||||||
|
|
||||||
public static final List<ServerData> forcedServers = new ArrayList();
|
public static final List<ServerData> forcedServers = new ArrayList();
|
||||||
private static final Set<String> motdLocks = new HashSet();
|
private static final Set<String> motdLocks = new HashSet();
|
||||||
|
|
||||||
|
public static boolean hideDownDefaultServers = false;
|
||||||
|
|
||||||
public ServerList(Minecraft par1Minecraft) {
|
public ServerList(Minecraft par1Minecraft) {
|
||||||
this.mc = par1Minecraft;
|
this.mc = par1Minecraft;
|
||||||
this.loadServerList();
|
this.loadServerList();
|
||||||
|
@ -32,13 +36,14 @@ public class ServerList {
|
||||||
public static void loadDefaultServers(String base64) {
|
public static void loadDefaultServers(String base64) {
|
||||||
try {
|
try {
|
||||||
NBTTagCompound nbt = CompressedStreamTools.readUncompressed(Base64.decodeBase64(base64));
|
NBTTagCompound nbt = CompressedStreamTools.readUncompressed(Base64.decodeBase64(base64));
|
||||||
if(nbt.getBoolean("profanity")) {
|
ConfigConstants.profanity = nbt.getBoolean("profanity");
|
||||||
ConfigConstants.profanity = true;
|
hideDownDefaultServers = nbt.getBoolean("hide_down");
|
||||||
}
|
|
||||||
forcedServers.clear();
|
forcedServers.clear();
|
||||||
NBTTagList list = nbt.getTagList("servers");
|
NBTTagList list = nbt.getTagList("servers");
|
||||||
for (int i = 0; i < list.tagCount(); ++i) {
|
for (int i = 0; i < list.tagCount(); ++i) {
|
||||||
forcedServers.add(ServerData.getServerDataFromNBTCompound((NBTTagCompound) list.tagAt(i)));
|
NBTTagCompound tag = (NBTTagCompound) list.tagAt(i);
|
||||||
|
tag.setBoolean("default", true);
|
||||||
|
forcedServers.add(ServerData.getServerDataFromNBTCompound(tag));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -53,14 +58,18 @@ public class ServerList {
|
||||||
public void loadServerList() {
|
public void loadServerList() {
|
||||||
freeServerIcons();
|
freeServerIcons();
|
||||||
this.servers.clear();
|
this.servers.clear();
|
||||||
|
this.allServers.clear();
|
||||||
for(ServerData dat : forcedServers) {
|
for(ServerData dat : forcedServers) {
|
||||||
dat.pingSentTime = -1l;
|
dat.pingSentTime = -1l;
|
||||||
dat.hasPing = false;
|
dat.hasPing = false;
|
||||||
this.servers.add(dat);
|
this.servers.add(dat);
|
||||||
|
this.allServers.add(dat);
|
||||||
}
|
}
|
||||||
NBTTagList servers = LocalStorageManager.gameSettingsStorage.getTagList("servers");
|
NBTTagList servers = LocalStorageManager.gameSettingsStorage.getTagList("servers");
|
||||||
for (int i = 0; i < servers.tagCount(); ++i) {
|
for (int i = 0; i < servers.tagCount(); ++i) {
|
||||||
this.servers.add(ServerData.getServerDataFromNBTCompound((NBTTagCompound) servers.tagAt(i)));
|
ServerData dat = ServerData.getServerDataFromNBTCompound((NBTTagCompound) servers.tagAt(i));
|
||||||
|
this.servers.add(dat);
|
||||||
|
this.allServers.add(dat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +79,8 @@ public class ServerList {
|
||||||
*/
|
*/
|
||||||
public void saveServerList() {
|
public void saveServerList() {
|
||||||
NBTTagList servers = new NBTTagList();
|
NBTTagList servers = new NBTTagList();
|
||||||
for(int i = forcedServers.size(); i < this.servers.size(); ++i) {
|
for(int i = forcedServers.size(); i < this.allServers.size(); ++i) {
|
||||||
servers.appendTag(((ServerData) this.servers.get(i)).getNBTCompound());
|
servers.appendTag(((ServerData) this.allServers.get(i)).getNBTCompound());
|
||||||
}
|
}
|
||||||
LocalStorageManager.gameSettingsStorage.setTag("servers", servers);
|
LocalStorageManager.gameSettingsStorage.setTag("servers", servers);
|
||||||
LocalStorageManager.saveStorageG();
|
LocalStorageManager.saveStorageG();
|
||||||
|
@ -89,6 +98,7 @@ public class ServerList {
|
||||||
*/
|
*/
|
||||||
public void removeServerData(int par1) {
|
public void removeServerData(int par1) {
|
||||||
ServerData dat = this.servers.remove(par1);
|
ServerData dat = this.servers.remove(par1);
|
||||||
|
this.allServers.remove(dat);
|
||||||
if(dat != null) {
|
if(dat != null) {
|
||||||
dat.freeIcon();
|
dat.freeIcon();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +110,8 @@ public class ServerList {
|
||||||
public void addServerData(ServerData par1ServerData) {
|
public void addServerData(ServerData par1ServerData) {
|
||||||
par1ServerData.pingSentTime = -1l;
|
par1ServerData.pingSentTime = -1l;
|
||||||
par1ServerData.hasPing = false;
|
par1ServerData.hasPing = false;
|
||||||
this.servers.add(par1ServerData);
|
this.allServers.add(par1ServerData);
|
||||||
|
refreshServerPing();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,22 +124,21 @@ public class ServerList {
|
||||||
/**
|
/**
|
||||||
* Takes two list indexes, and swaps their order around.
|
* Takes two list indexes, and swaps their order around.
|
||||||
*/
|
*/
|
||||||
public void swapServers(int par1, int par2) {
|
public void swapServers(int par1, int par2) { // will be fixed eventually
|
||||||
|
/*
|
||||||
ServerData var3 = this.getServerData(par1);
|
ServerData var3 = this.getServerData(par1);
|
||||||
this.servers.set(par1, this.getServerData(par2));
|
ServerData dat = this.getServerData(par2);
|
||||||
|
this.servers.set(par1, dat);
|
||||||
this.servers.set(par2, var3);
|
this.servers.set(par2, var3);
|
||||||
|
int i = this.allServers.indexOf(dat);
|
||||||
|
this.allServers.set(par1, this.allServers.get(i));
|
||||||
|
this.allServers.set(i, var3);
|
||||||
this.saveServerList();
|
this.saveServerList();
|
||||||
}
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the given index in the list to the given ServerData instance.
|
|
||||||
*/
|
|
||||||
public void setServer(int par1, ServerData par2ServerData) {
|
|
||||||
this.servers.set(par1, par2ServerData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void freeServerIcons() {
|
public void freeServerIcons() {
|
||||||
for(ServerData dat : servers) {
|
for(ServerData dat : allServers) {
|
||||||
if(dat.currentQuery != null && dat.currentQuery.isQueryOpen()) {
|
if(dat.currentQuery != null && dat.currentQuery.isQueryOpen()) {
|
||||||
dat.currentQuery.close();
|
dat.currentQuery.close();
|
||||||
}
|
}
|
||||||
|
@ -142,6 +152,8 @@ public class ServerList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshServerPing() {
|
public void refreshServerPing() {
|
||||||
|
this.servers.clear();
|
||||||
|
this.servers.addAll(this.allServers);
|
||||||
for(ServerData dat : servers) {
|
for(ServerData dat : servers) {
|
||||||
if(dat.currentQuery != null && dat.currentQuery.isQueryOpen()) {
|
if(dat.currentQuery != null && dat.currentQuery.isQueryOpen()) {
|
||||||
dat.currentQuery.close();
|
dat.currentQuery.close();
|
||||||
|
@ -153,7 +165,9 @@ public class ServerList {
|
||||||
|
|
||||||
public void updateServerPing() {
|
public void updateServerPing() {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for(ServerData dat : servers) {
|
Iterator<ServerData> itr = servers.iterator();
|
||||||
|
while(itr.hasNext()) {
|
||||||
|
ServerData dat = itr.next();
|
||||||
if(dat.pingSentTime <= 0l) {
|
if(dat.pingSentTime <= 0l) {
|
||||||
dat.pingToServer = -2l;
|
dat.pingToServer = -2l;
|
||||||
String addr = dat.serverIP;
|
String addr = dat.serverIP;
|
||||||
|
@ -218,6 +232,9 @@ public class ServerList {
|
||||||
dat.pingToServer = -1l;
|
dat.pingToServer = -1l;
|
||||||
dat.hasPing = true;
|
dat.hasPing = true;
|
||||||
}
|
}
|
||||||
|
if(ServerList.hideDownDefaultServers && dat.isDefault && dat.pingToServer == -1l && dat.hasPing == true) {
|
||||||
|
itr.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(total >= 4) {
|
if(total >= 4) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,8 +16,8 @@ public class TexturedQuad {
|
||||||
|
|
||||||
public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex, Vec3 normal, int par2, int par3, int par4, int par5, float par6, float par7) {
|
public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex, Vec3 normal, int par2, int par3, int par4, int par5, float par6, float par7) {
|
||||||
this(par1ArrayOfPositionTextureVertex);
|
this(par1ArrayOfPositionTextureVertex);
|
||||||
float var8 = 0.0F / par6;
|
float var8 = 0.2F / par6;
|
||||||
float var9 = 0.0F / par7;
|
float var9 = 0.2F / par7;
|
||||||
par1ArrayOfPositionTextureVertex[0] = par1ArrayOfPositionTextureVertex[0].setTexturePosition((float) par4 / par6 - var8, (float) par3 / par7 + var9);
|
par1ArrayOfPositionTextureVertex[0] = par1ArrayOfPositionTextureVertex[0].setTexturePosition((float) par4 / par6 - var8, (float) par3 / par7 + var9);
|
||||||
par1ArrayOfPositionTextureVertex[1] = par1ArrayOfPositionTextureVertex[1].setTexturePosition((float) par2 / par6 + var8, (float) par3 / par7 + var9);
|
par1ArrayOfPositionTextureVertex[1] = par1ArrayOfPositionTextureVertex[1].setTexturePosition((float) par2 / par6 + var8, (float) par3 / par7 + var9);
|
||||||
par1ArrayOfPositionTextureVertex[2] = par1ArrayOfPositionTextureVertex[2].setTexturePosition((float) par2 / par6 + var8, (float) par5 / par7 - var9);
|
par1ArrayOfPositionTextureVertex[2] = par1ArrayOfPositionTextureVertex[2].setTexturePosition((float) par2 / par6 + var8, (float) par5 / par7 - var9);
|
||||||
|
|
|
@ -435,7 +435,7 @@ public class EaglerAdapterImpl2 {
|
||||||
public static final int _wGL_SRC_COLOR = SRC_COLOR;
|
public static final int _wGL_SRC_COLOR = SRC_COLOR;
|
||||||
public static final int _wGL_ONE = ONE;
|
public static final int _wGL_ONE = ONE;
|
||||||
public static final int _wGL_NEAREST = NEAREST;
|
public static final int _wGL_NEAREST = NEAREST;
|
||||||
public static final int _wGL_CLAMP = REPEAT;
|
public static final int _wGL_CLAMP = CLAMP_TO_EDGE;
|
||||||
public static final int _wGL_TEXTURE_WRAP_S = TEXTURE_WRAP_S;
|
public static final int _wGL_TEXTURE_WRAP_S = TEXTURE_WRAP_S;
|
||||||
public static final int _wGL_TEXTURE_WRAP_T = TEXTURE_WRAP_T;
|
public static final int _wGL_TEXTURE_WRAP_T = TEXTURE_WRAP_T;
|
||||||
public static final int _wGL_REPEAT = REPEAT;
|
public static final int _wGL_REPEAT = REPEAT;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user