Make head displayed more precisely
This commit is contained in:
@@ -95,7 +95,7 @@ public final class AccountHelper {
|
||||
|
||||
public static Image getHead(Image skin, int scaleRatio) {
|
||||
final int size = 8 * scaleRatio;
|
||||
final int faceOffset = (int) Math.floor(scaleRatio * 4d / 9d);
|
||||
final int faceOffset = (int) Math.round(scaleRatio * 4d / 9d);
|
||||
BufferedImage image = SwingFXUtils.fromFXImage(skin, null);
|
||||
BufferedImage head = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2d = head.createGraphics();
|
||||
|
||||
@@ -43,7 +43,11 @@ public final class UUIDTypeAdapter extends TypeAdapter<UUID> {
|
||||
|
||||
@Override
|
||||
public UUID read(JsonReader reader) throws IOException {
|
||||
return fromString(reader.nextString());
|
||||
try {
|
||||
return fromString(reader.nextString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new JsonParseException("UUID malformed");
|
||||
}
|
||||
}
|
||||
|
||||
public static String fromUUID(UUID value) {
|
||||
@@ -51,11 +55,7 @@ public final class UUIDTypeAdapter extends TypeAdapter<UUID> {
|
||||
}
|
||||
|
||||
public static UUID fromString(String input) {
|
||||
try {
|
||||
return UUID.fromString(input.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new JsonParseException("UUID malformed");
|
||||
}
|
||||
return UUID.fromString(input.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user