Update #36 - Fix incorrect use of arithmetic shift, more capes

This commit is contained in:
lax1dude
2024-06-23 17:02:58 -07:00
parent 7425179b36
commit cc1fe13421
60 changed files with 421 additions and 210 deletions

View File

@ -63,8 +63,8 @@ public class CapePackets {
}
public static byte[] writeMyCapePreset(int capeId) {
return new byte[] { (byte) PACKET_MY_CAPE_PRESET, (byte) (capeId >> 24), (byte) (capeId >> 16),
(byte) (capeId >> 8), (byte) (capeId & 0xFF) };
return new byte[] { (byte) PACKET_MY_CAPE_PRESET, (byte) (capeId >>> 24), (byte) (capeId >>> 16),
(byte) (capeId >>> 8), (byte) (capeId & 0xFF) };
}
public static byte[] writeMyCapeCustom(CustomCape customCape) {

View File

@ -39,9 +39,14 @@ public enum DefaultCapes {
SNOWMAN(17, "Snowman", new ResourceLocation("eagler:capes/17.snowman.png")),
SPADE(18, "Spade", new ResourceLocation("eagler:capes/18.spade.png")),
BIRTHDAY(19, "Birthday", new ResourceLocation("eagler:capes/19.birthday.png")),
DB(20, "dB", new ResourceLocation("eagler:capes/20.db.png"));
DB(20, "dB", new ResourceLocation("eagler:capes/20.db.png")),
_15TH_ANNIVERSARY(21, "15th Anniversary", new ResourceLocation("eagler:capes/21.15th_anniversary.png")),
VANILLA(22, "Vanilla", new ResourceLocation("eagler:capes/22.vanilla.png")),
TIKTOK(23, "TikTok", new ResourceLocation("eagler:capes/23.tiktok.png")),
PURPLE_HEART(24, "Purple Heart", new ResourceLocation("eagler:capes/24.purple_heart.png")),
CHERRY_BLOSSOM(25, "Cherry Blossom", new ResourceLocation("eagler:capes/25.cherry_blossom.png"));
public static final DefaultCapes[] defaultCapesMap = new DefaultCapes[21];
public static final DefaultCapes[] defaultCapesMap = new DefaultCapes[26];
public final int id;
public final String name;

View File

@ -345,9 +345,9 @@ public class GuiScreenEditProfile extends GuiScreen {
for(int i = 0, j, k; i < 4096; ++i) {
j = i << 2;
k = loadedSkin.pixels[i];
rawSkin[j] = (byte)(k >> 24);
rawSkin[j + 1] = (byte)(k >> 16);
rawSkin[j + 2] = (byte)(k >> 8);
rawSkin[j] = (byte)(k >>> 24);
rawSkin[j + 1] = (byte)(k >>> 16);
rawSkin[j + 2] = (byte)(k >>> 8);
rawSkin[j + 3] = (byte)(k & 0xFF);
}
for(int y = 20; y < 32; ++y) {

View File

@ -59,7 +59,7 @@ public class ProfileExporter {
+ (doExportServers ? "servers " : "") + (doExportResourcePacks ? "resourcePacks" : "") + "\n\n")
.getBytes(StandardCharsets.UTF_8);
osb.write((comment.length >> 8) & 255);
osb.write((comment.length >>> 8) & 255);
osb.write(comment.length & 255);
osb.write(comment);
@ -164,9 +164,9 @@ public class ProfileExporter {
byte[] ret = osb.toByteArray();
ret[lengthIntegerOffset] = (byte)((fileCount >> 24) & 0xFF);
ret[lengthIntegerOffset + 1] = (byte)((fileCount >> 16) & 0xFF);
ret[lengthIntegerOffset + 2] = (byte)((fileCount >> 8) & 0xFF);
ret[lengthIntegerOffset] = (byte)((fileCount >>> 24) & 0xFF);
ret[lengthIntegerOffset + 1] = (byte)((fileCount >>> 16) & 0xFF);
ret[lengthIntegerOffset + 2] = (byte)((fileCount >>> 8) & 0xFF);
ret[lengthIntegerOffset + 3] = (byte)(fileCount & 0xFF);
logger.info("Export complete!");

View File

@ -42,8 +42,8 @@ public class SkinConverter {
i = (y * 23 + x) * 3;
j = skinIn.pixels[y * skinIn.width + x];
if((j & 0xFF000000) != 0) {
skinOut[i] = (byte)(j >> 16);
skinOut[i + 1] = (byte)(j >> 8);
skinOut[i] = (byte)(j >>> 16);
skinOut[i + 1] = (byte)(j >>> 8);
skinOut[i + 2] = (byte)(j & 0xFF);
}else {
skinOut[i] = skinOut[i + 1] = skinOut[i + 2] = 0;
@ -54,8 +54,8 @@ public class SkinConverter {
i = ((y + 6) * 23 + 22) * 3;
j = skinIn.pixels[(y + 11) * skinIn.width + 22];
if((j & 0xFF000000) != 0) {
skinOut[i] = (byte)(j >> 16);
skinOut[i + 1] = (byte)(j >> 8);
skinOut[i] = (byte)(j >>> 16);
skinOut[i + 1] = (byte)(j >>> 8);
skinOut[i + 2] = (byte)(j & 0xFF);
}else {
skinOut[i] = skinOut[i + 1] = skinOut[i + 2] = 0;

View File

@ -81,8 +81,8 @@ public class SkinPackets {
}
public static byte[] writeMySkinPreset(int skinId) {
return new byte[] { (byte) PACKET_MY_SKIN_PRESET, (byte) (skinId >> 24), (byte) (skinId >> 16),
(byte) (skinId >> 8), (byte) (skinId & 0xFF) };
return new byte[] { (byte) PACKET_MY_SKIN_PRESET, (byte) (skinId >>> 24), (byte) (skinId >>> 16),
(byte) (skinId >>> 8), (byte) (skinId & 0xFF) };
}
public static byte[] writeMySkinCustom(CustomSkin customSkin) {