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

@ -118,14 +118,14 @@ public class ImageData {
if((spx & 0xFF000000) == 0xFF000000 || (dpx & 0xFF000000) == 0) {
pixels[di] = spx;
}else {
int sa = (spx >> 24) & 0xFF;
int da = (dpx >> 24) & 0xFF;
int r = ((spx >> 16) & 0xFF) * sa / 255;
int g = ((spx >> 8) & 0xFF) * sa / 255;
int sa = (spx >>> 24) & 0xFF;
int da = (dpx >>> 24) & 0xFF;
int r = ((spx >>> 16) & 0xFF) * sa / 255;
int g = ((spx >>> 8) & 0xFF) * sa / 255;
int b = (spx & 0xFF) * sa / 255;
int aa = (255 - sa) * da;
r += ((dpx >> 16) & 0xFF) * aa / 65025;
g += ((dpx >> 8) & 0xFF) * aa / 65025;
r += ((dpx >>> 16) & 0xFF) * aa / 65025;
g += ((dpx >>> 8) & 0xFF) * aa / 65025;
b += (dpx & 0xFF) * aa / 65025;
sa += da;
if(sa > 0xFF) sa = 0xFF;
@ -138,14 +138,14 @@ public class ImageData {
public ImageData swapRB() {
for(int i = 0; i < pixels.length; ++i) {
int j = pixels[i];
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) |
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >>> 16) |
((j & 0x000000FF) << 16);
}
return this;
}
public static int swapRB(int c) {
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >>> 16) | ((c & 0x000000FF) << 16);
}
}

View File

@ -413,7 +413,7 @@ public class InstancedFontRenderer {
buf.putShort((short)y);
buf.put((byte)cx);
buf.put((byte)cy);
color = ((color >> 1) & 0x7F000000) | (color & 0xFFFFFF);
color = ((color >>> 1) & 0x7F000000) | (color & 0xFFFFFF);
if(italic) {
color |= 0x80000000;
}
@ -438,7 +438,7 @@ public class InstancedFontRenderer {
buf.putShort((short)y);
buf.put((byte)cx);
buf.put((byte)cy);
color = ((color >> 1) & 0x7F000000) | (color & 0xFFFFFF);
color = ((color >>> 1) & 0x7F000000) | (color & 0xFFFFFF);
if(italic) {
color |= 0x80000000;
}

View File

@ -267,8 +267,8 @@ public class WorldRenderer {
if (!this.needsUpdate) {
j = this.intBuffer.get(i);
int k = (int) ((float) (j & 255) * red);
int l = (int) ((float) (j >> 8 & 255) * green);
int i1 = (int) ((float) (j >> 16 & 255) * blue);
int l = (int) ((float) (j >>> 8 & 255) * green);
int i1 = (int) ((float) (j >>> 16 & 255) * blue);
j = j & -16777216;
j = j | i1 << 16 | l << 8 | k;
}
@ -280,10 +280,10 @@ public class WorldRenderer {
*/
private void putColor(int argb, int parInt2) {
int i = this.getColorIndex(parInt2);
int j = argb >> 16 & 255;
int k = argb >> 8 & 255;
int j = argb >>> 16 & 255;
int k = argb >>> 8 & 255;
int l = argb & 255;
int i1 = argb >> 24 & 255;
int i1 = argb >>> 24 & 255;
this.putColorRGBA(i, j, k, l, i1);
}