aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/server/PlayerAdvancements.java.patch
blob: 9bd25106d5aeacedbe99cfd299e0952788b82de8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
--- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java
@@ -10,17 +10,19 @@
 import com.mojang.logging.LogUtils;
 import com.mojang.serialization.Codec;
 import com.mojang.serialization.JsonOps;
+import java.io.BufferedWriter;
 import java.io.IOException;
-import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
+import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 import java.util.function.BiConsumer;
 import javax.annotation.Nullable;
 import net.minecraft.FileUtil;
@@ -34,7 +36,6 @@
 import net.minecraft.advancements.CriterionProgress;
 import net.minecraft.advancements.CriterionTrigger;
 import net.minecraft.advancements.CriterionTriggerInstance;
-import net.minecraft.advancements.DisplayInfo;
 import net.minecraft.core.registries.BuiltInRegistries;
 import net.minecraft.network.protocol.game.ClientboundSelectAdvancementsTabPacket;
 import net.minecraft.network.protocol.game.ClientboundUpdateAdvancementsPacket;
@@ -47,28 +48,30 @@
 import org.slf4j.Logger;
 
 public class PlayerAdvancements {
+
     private static final Logger LOGGER = LogUtils.getLogger();
-    private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
+    private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create();
     private final PlayerList playerList;
     private final Path playerSavePath;
     private AdvancementTree tree;
-    private final Map<AdvancementHolder, AdvancementProgress> progress = new LinkedHashMap<>();
-    private final Set<AdvancementHolder> visible = new HashSet<>();
-    private final Set<AdvancementHolder> progressChanged = new HashSet<>();
-    private final Set<AdvancementNode> rootsToUpdate = new HashSet<>();
+    private final Map<AdvancementHolder, AdvancementProgress> progress = new LinkedHashMap();
+    private final Set<AdvancementHolder> visible = new HashSet();
+    private final Set<AdvancementHolder> progressChanged = new HashSet();
+    private final Set<AdvancementNode> rootsToUpdate = new HashSet();
     private ServerPlayer player;
     @Nullable
     private AdvancementHolder lastSelectedTab;
     private boolean isFirstPacket = true;
-    private final Codec<PlayerAdvancements.Data> codec;
+    private final Codec<PlayerAdvancements.a> codec;
 
     public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) {
         this.playerList = playerList;
         this.playerSavePath = playerSavePath;
         this.player = player;
         this.tree = manager.tree();
-        int i = 1343;
-        this.codec = DataFixTypes.ADVANCEMENTS.wrapCodec(PlayerAdvancements.Data.CODEC, dataFixer, 1343);
+        boolean flag = true;
+
+        this.codec = DataFixTypes.ADVANCEMENTS.wrapCodec(PlayerAdvancements.a.CODEC, dataFixer, 1343);
         this.load(manager);
     }
 
