fixed skin issue
This commit is contained in:
parent
9f2bcf7e9d
commit
37bfa17c72
|
@ -41,27 +41,31 @@ public class PluginEaglerSkins extends Plugin implements Listener {
|
||||||
if(event.getSender() instanceof UserConnection && event.getData().length > 0) {
|
if(event.getSender() instanceof UserConnection && event.getData().length > 0) {
|
||||||
String user = ((UserConnection)event.getSender()).getName();
|
String user = ((UserConnection)event.getSender()).getName();
|
||||||
byte[] msg = event.getData();
|
byte[] msg = event.getData();
|
||||||
if("EAG|MySkin".equals(event.getTag())) {
|
try {
|
||||||
int t = (int)msg[0] & 0xFF;
|
if("EAG|MySkin".equals(event.getTag())) {
|
||||||
if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) {
|
int t = (int)msg[0] & 0xFF;
|
||||||
if(msg.length == 2) {
|
if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) {
|
||||||
if(((int)msg[1] & 0xFF) >= VALID_DEFAULT_SKINS) {
|
if(msg.length == 2) {
|
||||||
msg[1] = 0;
|
if(((int)msg[1] & 0xFF) >= VALID_DEFAULT_SKINS) {
|
||||||
|
msg[1] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
skinCollection.put(user, msg);
|
||||||
|
}
|
||||||
|
}else if("EAG|FetchSkin".equals(event.getTag())) {
|
||||||
|
if(msg.length > 2) {
|
||||||
|
String fetch = new String(msg, 2, msg.length - 2, StandardCharsets.UTF_8);
|
||||||
|
byte[] data;
|
||||||
|
if((data = skinCollection.get(fetch)) != null) {
|
||||||
|
byte[] conc = new byte[data.length + 2];
|
||||||
|
conc[0] = msg[0]; conc[1] = msg[1]; //synchronization cookie
|
||||||
|
System.arraycopy(data, 0, conc, 2, data.length);
|
||||||
|
((UserConnection)event.getSender()).sendData("EAG|UserSkin", conc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
skinCollection.put(user, msg);
|
|
||||||
}
|
|
||||||
}else if("EAG|FetchSkin".equals(event.getTag())) {
|
|
||||||
if(msg.length > 2) {
|
|
||||||
String fetch = new String(msg, 2, msg.length - 2, StandardCharsets.UTF_8);
|
|
||||||
byte[] data;
|
|
||||||
if((data = skinCollection.get(fetch)) != null) {
|
|
||||||
byte[] conc = new byte[data.length + 2];
|
|
||||||
conc[0] = msg[0]; conc[1] = msg[1]; //synchronization cookie
|
|
||||||
System.arraycopy(data, 0, conc, 2, data.length);
|
|
||||||
((UserConnection)event.getSender()).sendData("EAG|UserSkin", conc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}catch(Throwable t) {
|
||||||
|
// hacker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ public class ConfigConstants {
|
||||||
|
|
||||||
public static boolean profanity = false;
|
public static boolean profanity = false;
|
||||||
|
|
||||||
public static final String version = "22w07a";
|
public static final String version = "22w10a";
|
||||||
public static final String mainMenuString = "eaglercraft " + version;
|
public static final String mainMenuString = "eaglercraft " + version;
|
||||||
|
|
||||||
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
||||||
|
|
|
@ -119,7 +119,9 @@ public class DefaultSkinRenderer {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
skinGLUnits.put(pp, Minecraft.getMinecraft().renderEngine.setupTextureRaw(skinToLoad, w, h));
|
if(skinToLoad.length / 4 == w * h) {
|
||||||
|
skinGLUnits.put(pp, Minecraft.getMinecraft().renderEngine.setupTextureRaw(skinToLoad, w, h));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
skinGLTimeout.put(pp, System.currentTimeMillis());
|
skinGLTimeout.put(pp, System.currentTimeMillis());
|
||||||
Integer i = skinGLUnits.get(pp);
|
Integer i = skinGLUnits.get(pp);
|
||||||
|
|
|
@ -60,6 +60,11 @@ public class EaglerProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
int t = getSkinSize(data.length);
|
int t = getSkinSize(data.length);
|
||||||
|
|
||||||
|
if(t == -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
switch(t) {
|
switch(t) {
|
||||||
|
|
|
@ -256,9 +256,10 @@ public class GuiScreenEditProfile extends GuiScreen {
|
||||||
if(name.length() > 32) {
|
if(name.length() > 32) {
|
||||||
name = name.substring(0, 32);
|
name = name.substring(0, 32);
|
||||||
}
|
}
|
||||||
EaglerProfile.addSkin(name, rawSkin);
|
if(EaglerProfile.addSkin(name, rawSkin) != -1) {
|
||||||
selectedSlot = EaglerProfile.skinNames.size() - 1;
|
selectedSlot = EaglerProfile.skinNames.size() - 1;
|
||||||
this.dropDownOptions = EaglerProfile.concatArrays(EaglerProfile.skinNames.toArray(new String[0]), defaultOptions);
|
this.dropDownOptions = EaglerProfile.concatArrays(EaglerProfile.skinNames.toArray(new String[0]), defaultOptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -496,6 +496,9 @@ public class Minecraft implements Runnable {
|
||||||
this.currentScreen.onGuiClosed();
|
this.currentScreen.onGuiClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(EaglerAdapter.keysNext());
|
||||||
|
while(EaglerAdapter.mouseNext());
|
||||||
|
|
||||||
if (par1GuiScreen == null && this.theWorld == null) {
|
if (par1GuiScreen == null && this.theWorld == null) {
|
||||||
par1GuiScreen = new GuiMainMenu();
|
par1GuiScreen = new GuiMainMenu();
|
||||||
} else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0) {
|
} else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0) {
|
||||||
|
|
|
@ -25,7 +25,9 @@ public class Packet250CustomPayload extends Packet {
|
||||||
this.length = par2ArrayOfByte.length;
|
this.length = par2ArrayOfByte.length;
|
||||||
|
|
||||||
if (this.length > 32767) {
|
if (this.length > 32767) {
|
||||||
throw new IllegalArgumentException("Payload may not be larger than 32k");
|
System.err.println("Tried to send '" + this.channel + "' with size " + this.length + " which is larger than the 32k so it was truncated down to 1 byte");
|
||||||
|
this.length = 1;
|
||||||
|
this.data = new byte[] { (byte) 0xFF };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1539,6 +1539,8 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
* Plays the specified record. Arg: recordName, x, y, z
|
* Plays the specified record. Arg: recordName, x, y, z
|
||||||
*/
|
*/
|
||||||
public void playRecord(String par1Str, int par2, int par3, int par4) {
|
public void playRecord(String par1Str, int par2, int par3, int par4) {
|
||||||
|
Minecraft.getMinecraft().displayEaglercraftText("records have been deleted to reduce file size");
|
||||||
|
|
||||||
ItemRecord var5 = ItemRecord.getRecord(par1Str);
|
ItemRecord var5 = ItemRecord.getRecord(par1Str);
|
||||||
|
|
||||||
if (par1Str != null && var5 != null) {
|
if (par1Str != null && var5 != null) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.teavm.jso.ajax.ReadyStateChangeHandler;
|
||||||
import org.teavm.jso.ajax.XMLHttpRequest;
|
import org.teavm.jso.ajax.XMLHttpRequest;
|
||||||
import org.teavm.jso.browser.TimerHandler;
|
import org.teavm.jso.browser.TimerHandler;
|
||||||
import org.teavm.jso.browser.Window;
|
import org.teavm.jso.browser.Window;
|
||||||
import org.teavm.jso.core.JSNumber;
|
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.dom.events.KeyboardEvent;
|
import org.teavm.jso.dom.events.KeyboardEvent;
|
||||||
import org.teavm.jso.dom.events.MessageEvent;
|
import org.teavm.jso.dom.events.MessageEvent;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user