-
-
Notifications
You must be signed in to change notification settings - Fork 811
Fix Cape Elytra textures #5968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix Cape Elytra textures #5968
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -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; | ||
|
|
||
| // Prefer looking up xuid using the session to catch linked players | ||
| if (playerSession != null) { | ||
| xuid = playerSession.getAuthData().xuid(); | ||
|
|
@@ -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); | ||
|
|
@@ -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)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick, maybeee use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
|
||
There was a problem hiding this comment.
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