add skin overlays to all images if it's enabled
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:
@ -59,12 +59,14 @@ public interface ISkinPart {
|
||||
@Getter
|
||||
enum Vanilla implements ISkinPart {
|
||||
// Overlays
|
||||
HEAD_OVERLAY_TOP(true, new Coordinates(40, 0), 8, 8),
|
||||
HEAD_OVERLAY_FACE(true, new Coordinates(40, 8), 8, 8),
|
||||
HEAD_OVERLAY_LEFT(true, new Coordinates(48, 8), 8, 8),
|
||||
|
||||
// Head
|
||||
HEAD_TOP(true, new Coordinates(8, 0), 8, 8),
|
||||
HEAD_TOP(true, new Coordinates(8, 0), 8, 8, HEAD_OVERLAY_TOP),
|
||||
FACE(false, new Coordinates(8, 8), 8, 8, HEAD_OVERLAY_FACE),
|
||||
HEAD_LEFT(true, new Coordinates(0, 8), 8, 8),
|
||||
HEAD_LEFT(true, new Coordinates(0, 8), 8, 8, HEAD_OVERLAY_LEFT),
|
||||
HEAD_RIGHT(true, new Coordinates(16, 8), 8, 8),
|
||||
HEAD_BOTTOM(true, new Coordinates(16, 0), 8, 8),
|
||||
HEAD_BACK(true, new Coordinates(24, 8), 8, 8),
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cc.fascinated.model.skin;
|
||||
|
||||
import cc.fascinated.common.EnumUtils;
|
||||
import cc.fascinated.common.PlayerUtils;
|
||||
import cc.fascinated.config.Config;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@ -77,9 +78,10 @@ public class Skin {
|
||||
}
|
||||
String url = json.get("url").getAsString();
|
||||
JsonObject metadata = json.getAsJsonObject("metadata");
|
||||
Model model = Model.fromName(metadata == null ? "default" : // Fall back to slim if the model is not found
|
||||
metadata.get("model").getAsString());
|
||||
return new Skin(url, model);
|
||||
return new Skin(
|
||||
url,
|
||||
EnumUtils.getEnumConstant(Model.class, metadata != null ? metadata.get("model").getAsString() : "DEFAULT")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,21 +108,6 @@ public class Skin {
|
||||
*/
|
||||
public enum Model {
|
||||
DEFAULT,
|
||||
SLIM;
|
||||
|
||||
/**
|
||||
* Gets the model from its name.
|
||||
*
|
||||
* @param name the name of the model
|
||||
* @return the model
|
||||
*/
|
||||
public static Model fromName(String name) {
|
||||
for (Model model : values()) {
|
||||
if (model.name().equalsIgnoreCase(name)) {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
SLIM
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user