cleanup head renderer
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m47s

This commit is contained in:
Lee 2024-04-11 08:21:53 +01:00
parent 9debdece9e
commit 83a95fb26c

View File

@ -17,15 +17,17 @@ public class HeadRenderer extends SkinRenderer {
double scale = (double) size / 8d;
log.info("Getting {} part bytes for {} with size {} and scale {}", partName, skin.getUrl(), size, scale);
BufferedImage skinPart = this.getSkinPart(skin, Skin.PartPosition.HEAD_FACE, scale);
if (!renderOverlay) {
return super.getBytes(skinPart, skin, partName);
}
BufferedImage outputImage = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = outputImage.createGraphics();
graphics.drawImage(skinPart, 0, 0, null);
graphics.setTransform(AffineTransform.getScaleInstance(scale, scale));
graphics.drawImage(this.getSkinPart(skin, Skin.PartPosition.HEAD_FACE, 1), 0, 0, null);
if (renderOverlay) { // Render the skin layers
applyOverlay(outputImage, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY_FACE, 1));
}
// Apply the skin overlays
applyOverlay(outputImage, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY_FACE, scale));
return super.getBytes(outputImage, skin, partName);
}