mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 10:11:29 +01:00
22 lines
1.3 KiB
Diff
22 lines
1.3 KiB
Diff
|
--- a/com/mojang/datafixers/DataFixerBuilder.java
|
||
|
+++ b/com/mojang/datafixers/DataFixerBuilder.java
|
||
|
@@ -29,8 +29,10 @@
|
||
|
private final Int2ObjectSortedMap<Schema> schemas = new Int2ObjectAVLTreeMap<>();
|
||
|
private final List<DataFix> globalList = new ArrayList<>();
|
||
|
private final IntSortedSet fixerVersions = new IntAVLTreeSet();
|
||
|
+ private final int minDataFixPrecacheVersion; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
||
|
|
||
|
public DataFixerBuilder(final int dataVersion) {
|
||
|
+ minDataFixPrecacheVersion = Integer.getInteger("Paper.minPrecachedDatafixVersion", dataVersion+1) * 10; // Paper - Perf: default to precache nothing - mojang stores versions * 10 to allow for 'sub versions'
|
||
|
this.dataVersion = dataVersion;
|
||
|
}
|
||
|
|
||
|
@@ -88,6 +90,7 @@
|
||
|
final IntIterator iterator = fixerUpper.fixerVersions().iterator();
|
||
|
while (iterator.hasNext()) {
|
||
|
final int versionKey = iterator.nextInt();
|
||
|
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
||
|
final Schema schema = schemas.get(versionKey);
|
||
|
for (final String typeName : schema.types()) {
|
||
|
if (!requiredTypeNames.contains(typeName)) {
|