add working skin layers and rename param for overlay
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m35s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m35s
This commit is contained in:
parent
f63d1cc3ec
commit
9b7b761ffd
@ -49,7 +49,7 @@ public class PlayerController {
|
||||
@Parameter(description = "The part of the skin", example = "head") @PathVariable String part,
|
||||
@Parameter(description = "The UUID or Username of the player", example = "ImFascinated") @PathVariable String id,
|
||||
@Parameter(description = "The size of the image", example = "256") @RequestParam(required = false, defaultValue = "256") int size,
|
||||
@Parameter(description = "Whether to render the skin overlay (skin layers)", example = "false") @RequestParam(required = false, defaultValue = "false") boolean renderOverlay,
|
||||
@Parameter(description = "Whether to render the skin overlay (skin layers)", example = "false") @RequestParam(required = false, defaultValue = "false") boolean overlay,
|
||||
@Parameter(description = "Whether to download the image") @RequestParam(required = false, defaultValue = "false") boolean download) {
|
||||
CachedPlayer player = playerService.getPlayer(id);
|
||||
Skin.Parts skinPart = Skin.Parts.fromName(part);
|
||||
@ -60,6 +60,6 @@ public class PlayerController {
|
||||
.cacheControl(cacheControl)
|
||||
.contentType(MediaType.IMAGE_PNG)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, dispositionHeader.formatted(player.getUsername()))
|
||||
.body(playerService.getSkinPart(player, skinPart, renderOverlay, size).getBytes());
|
||||
.body(playerService.getSkinPart(player, skinPart, overlay, size).getBytes());
|
||||
}
|
||||
}
|
||||
|
@ -148,41 +148,38 @@ public class Skin {
|
||||
/**
|
||||
* Skin postions
|
||||
*/
|
||||
HEAD(8, 8, 8, 8, new LegacyPartPositionData(8, 8, false)),
|
||||
HEAD(8, 8, 8, 8, null),
|
||||
HEAD_TOP(8, 0, 8, 8, null),
|
||||
HEAD_FRONT(8, 8, 8, 8, null),
|
||||
HEAD_RIGHT(0, 8, 8, 8, null),
|
||||
|
||||
BODY(20, 20, 8, 12, new LegacyPartPositionData(20, 20, false)),
|
||||
BODY(20, 20, 8, 12, null),
|
||||
BODY_BACK(20, 36, 8, 12, null),
|
||||
BODY_LEFT(32, 52, 8, 12, null),
|
||||
BODY_RIGHT(44, 20, 8, 12, null),
|
||||
|
||||
RIGHT_ARM(44, 20, 4, 12, new LegacyPartPositionData(44, 20, false)),
|
||||
RIGHT_ARM(44, 20, 4, 12, null),
|
||||
LEFT_ARM(36, 52, 4, 12, new LegacyPartPositionData(43, 20, true)),
|
||||
|
||||
RIGHT_LEG(4, 20, 4, 12, new LegacyPartPositionData(4, 20, false)),
|
||||
RIGHT_LEG(4, 20, 4, 12, null),
|
||||
LEFT_LEG(20, 52, 4, 12, new LegacyPartPositionData(3, 20, true)),
|
||||
|
||||
/**
|
||||
* Skin overlay (layer) positions
|
||||
*/
|
||||
HEAD_OVERLAY(40, 8, 8, 8, null),
|
||||
// todo: finish these below
|
||||
HEAD_OVERLAY_TOP(40, 0, 40, 0, null),
|
||||
HEAD_OVERLAY_FRONT(40, 8, 40, 8, null),
|
||||
HEAD_OVERLAY_RIGHT(32, 8, 32, 8, null),
|
||||
HEAD_OVERLAY_TOP(40, 0, 8, 8, null),
|
||||
HEAD_OVERLAY_FRONT(40, 8, 8, 8, null),
|
||||
HEAD_OVERLAY_RIGHT(32, 8, 8, 8, null),
|
||||
HEAD_OVERLAY_LEFT(48, 8, 8, 8, null),
|
||||
|
||||
BODY_OVERLAY(20, 32, 20, 12, null),
|
||||
BODY_OVERLAY_BACK(20, 36, 20, 12, null),
|
||||
BODY_OVERLAY_LEFT(32, 52, 32, 12, null),
|
||||
BODY_OVERLAY_RIGHT(44, 32, 44, 12, null),
|
||||
BODY_OVERLAY_FRONT(20, 36, 8, 12, null),
|
||||
|
||||
RIGHT_ARM_OVERLAY(44, 32, 44, 12, null),
|
||||
LEFT_ARM_OVERLAY(36, 52, 36, 12, null),
|
||||
RIGHT_ARM_OVERLAY(44, 36, 8, 12, null),
|
||||
LEFT_ARM_OVERLAY(52, 52, 8, 12, null),
|
||||
|
||||
RIGHT_LEG_OVERLAY(4, 32, 4, 12, null),
|
||||
LEFT_LEG_OVERLAY(20, 52, 20, 12, null);
|
||||
RIGHT_LEG_OVERLAY(4, 36, 4, 12, null),
|
||||
LEFT_LEG_OVERLAY(4, 52, 20, 12, null);
|
||||
|
||||
/**
|
||||
* The x, and y position of the part.
|
||||
|
@ -34,7 +34,7 @@ public class BodyRenderer extends SkinRenderer {
|
||||
if (renderOverlay) { // Render the skin layers
|
||||
Graphics2D overlayGraphics = head.createGraphics();
|
||||
|
||||
applyOverlay(overlayGraphics, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY, 1));
|
||||
applyOverlay(overlayGraphics, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY_FRONT, 1));
|
||||
}
|
||||
|
||||
// Draw the body
|
||||
|
@ -25,7 +25,7 @@ public class HeadRenderer extends SkinRenderer {
|
||||
graphics.drawImage(this.getSkinPart(skin, Skin.PartPosition.HEAD, 1), 0, 0, null);
|
||||
|
||||
if (renderOverlay) { // Render the skin layers
|
||||
applyOverlay(outputImage.createGraphics(), this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY, 1));
|
||||
applyOverlay(outputImage.createGraphics(), this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY_FRONT, 1));
|
||||
}
|
||||
|
||||
return super.getBytes(outputImage, skin, partName);
|
||||
|
@ -42,7 +42,7 @@ public class IsometricHeadRenderer extends SkinRenderer {
|
||||
|
||||
if (renderOverlay) { // Render the skin layers
|
||||
Graphics2D headGraphics = headTop.createGraphics();
|
||||
applyOverlay(headGraphics, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY, 1));
|
||||
applyOverlay(headGraphics, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY_TOP, 1));
|
||||
|
||||
headGraphics = headFront.createGraphics();
|
||||
applyOverlay(headGraphics, this.getSkinPart(skin, Skin.PartPosition.HEAD_OVERLAY_FRONT, 1));
|
||||
|
Loading…
Reference in New Issue
Block a user