Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Merge branch 'master' of https://github.com/GeyserMC/Geyser into server-inventory
Dieser Commit ist enthalten in:
Commit
7fde39f247
@ -412,15 +412,32 @@ public class SkinProvider {
|
|||||||
|
|
||||||
// if the requested image is a cape
|
// if the requested image is a cape
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
if (image.getWidth() > 64) {
|
if (image.getWidth() > 64 || image.getHeight() > 32) {
|
||||||
image = scale(image, 64, 32);
|
// Prevent weirdly-scaled capes from being cut off
|
||||||
|
BufferedImage newImage = new BufferedImage(128, 64, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics g = newImage.createGraphics();
|
||||||
|
g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
|
||||||
|
g.dispose();
|
||||||
|
image.flush();
|
||||||
|
image = scale(newImage, 64, 32);
|
||||||
|
} else if (image.getWidth() < 64 || image.getHeight() < 32) {
|
||||||
|
// Bedrock doesn't like smaller-sized capes, either.
|
||||||
|
BufferedImage newImage = new BufferedImage(64, 32, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics g = newImage.createGraphics();
|
||||||
|
g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
|
||||||
|
g.dispose();
|
||||||
|
image.flush();
|
||||||
|
image = newImage;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Very rarely, skins can be larger than Minecraft's default.
|
// Very rarely, skins can be larger than Minecraft's default.
|
||||||
// Bedrock will not render anything above a width of 128.
|
// Bedrock will not render anything above a width of 128.
|
||||||
if (image.getWidth() > 128) {
|
if (image.getWidth() > 128) {
|
||||||
image = scale(image, 128, image.getHeight() / (image.getWidth() / 128));
|
// On Height: Scale by the amount we divided width by, or simply cut down to 128
|
||||||
|
image = scale(image, 128, image.getHeight() >= 256 ? (image.getHeight() / (image.getWidth() / 128)) : 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO remove alpha channel
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] data = bufferedImageToImageData(image);
|
byte[] data = bufferedImageToImageData(image);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren