fixed skin issue

This commit is contained in:
LAX1DUDE 2022-03-09 17:51:58 -08:00
parent 9f2bcf7e9d
commit 37bfa17c72
9 changed files with 43 additions and 25 deletions

View File

@ -41,6 +41,7 @@ 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();
try {
if("EAG|MySkin".equals(event.getTag())) { if("EAG|MySkin".equals(event.getTag())) {
int t = (int)msg[0] & 0xFF; int t = (int)msg[0] & 0xFF;
if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) { if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) {
@ -63,6 +64,9 @@ public class PluginEaglerSkins extends Plugin implements Listener {
} }
} }
} }
}catch(Throwable t) {
// hacker
}
} }
} }

View File

@ -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";

View File

@ -119,8 +119,10 @@ public class DefaultSkinRenderer {
break; break;
} }
if(skinToLoad.length / 4 == w * h) {
skinGLUnits.put(pp, Minecraft.getMinecraft().renderEngine.setupTextureRaw(skinToLoad, 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);
if(i != null && i.intValue() > 0) { if(i != null && i.intValue() > 0) {

View File

@ -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) {

View File

@ -256,11 +256,12 @@ 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);
} }
} }
}
public void onGuiClosed() { public void onGuiClosed() {
EaglerAdapter.enableRepeatEvents(false); EaglerAdapter.enableRepeatEvents(false);

View File

@ -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) {

View File

@ -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 };
} }
} }
} }

View File

@ -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) {

View File

@ -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;