Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions core/src/main/java/org/geysermc/geyser/skin/SkinManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ public static PlayerListPacket.Entry buildCachedEntry(GeyserSession session, Ava
Color color = session.getWaypointCache().getWaypointColor(playerEntity.getUuid()).orElse(Color.WHITE);

return buildEntryManually(
session,
playerEntity.getUuid(),
playerEntity.getUsername(),
playerEntity.getGeyserId(),
skin,
cape,
geometry,
color
session,
playerEntity.getUuid(),
playerEntity.getUsername(),
playerEntity.getGeyserId(),
skin,
cape,
geometry,
color
);
}

Expand All @@ -124,12 +124,13 @@ public static PlayerListPacket.Entry buildEntryManually(GeyserSession session, U
Skin skin,
Cape cape,
SkinGeometry geometry, Color color) {
SerializedSkin serializedSkin = getSkin(session, skin.textureUrl(), skin, cape, geometry);

// This attempts to find the XUID of the player so profile images show up for Xbox accounts
String xuid = "";
GeyserSession playerSession = GeyserImpl.getInstance().connectionByUuid(uuid);

boolean isPersona = false;
boolean isCapeOnClassic = true;
Comment on lines +131 to +132
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these local variables? Doesn't seem like they're used for anything else


// Prefer looking up xuid using the session to catch linked players
if (playerSession != null) {
xuid = playerSession.getAuthData().xuid();
Expand All @@ -146,6 +147,7 @@ public static PlayerListPacket.Entry buildEntryManually(GeyserSession session, U
} else {
entry = new PlayerListPacket.Entry(uuid);
}
SerializedSkin serializedSkin = getSkin(session, skin.textureUrl(), skin, cape, geometry, isPersona, isCapeOnClassic);

entry.setName(username);
entry.setEntityId(geyserId);
Expand Down Expand Up @@ -185,24 +187,28 @@ public static void sendSkinPacket(GeyserSession session, AvatarEntity entity, Sk
packet.setUuid(entity.getUuid());
packet.setOldSkinName("");
packet.setNewSkinName(skin.textureUrl());
packet.setSkin(getSkin(session, skin.textureUrl(), skin, cape, geometry));
packet.setSkin(getSkin(session, skin.textureUrl(), skin, cape, geometry, false, true));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, maybeee use isPersona, isCapeOnClassic instead of false, true here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont really see a reason for this considering java players are considered classic skins anyway

packet.setTrustedSkin(true);
session.sendUpstreamPacket(packet);
}
}

private static SerializedSkin getSkin(GeyserSession session, String skinId, Skin skin, Cape cape, SkinGeometry geometry) {
private static SerializedSkin getSkin(GeyserSession session, String skinId, Skin skin, Cape cape, SkinGeometry geometry,
boolean persona, boolean capeOnClassic) {

return SerializedSkin.builder()
.skinId(skinId)
.skinResourcePatch(geometry.geometryName())
.skinData(ImageData.of(skin.skinData()))
.capeId(cape.capeId())
.capeData(ImageData.of(cape.capeData()))
.geometryData(geometry.geometryData().isBlank() ? GEOMETRY : geometry.geometryData())
.premium(true)
.capeId(cape.capeId())
.fullSkinId(skinId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

.geometryDataEngineVersion(session.getClientData().getGameVersion())
.build();
.premium(false)
// These are needed to ensure that Elytra cape textures work
.persona(persona)
.capeOnClassic(capeOnClassic)
.build();
}

public static CompletableFuture<GameProfile> resolveProfile(ResolvableProfile profile) {
Expand Down