mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 01:32:02 -07:00
Update DataConverter to 1.21.8-RC1
Add a non-Vanilla converter which removes ENTITY fall_distance
entries if they are equal to 0.0. This fixes incorrectly
converted data before b6675e47ca
This commit is contained in:
@@ -217,10 +217,10 @@ index 0000000000000000000000000000000000000000..515f6691c72ffa82ac8b92646768be7a
|
||||
+}
|
||||
diff --git a/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java b/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7b5803c8f8bf0b201f6862768cf6d6b6fa103b1e
|
||||
index 0000000000000000000000000000000000000000..d6b3d4079b4a48ff2883f6b77870f845fe005f47
|
||||
--- /dev/null
|
||||
+++ b/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
|
||||
@@ -0,0 +1,487 @@
|
||||
@@ -0,0 +1,488 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.converters.DataConverter;
|
||||
@@ -503,7 +503,8 @@ index 0000000000000000000000000000000000000000..7b5803c8f8bf0b201f6862768cf6d6b6
|
||||
+ 4314,
|
||||
+ 4420,
|
||||
+ 4424,
|
||||
+ // All up to 1.21.7
|
||||
+ 4439,
|
||||
+ // All up to 1.21.8-rc1
|
||||
+ };
|
||||
+ Arrays.sort(converterVersions);
|
||||
+
|
||||
@@ -710,10 +711,10 @@ index 0000000000000000000000000000000000000000..7b5803c8f8bf0b201f6862768cf6d6b6
|
||||
+}
|
||||
diff --git a/ca/spottedleaf/dataconverter/minecraft/MCVersions.java b/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7a46f8fbc90f65a2bf849d2bec5709145b8e6458
|
||||
index 0000000000000000000000000000000000000000..e89c82a6c202eba82915e58e775ba2186eec6692
|
||||
--- /dev/null
|
||||
+++ b/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
|
||||
@@ -0,0 +1,600 @@
|
||||
@@ -0,0 +1,601 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
@@ -1311,6 +1312,7 @@ index 0000000000000000000000000000000000000000..7a46f8fbc90f65a2bf849d2bec570914
|
||||
+ public static final int V1_21_7_RC1 = 4436;
|
||||
+ public static final int V1_21_7_RC2 = 4437;
|
||||
+ public static final int V1_21_7 = 4438;
|
||||
+ public static final int V1_21_8_RC1 = 4439;
|
||||
+
|
||||
+ private MCVersions() {}
|
||||
+}
|
||||
@@ -9288,10 +9290,10 @@ index 0000000000000000000000000000000000000000..e1f7c0d7fd80556941bbba8018aa85e7
|
||||
+}
|
||||
diff --git a/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java b/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4888b386d0e7f0237c2fe416e9034658cba0f1b0
|
||||
index 0000000000000000000000000000000000000000..b641738d1c5461fdf480a2f35787ace0114c1d52
|
||||
--- /dev/null
|
||||
+++ b/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
|
||||
@@ -0,0 +1,367 @@
|
||||
@@ -0,0 +1,370 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.datatypes;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.minecraft.versions.*;
|
||||
@@ -9652,9 +9654,12 @@ index 0000000000000000000000000000000000000000..4888b386d0e7f0237c2fe416e9034658
|
||||
+ V4311.register();
|
||||
+ V4312.register();
|
||||
+ V4314.register();
|
||||
+ // V1.21.6
|
||||
+ V4420.register();
|
||||
+ V4421.register();
|
||||
+ V4424.register();
|
||||
+ // V1.21.8
|
||||
+ V4439.register(); // Fix https://github.com/PaperMC/DataConverter/commit/b6675e47ca068f152c3b648b3869fe63ca12b720
|
||||
+ }
|
||||
+
|
||||
+ private MCTypeRegistry() {}
|
||||
@@ -26790,6 +26795,37 @@ index 0000000000000000000000000000000000000000..690794c0963a4935390b4830202cb6b7
|
||||
+
|
||||
+ private V4424() {}
|
||||
+}
|
||||
diff --git a/ca/spottedleaf/dataconverter/minecraft/versions/V4439.java b/ca/spottedleaf/dataconverter/minecraft/versions/V4439.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..64388cd5b2d4e30a94cd6b53d1ab1d8aca68fe14
|
||||
--- /dev/null
|
||||
+++ b/ca/spottedleaf/dataconverter/minecraft/versions/V4439.java
|
||||
@@ -0,0 +1,25 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.versions;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.converters.DataConverter;
|
||||
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
|
||||
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
|
||||
+import ca.spottedleaf.dataconverter.types.MapType;
|
||||
+
|
||||
+public final class V4439 {
|
||||
+
|
||||
+ private static final int VERSION = MCVersions.V1_21_8_RC1;
|
||||
+
|
||||
+ public static void register() {
|
||||
+ MCTypeRegistry.ENTITY.addStructureConverter(new DataConverter<>(VERSION) {
|
||||
+ @Override
|
||||
+ public MapType convert(final MapType data, final long sourceVersion, final long toVersion) {
|
||||
+ if (data.getDouble("fall_distance", -1.0) == 0.0) {
|
||||
+ data.remove("fall_distance");
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ private V4439() {}
|
||||
+}
|
||||
diff --git a/ca/spottedleaf/dataconverter/minecraft/versions/V501.java b/ca/spottedleaf/dataconverter/minecraft/versions/V501.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..da5731090c1de479b77d0d9a1b66d217f7f4eeb5
|
||||
|
@@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Wed, 16 Jul 2025 10:25:44 -0700
|
||||
Subject: [PATCH] Fix spawners converted from 1.21.4 not running finalisation
|
||||
logic
|
||||
|
||||
DataConverter incorrectly placed a fall_distance value with 0.0
|
||||
if the entity did not have a FallDistance entry. This results in the
|
||||
entity spawn data having 2 entries, which prevents finalisation
|
||||
logic from running.
|
||||
|
||||
We can fix this by removing the fall_distance entry if it is 0.0.
|
||||
|
||||
diff --git a/net/minecraft/world/level/SpawnData.java b/net/minecraft/world/level/SpawnData.java
|
||||
index 60144561b277a2e20b50b8257b6d5e5c792629ce..04b4b7a50353497c3e637590fa2503379c304304 100644
|
||||
--- a/net/minecraft/world/level/SpawnData.java
|
||||
+++ b/net/minecraft/world/level/SpawnData.java
|
||||
@@ -37,6 +37,13 @@ public record SpawnData(CompoundTag entityToSpawn, Optional<SpawnData.CustomSpaw
|
||||
entityToSpawn.remove("id");
|
||||
}
|
||||
|
||||
+ // Paper start - fix already converted data
|
||||
+ // See https://github.com/PaperMC/DataConverter/commit/b6675e47ca068f152c3b648b3869fe63ca12b720
|
||||
+ if (entityToSpawn.getDoubleOr("fall_distance", -1.0) == 0.0) {
|
||||
+ entityToSpawn.remove("fall_distance");
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.entityToSpawn = entityToSpawn;
|
||||
this.customSpawnRules = customSpawnRules;
|
||||
this.equipment = equipment;
|
Reference in New Issue
Block a user