forked from GeyserMC/Geyser
Fixed customised skins causing strange display (#534)
* Fixed customised skins causing strange display * Cleaned up floodgate player checking * Fixed cape scale Co-authored-by: James Harrison <james@fasttortoise.co.uk>
This commit is contained in:
parent
c84c0f23cb
commit
0c60af66b2
4 changed files with 23 additions and 5 deletions
|
@ -341,7 +341,7 @@ public class GeyserSession implements CommandSender {
|
||||||
playerEntity.setUuid(profile.getId());
|
playerEntity.setUuid(profile.getId());
|
||||||
|
|
||||||
// Check if they are not using a linked account
|
// Check if they are not using a linked account
|
||||||
if (!playerEntity.getUuid().toString().startsWith("00000000-0000-0000")) {
|
if (connector.getAuthType() == AuthType.OFFLINE || playerEntity.getUuid().getMostSignificantBits() == 0) {
|
||||||
SkinUtils.handleBedrockSkin(playerEntity, clientData);
|
SkinUtils.handleBedrockSkin(playerEntity, clientData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,18 @@ public class BedrockClientData {
|
||||||
private String capeId;
|
private String capeId;
|
||||||
@JsonProperty(value = "CapeData")
|
@JsonProperty(value = "CapeData")
|
||||||
private byte[] capeData;
|
private byte[] capeData;
|
||||||
|
@JsonProperty(value = "CapeImageHeight")
|
||||||
|
private int capeImageHeight;
|
||||||
|
@JsonProperty(value = "CapeImageWidth")
|
||||||
|
private int capeImageWidth;
|
||||||
@JsonProperty(value = "CapeOnClassicSkin")
|
@JsonProperty(value = "CapeOnClassicSkin")
|
||||||
private boolean capeOnClassicSkin;
|
private boolean capeOnClassicSkin;
|
||||||
@JsonProperty(value = "SkinResourcePatch")
|
@JsonProperty(value = "SkinResourcePatch")
|
||||||
private String geometryName;
|
private String geometryName;
|
||||||
@JsonProperty(value = "SkinGeometryData")
|
@JsonProperty(value = "SkinGeometryData")
|
||||||
private String geometryData;
|
private String geometryData;
|
||||||
|
@JsonProperty(value = "PersonaSkin")
|
||||||
|
private boolean personaSkin;
|
||||||
@JsonProperty(value = "PremiumSkin")
|
@JsonProperty(value = "PremiumSkin")
|
||||||
private boolean premiumSkin;
|
private boolean premiumSkin;
|
||||||
|
|
||||||
|
@ -64,6 +70,15 @@ public class BedrockClientData {
|
||||||
@JsonProperty(value = "ClientRandomId")
|
@JsonProperty(value = "ClientRandomId")
|
||||||
private long clientRandomId;
|
private long clientRandomId;
|
||||||
|
|
||||||
|
@JsonProperty(value = "ArmSize")
|
||||||
|
private String armSize;
|
||||||
|
@JsonProperty(value = "SkinAnimationData")
|
||||||
|
private String skinAnimationData;
|
||||||
|
@JsonProperty(value = "SkinColor")
|
||||||
|
private String skinColor;
|
||||||
|
@JsonProperty(value = "ThirdPartyNameOnly")
|
||||||
|
private boolean thirdPartyNameOnly;
|
||||||
|
|
||||||
public enum UIProfile {
|
public enum UIProfile {
|
||||||
@JsonEnumDefaultValue
|
@JsonEnumDefaultValue
|
||||||
CLASSIC,
|
CLASSIC,
|
||||||
|
|
|
@ -223,7 +223,9 @@ public class SkinProvider {
|
||||||
|
|
||||||
// if the requested image is an cape
|
// if the requested image is an cape
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
image = image.getWidth() > 64 ? scale(image) : image;
|
while(image.getWidth() > 64) {
|
||||||
|
image = scale(image);
|
||||||
|
}
|
||||||
BufferedImage newImage = new BufferedImage(64, 32, BufferedImage.TYPE_INT_RGB);
|
BufferedImage newImage = new BufferedImage(64, 32, BufferedImage.TYPE_INT_RGB);
|
||||||
Graphics g = newImage.createGraphics();
|
Graphics g = newImage.createGraphics();
|
||||||
g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
|
g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
|
||||||
|
|
|
@ -220,13 +220,14 @@ public class SkinUtils {
|
||||||
byte[] geometryNameBytes = com.github.steveice10.mc.auth.util.Base64.decode(clientData.getGeometryName().getBytes("UTF-8"));
|
byte[] geometryNameBytes = com.github.steveice10.mc.auth.util.Base64.decode(clientData.getGeometryName().getBytes("UTF-8"));
|
||||||
byte[] geometryBytes = com.github.steveice10.mc.auth.util.Base64.decode(clientData.getGeometryData().getBytes("UTF-8"));
|
byte[] geometryBytes = com.github.steveice10.mc.auth.util.Base64.decode(clientData.getGeometryData().getBytes("UTF-8"));
|
||||||
|
|
||||||
if (skinBytes.length <= (128 * 128 * 4)) {
|
if (skinBytes.length <= (128 * 128 * 4) && !clientData.isPersonaSkin()) {
|
||||||
SkinProvider.storeBedrockSkin(playerEntity.getUuid(), data.getSkinUrl(), skinBytes);
|
SkinProvider.storeBedrockSkin(playerEntity.getUuid(), data.getSkinUrl(), skinBytes);
|
||||||
|
SkinProvider.storeBedrockGeometry(playerEntity.getUuid(), geometryNameBytes, geometryBytes);
|
||||||
} else {
|
} else {
|
||||||
GeyserConnector.getInstance().getLogger().info("Unable to load bedrock skin for '" + playerEntity.getUsername() + "' as they are using a customised skin");
|
GeyserConnector.getInstance().getLogger().info("Unable to load bedrock skin for '" + playerEntity.getUsername() + "' as they are likely using a customised skin");
|
||||||
GeyserConnector.getInstance().getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight());
|
GeyserConnector.getInstance().getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight());
|
||||||
}
|
}
|
||||||
SkinProvider.storeBedrockGeometry(playerEntity.getUuid(), geometryNameBytes, geometryBytes);
|
|
||||||
if (!clientData.getCapeId().equals("")) {
|
if (!clientData.getCapeId().equals("")) {
|
||||||
SkinProvider.storeBedrockCape(playerEntity.getUuid(), capeBytes);
|
SkinProvider.storeBedrockCape(playerEntity.getUuid(), capeBytes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue