Skip to content

Commit f93bc73

Browse files
committed
fixed #1216
1 parent 054bdf8 commit f93bc73

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

common/src/main/java/net/conczin/mca/network/c2s/VillagerEditorSyncRequest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,12 @@ private void syncFamilyTree(ServerPlayer player, Entity entity, CompoundTag vill
170170
entry.setGender(getGender(data));
171171

172172
String s = villagerData.getString("CustomName");
173-
try {
174-
entry.setName(Objects.requireNonNull(Component.Serializer.fromJson(s, entity.registryAccess())).getString());
175-
} catch (Exception e) {
176-
MCA.LOGGER.error("Failed to parse custom name for villager: {}", s, e);
173+
if (!s.isEmpty()) {
174+
try {
175+
entry.setName(Objects.requireNonNull(Component.Serializer.fromJson(s, entity.registryAccess())).getString());
176+
} catch (Exception e) {
177+
MCA.LOGGER.error("Failed to parse custom name for villager: {}", s, e);
178+
}
177179
}
178180

179181
if (villagerData.contains("FamilyTreeNewFatherName")) {

0 commit comments

Comments
 (0)