@@ -77,9 +80,14 @@
     }
 
     public void stopListening() {
-        for (CriterionTrigger<?> criterionTrigger : BuiltInRegistries.TRIGGER_TYPES) {
-            criterionTrigger.removePlayerListeners(this);
+        Iterator iterator = BuiltInRegistries.TRIGGER_TYPES.iterator();
+
+        while (iterator.hasNext()) {
+            CriterionTrigger<?> criteriontrigger = (CriterionTrigger) iterator.next();
+
+            criteriontrigger.removePlayerListeners(this);
         }
+
     }
 
     public void reload(ServerAdvancementManager manager) {
@@ -95,32 +103,57 @@
     }
 
     private void registerListeners(ServerAdvancementManager manager) {
-        for (AdvancementHolder advancementHolder : manager.getAllAdvancements()) {
-            this.registerListeners(advancementHolder);
+        Iterator iterator = manager.getAllAdvancements().iterator();
+
+        while (iterator.hasNext()) {
+            AdvancementHolder advancementholder = (AdvancementHolder) iterator.next();
+
+            this.registerListeners(advancementholder);
         }
+
     }
 
     private void checkForAutomaticTriggers(ServerAdvancementManager manager) {
-        for (AdvancementHolder advancementHolder : manager.getAllAdvancements()) {
-            Advancement advancement = advancementHolder.value();
+        Iterator iterator = manager.getAllAdvancements().iterator();
+
+        while (iterator.hasNext()) {
+            AdvancementHolder advancementholder = (AdvancementHolder) iterator.next();
+            Advancement advancement = advancementholder.value();
+
             if (advancement.criteria().isEmpty()) {
-                this.award(advancementHolder, "");
+                this.award(advancementholder, "");
                 advancement.rewards().grant(this.player);
             }
         }
+
     }
 
     private void load(ServerAdvancementManager manager) {
-        if (Files.isRegularFile(this.playerSavePath)) {
-            try (JsonReader jsonReader = new JsonReader(Files.newBufferedReader(this.playerSavePath, StandardCharsets.UTF_8))) {
-                jsonReader.setLenient(false);
-                JsonElement jsonElement = Streams.parse(jsonReader);
-                PlayerAdvancements.Data data = Util.getOrThrow(this.codec.parse(JsonOps.INSTANCE, jsonElement), JsonParseException::new);
-                this.applyFrom(manager, data);
-            } catch (JsonParseException var7) {
-                LOGGER.error("Couldn't parse player advancements in {}", this.playerSavePath, var7);
-            } catch (IOException var8) {
-                LOGGER.error("Couldn't access player advancements in {}", this.playerSavePath, var8);
+        if (Files.isRegularFile(this.playerSavePath, new LinkOption[0])) {
+            try {
+                JsonReader jsonreader = new JsonReader(Files.newBufferedReader(this.playerSavePath, StandardCharsets.UTF_8));
+
+                try {
+                    jsonreader.setLenient(false);
+                    JsonElement jsonelement = Streams.parse(jsonreader);
+                    PlayerAdvancements.a advancementdataplayer_a = (PlayerAdvancements.a) Util.getOrThrow(this.codec.parse(JsonOps.INSTANCE, jsonelement), JsonParseException::new);
+
+                    this.applyFrom(manager, advancementdataplayer_a);
+                } catch (Throwable throwable) {
+                    try {
+                        jsonreader.close();
+                    } catch (Throwable throwable1) {
+                        throwable.addSuppressed(throwable1);
+                    }
+
+                    throw throwable;
+                }
+
+                jsonreader.close();
+            } catch (JsonParseException jsonparseexception) {
+                PlayerAdvancements.LOGGER.error("Couldn't parse player advancements in {}", this.playerSavePath, jsonparseexception);
+            } catch (IOException ioexception) {
+                PlayerAdvancements.LOGGER.error("Couldn't access player advancements in {}", this.playerSavePath, ioexception);
             }
         }
 
@@ -129,137 +162,179 @@
     }
 
     public void save() {
-        JsonElement jsonElement = Util.getOrThrow(this.codec.encodeStart(JsonOps.INSTANCE, this.asData()), IllegalStateException::new);
+        JsonElement jsonelement = (JsonElement) Util.getOrThrow(this.codec.encodeStart(JsonOps.INSTANCE, this.asData()), IllegalStateException::new);
 
         try {
             FileUtil.createDirectoriesSafe(this.playerSavePath.getParent());
+            BufferedWriter bufferedwriter = Files.newBufferedWriter(this.playerSavePath, StandardCharsets.UTF_8);
 
-            try (Writer bufferedWriter = Files.newBufferedWriter(this.playerSavePath, StandardCharsets.UTF_8)) {
-                GSON.toJson(jsonElement, bufferedWriter);
+            try {
+                PlayerAdvancements.GSON.toJson(jsonelement, bufferedwriter);
+            } catch (Throwable throwable) {
+                if (bufferedwriter != null) {
+                    try {
+                        bufferedwriter.close();
+                    } catch (Throwable throwable1) {
+                        throwable.addSuppressed(throwable1);
+                    }
+                }
+
+                throw throwable;
             }
-        } catch (IOException var7) {
-            LOGGER.error("Couldn't save player advancements to {}", this.playerSavePath, var7);
+
+            if (bufferedwriter != null) {
+                bufferedwriter.close();
+            }
+        } catch (IOException ioexception) {
+            PlayerAdvancements.LOGGER.error("Couldn't save player advancements to {}", this.playerSavePath, ioexception);
         }
+
     }
 
-    private void applyFrom(ServerAdvancementManager serverAdvancementManager, PlayerAdvancements.Data data) {
-        data.forEach((resourceLocation, advancementProgress) -> {
-            AdvancementHolder advancementHolder = serverAdvancementManager.get(resourceLocation);
-            if (advancementHolder == null) {
-                LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", resourceLocation, this.playerSavePath);
+    private void applyFrom(ServerAdvancementManager advancementdataworld, PlayerAdvancements.a advancementdataplayer_a) {
+        advancementdataplayer_a.forEach((minecraftkey, advancementprogress) -> {
+            AdvancementHolder advancementholder = advancementdataworld.get(minecraftkey);
+
+            if (advancementholder == null) {
+                if (!minecraftkey.getNamespace().equals("minecraft")) return; // CraftBukkit
+                PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath);
             } else {
-                this.startProgress(advancementHolder, advancementProgress);
-                this.progressChanged.add(advancementHolder);
-                this.markForVisibilityUpdate(advancementHolder);
+                this.startProgress(advancementholder, advancementprogress);
+                this.progressChanged.add(advancementholder);
+                this.markForVisibilityUpdate(advancementholder);
             }
         });
     }
 
-    private PlayerAdvancements.Data asData() {
-        Map<ResourceLocation, AdvancementProgress> map = new LinkedHashMap<>();
-        this.progress.forEach((advancementHolder, advancementProgress) -> {
-            if (advancementProgress.hasProgress()) {
-                map.put(advancementHolder.id(), advancementProgress);
+    private PlayerAdvancements.a asData() {
+        Map<ResourceLocation, AdvancementProgress> map = new LinkedHashMap();
+
+        this.progress.forEach((advancementholder, advancementprogress) -> {
+            if (advancementprogress.hasProgress()) {
+                map.put(advancementholder.id(), advancementprogress);
             }
+
         });
-        return new PlayerAdvancements.Data(map);
+        return new PlayerAdvancements.a(map);
     }
 
-    public boolean award(AdvancementHolder advancementHolder, String string) {
+    public boolean award(AdvancementHolder advancementholder, String s) {
         boolean flag = false;
-        AdvancementProgress orStartProgress = this.getOrStartProgress(advancementHolder);
-        boolean isDone = orStartProgress.isDone();
-        if (orStartProgress.grantProgress(string)) {
-            this.unregisterListeners(advancementHolder);
-            this.progressChanged.add(advancementHolder);
+        AdvancementProgress advancementprogress = this.getOrStartProgress(advancementholder);
+        boolean flag1 = advancementprogress.isDone();
+
+        if (advancementprogress.grantProgress(s)) {
+            this.unregisterListeners(advancementholder);
+            this.progressChanged.add(advancementholder);
             flag = true;
-            if (!isDone && orStartProgress.isDone()) {
-                advancementHolder.value().rewards().grant(this.player);
-                advancementHolder.value().display().ifPresent(displayInfo -> {
-                    if (displayInfo.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
-                        this.playerList.broadcastSystemMessage(displayInfo.getType().createAnnouncement(advancementHolder, this.player), false);
+            if (!flag1 && advancementprogress.isDone()) {
+                this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancementholder.toBukkit())); // CraftBukkit
+                advancementholder.value().rewards().grant(this.player);
+                advancementholder.value().display().ifPresent((advancementdisplay) -> {
+                    if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+                        this.playerList.broadcastSystemMessage(advancementdisplay.getType().createAnnouncement(advancementholder, this.player), false);
                     }
+
                 });
             }
         }
 
-        if (!isDone && orStartProgress.isDone()) {
-            this.markForVisibilityUpdate(advancementHolder);
+        if (!flag1 && advancementprogress.isDone()) {
+            this.markForVisibilityUpdate(advancementholder);
         }
 
         return flag;
     }
 
-    public boolean revoke(AdvancementHolder advancementHolder, String string) {
+    public boolean revoke(AdvancementHolder advancementholder, String s) {
         boolean flag = false;
-        AdvancementProgress orStartProgress = this.getOrStartProgress(advancementHolder);
-        boolean isDone = orStartProgress.isDone();
-        if (orStartProgress.revokeProgress(string)) {
-            this.registerListeners(advancementHolder);
-            this.progressChanged.add(advancementHolder);
+        AdvancementProgress advancementprogress = this.getOrStartProgress(advancementholder);
+        boolean flag1 = advancementprogress.isDone();
+
+        if (advancementprogress.revokeProgress(s)) {
+            this.registerListeners(advancementholder);
+            this.progressChanged.add(advancementholder);
             flag = true;
         }
 
-        if (isDone && !orStartProgress.isDone()) {
-            this.markForVisibilityUpdate(advancementHolder);
+        if (flag1 && !advancementprogress.isDone()) {
+            this.markForVisibilityUpdate(advancementholder);
         }
 
         return flag;
     }
 
-    private void markForVisibilityUpdate(AdvancementHolder advancementHolder) {
-        AdvancementNode advancementNode = this.tree.get(advancementHolder);
-        if (advancementNode != null) {
-            this.rootsToUpdate.add(advancementNode.root());
+    private void markForVisibilityUpdate(AdvancementHolder advancementholder) {
+        AdvancementNode advancementnode = this.tree.get(advancementholder);
+
+        if (advancementnode != null) {
+            this.rootsToUpdate.add(advancementnode.root());
         }
+
     }
 
-    private void registerListeners(AdvancementHolder advancementHolder) {
-        AdvancementProgress orStartProgress = this.getOrStartProgress(advancementHolder);
-        if (!orStartProgress.isDone()) {
-            for (Entry<String, Criterion<?>> entry : advancementHolder.value().criteria().entrySet()) {
-                CriterionProgress criterion = orStartProgress.getCriterion(entry.getKey());
-                if (criterion != null && !criterion.isDone()) {
-                    this.registerListener(advancementHolder, entry.getKey(), entry.getValue());
+    private void registerListeners(AdvancementHolder advancementholder) {
+        AdvancementProgress advancementprogress = this.getOrStartProgress(advancementholder);
+
+        if (!advancementprogress.isDone()) {
+            Iterator iterator = advancementholder.value().criteria().entrySet().iterator();
+
+            while (iterator.hasNext()) {
+                Entry<String, Criterion<?>> entry = (Entry) iterator.next();
+                CriterionProgress criterionprogress = advancementprogress.getCriterion((String) entry.getKey());
+
+                if (criterionprogress != null && !criterionprogress.isDone()) {
+                    this.registerListener(advancementholder, (String) entry.getKey(), (Criterion) entry.getValue());
                 }
             }
+
         }
     }
 
-    private <T extends CriterionTriggerInstance> void registerListener(AdvancementHolder advancementHolder, String string, Criterion<T> criterion) {
-        criterion.trigger().addPlayerListener(this, new CriterionTrigger.Listener<>(criterion.triggerInstance(), advancementHolder, string));
+    private <T extends CriterionTriggerInstance> void registerListener(AdvancementHolder advancementholder, String s, Criterion<T> criterion) {
+        criterion.trigger().addPlayerListener(this, new CriterionTrigger.Listener<>(criterion.triggerInstance(), advancementholder, s));
     }
 
-    private void unregisterListeners(AdvancementHolder advancementHolder) {
-        AdvancementProgress orStartProgress = this.getOrStartProgress(advancementHolder);
+    private void unregisterListeners(AdvancementHolder advancementholder) {
+        AdvancementProgress advancementprogress = this.getOrStartProgress(advancementholder);
+        Iterator iterator = advancementholder.value().criteria().entrySet().iterator();
 
-        for (Entry<String, Criterion<?>> entry : advancementHolder.value().criteria().entrySet()) {
-            CriterionProgress criterion = orStartProgress.getCriterion(entry.getKey());
-            if (criterion != null && (criterion.isDone() || orStartProgress.isDone())) {
-                this.removeListener(advancementHolder, entry.getKey(), entry.getValue());
+        while (iterator.hasNext()) {
+            Entry<String, Criterion<?>> entry = (Entry) iterator.next();
+            CriterionProgress criterionprogress = advancementprogress.getCriterion((String) entry.getKey());
+
+            if (criterionprogress != null && (criterionprogress.isDone() || advancementprogress.isDone())) {
+                this.removeListener(advancementholder, (String) entry.getKey(), (Criterion) entry.getValue());
             }
         }
+
     }
 
-    private <T extends CriterionTriggerInstance> void removeListener(AdvancementHolder advancementHolder, String string, Criterion<T> criterion) {
-        criterion.trigger().removePlayerListener(this, new CriterionTrigger.Listener<>(criterion.triggerInstance(), advancementHolder, string));
+    private <T extends CriterionTriggerInstance> void removeListener(AdvancementHolder advancementholder, String s, Criterion<T> criterion) {
+        criterion.trigger().removePlayerListener(this, new CriterionTrigger.Listener<>(criterion.triggerInstance(), advancementholder, s));
     }
 
     public void flushDirty(ServerPlayer serverPlayer) {
         if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) {
-            Map<ResourceLocation, AdvancementProgress> map = new HashMap<>();
-            Set<AdvancementHolder> set = new HashSet<>();
-            Set<ResourceLocation> set1 = new HashSet<>();
+            Map<ResourceLocation, AdvancementProgress> map = new HashMap();
+            Set<AdvancementHolder> set = new HashSet();
+            Set<ResourceLocation> set1 = new HashSet();
+            Iterator iterator = this.rootsToUpdate.iterator();
 
-            for (AdvancementNode advancementNode : this.rootsToUpdate) {
-                this.updateTreeVisibility(advancementNode, set, set1);
+            while (iterator.hasNext()) {
+                AdvancementNode advancementnode = (AdvancementNode) iterator.next();
+
+                this.updateTreeVisibility(advancementnode, set, set1);
             }
 
             this.rootsToUpdate.clear();
+            iterator = this.progressChanged.iterator();
 
-            for (AdvancementHolder advancementHolder : this.progressChanged) {
-                if (this.visible.contains(advancementHolder)) {
-                    map.put(advancementHolder.id(), this.progress.get(advancementHolder));
+            while (iterator.hasNext()) {
+                AdvancementHolder advancementholder = (AdvancementHolder) iterator.next();
+
+                if (this.visible.contains(advancementholder)) {
+                    map.put(advancementholder.id(), (AdvancementProgress) this.progress.get(advancementholder));
                 }
             }
 
@@ -272,58 +347,65 @@
         this.isFirstPacket = false;
     }
 
-    public void setSelectedTab(@Nullable AdvancementHolder advancementHolder) {
-        AdvancementHolder advancementHolder1 = this.lastSelectedTab;
-        if (advancementHolder != null && advancementHolder.value().isRoot() && advancementHolder.value().display().isPresent()) {
-            this.lastSelectedTab = advancementHolder;
+    public void setSelectedTab(@Nullable AdvancementHolder advancementholder) {
+        AdvancementHolder advancementholder1 = this.lastSelectedTab;
+
+        if (advancementholder != null && advancementholder.value().isRoot() && advancementholder.value().display().isPresent()) {
+            this.lastSelectedTab = advancementholder;
         } else {
             this.lastSelectedTab = null;
         }
 
-        if (advancementHolder1 != this.lastSelectedTab) {
+        if (advancementholder1 != this.lastSelectedTab) {
             this.player.connection.send(new ClientboundSelectAdvancementsTabPacket(this.lastSelectedTab == null ? null : this.lastSelectedTab.id()));
         }
+
     }
 
-    public AdvancementProgress getOrStartProgress(AdvancementHolder advancementHolder) {
-        AdvancementProgress advancementProgress = this.progress.get(advancementHolder);
-        if (advancementProgress == null) {
-            advancementProgress = new AdvancementProgress();
-            this.startProgress(advancementHolder, advancementProgress);
+    public AdvancementProgress getOrStartProgress(AdvancementHolder advancementholder) {
+        AdvancementProgress advancementprogress = (AdvancementProgress) this.progress.get(advancementholder);
+
+        if (advancementprogress == null) {
+            advancementprogress = new AdvancementProgress();
+            this.startProgress(advancementholder, advancementprogress);
         }
 
-        return advancementProgress;
+        return advancementprogress;
     }
 
-    private void startProgress(AdvancementHolder advancementHolder, AdvancementProgress advancementProgress) {
-        advancementProgress.update(advancementHolder.value().requirements());
-        this.progress.put(advancementHolder, advancementProgress);
+    private void startProgress(AdvancementHolder advancementholder, AdvancementProgress advancementprogress) {
+        advancementprogress.update(advancementholder.value().requirements());
+        this.progress.put(advancementholder, advancementprogress);
     }
 
-    private void updateTreeVisibility(AdvancementNode advancementNode, Set<AdvancementHolder> set, Set<ResourceLocation> set1) {
-        AdvancementVisibilityEvaluator.evaluateVisibility(
-            advancementNode, advancementNode1 -> this.getOrStartProgress(advancementNode1.holder()).isDone(), (advancementNode1, flag) -> {
-                AdvancementHolder advancementHolder = advancementNode1.holder();
-                if (flag) {
-                    if (this.visible.add(advancementHolder)) {
-                        set.add(advancementHolder);
-                        if (this.progress.containsKey(advancementHolder)) {
-                            this.progressChanged.add(advancementHolder);
-                        }
+    private void updateTreeVisibility(AdvancementNode advancementnode, Set<AdvancementHolder> set, Set<ResourceLocation> set1) {
+        AdvancementVisibilityEvaluator.evaluateVisibility(advancementnode, (advancementnode1) -> {
+            return this.getOrStartProgress(advancementnode1.holder()).isDone();
+        }, (advancementnode1, flag) -> {
+            AdvancementHolder advancementholder = advancementnode1.holder();
+
+            if (flag) {
+                if (this.visible.add(advancementholder)) {
+                    set.add(advancementholder);
+                    if (this.progress.containsKey(advancementholder)) {
+                        this.progressChanged.add(advancementholder);
                     }
-                } else if (this.visible.remove(advancementHolder)) {
-                    set1.add(advancementHolder.id());
                 }
+            } else if (this.visible.remove(advancementholder)) {
+                set1.add(advancementholder.id());
             }
-        );
+
+        });
     }
 
-    static record Data(Map<ResourceLocation, AdvancementProgress> map) {
-        public static final Codec<PlayerAdvancements.Data> CODEC = Codec.unboundedMap(ResourceLocation.CODEC, AdvancementProgress.CODEC)
-            .xmap(PlayerAdvancements.Data::new, PlayerAdvancements.Data::map);
+    private static record a(Map<ResourceLocation, AdvancementProgress> map) {
 
-        public void forEach(BiConsumer<ResourceLocation, AdvancementProgress> biConsumer) {
-            this.map.entrySet().stream().sorted(Entry.comparingByValue()).forEach(entry -> biConsumer.accept(entry.getKey(), entry.getValue()));
+        public static final Codec<PlayerAdvancements.a> CODEC = Codec.unboundedMap(ResourceLocation.CODEC, AdvancementProgress.CODEC).xmap(PlayerAdvancements.a::new, PlayerAdvancements.a::map);
+
+        public void forEach(BiConsumer<ResourceLocation, AdvancementProgress> biconsumer) {
+            this.map.entrySet().stream().sorted(Entry.comparingByValue()).forEach((entry) -> {
+                biconsumer.accept((ResourceLocation) entry.getKey(), (AdvancementProgress) entry.getValue());
+            });
         }
     }
 }