summaryrefslogtreecommitdiffstats
path: root/nms-patches/DataConverterRegistry.patch
blob: b20d22e5c2f77f58e5eb177b1e7ff43728e58fc1 (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
--- a/net/minecraft/server/DataConverterRegistry.java
+++ b/net/minecraft/server/DataConverterRegistry.java
@@ -21,7 +21,12 @@
         DataFixerBuilder datafixerbuilder = new DataFixerBuilder(1631);
 
         a(datafixerbuilder);
-        return datafixerbuilder.build(ForkJoinPool.commonPool());
+        // CraftBukkit start
+        ForkJoinPool pool = new ForkJoinPool(Integer.getInteger("net.minecraft.server.DataConverterRegistry.bootstrapThreads", Math.min(Runtime.getRuntime().availableProcessors(), 2)));
+        DataFixer fixer = datafixerbuilder.build(pool);
+        pool.shutdown();
+        return fixer;
+        // CraftBukkit end
     }
 
     public static DataFixer a() {
@@ -185,6 +190,18 @@
         datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false));
         Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.b);
 
+        // CraftBukkit start
+        datafixerbuilder.addFixer(new com.mojang.datafixers.DataFix(schema47, false) {
+            @Override
+            protected com.mojang.datafixers.TypeRewriteRule makeRule() {
+                return this.fixTypeEverywhereTyped("Player CustomName", this.getInputSchema().getType(DataConverterTypes.PLAYER), (typed) -> {
+                    return typed.update(DSL.remainderFinder(), (dynamic) -> {
+                        return DataConverterCustomNameEntity.a(dynamic);
+                    });
+                });
+            }
+        });
+        // CraftBukkit end
         datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema47, false));
         datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema47, false));
         datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema47, false));