From 0f72f9fa1d95121617a877e57277da56c2a905fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Sun, 10 Apr 2022 18:13:53 +0200 Subject: [PATCH] Fix player name stuff (#43) * Fix ClassLookups not being setup * Rebase (#41) * added 1.18.2 Support (#39) * Fix ClassLookups not being setup (#40) Co-authored-by: SyntaxJason <82037042+SyntaxJason@users.noreply.github.com> * Update version * Fix Co-authored-by: SyntaxJason <82037042+SyntaxJason@users.noreply.github.com> --- .../vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java | 4 ++-- .../vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java | 4 ++-- .../vcompat/provider/impl/v1_18_R2/entity/Player1_18_R2.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java index 1145314..9ba22fc 100644 --- a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java @@ -279,8 +279,8 @@ private final void update(boolean flag) { properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); } - String name = getName(); - if (name != null) { + String name = dataAdapter.get("name", WrapType.STRING); + if (name != null && !name.isBlank()) { VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java index a3ac23a..f2e209b 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java @@ -279,8 +279,8 @@ private final void update(boolean flag) { properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); } - String name = getName(); - if (name != null) { + String name = dataAdapter.get("name", WrapType.STRING); + if (name != null && !name.isBlank()) { VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } diff --git a/vcompat-1_18_R2/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R2/entity/Player1_18_R2.java b/vcompat-1_18_R2/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R2/entity/Player1_18_R2.java index e1d9383..f9e7817 100644 --- a/vcompat-1_18_R2/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R2/entity/Player1_18_R2.java +++ b/vcompat-1_18_R2/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R2/entity/Player1_18_R2.java @@ -279,8 +279,8 @@ private final void update(boolean flag) { properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); } - String name = getName(); - if (name != null) { + String name = dataAdapter.get("name", WrapType.STRING); + if (name != null && !name.isBlank()) { VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); }