More work

This commit is contained in:
Nassim Jahnke 2023-12-05 20:12:12 +01:00
parent 9b56221762
commit 603b32976b
5 changed files with 539 additions and 253 deletions

View file

@ -605,7 +605,7 @@ index 0000000000000000000000000000000000000000..ae60bd96b5284d54676d8e7e4dd5d170
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 45657deb1ab3ebdfacf2a9bbb591a9a14236840c..7de6d496b40bbef5b628f1f08163ad24bd48c5c5 100644
index 458c04786f7b56f3c006e1e717c0ac709fddb1a0..6c83df6290e4ec59c596f1b9e2f10f0a80004acd 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -186,6 +186,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -617,10 +617,10 @@ index 45657deb1ab3ebdfacf2a9bbb591a9a14236840c..7de6d496b40bbef5b628f1f08163ad24
this.setPvpAllowed(dedicatedserverproperties.pvp);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 269174b1baa6edf91406d563c7873165da2c0b81..f48d3cc6afe76f35b087b49ca1b0d9a7fcca08cf 100644
index 0fb29151929ce124e9a69f117d00959c27b38c84..9fb7b743c7d8a7051fa145594bc6dd357b55a1cb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -943,6 +943,7 @@ public final class CraftServer implements Server {
@@ -938,6 +938,7 @@ public final class CraftServer implements Server {
this.commandMap.clearCommands();
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
@ -628,7 +628,7 @@ index 269174b1baa6edf91406d563c7873165da2c0b81..f48d3cc6afe76f35b087b49ca1b0d9a7
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -2598,6 +2599,34 @@ public final class CraftServer implements Server {
@@ -2630,6 +2631,34 @@ public final class CraftServer implements Server {
// Paper end
// Paper start

View file

@ -698,7 +698,7 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 7de6d496b40bbef5b628f1f08163ad24bd48c5c5..672c9d304f448922c5a50c725ac1f0dd988b1853 100644
index 6c83df6290e4ec59c596f1b9e2f10f0a80004acd..4b303d8acc663cfd3b86e37f4a3110d5335d07ad 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

View file

@ -7047,10 +7047,10 @@ index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f7
return foundFrame.orElse(null);
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index bdd3b48e5de2afd6b7655ba6ff742a60ee9540c5..98ef159b7091e53298838ae3723909be6d38b4ba 100644
index ca70cd2e76c94f7a284c9af47c64252855f070a4..b366389fd1aed47e04884e9e495df83ec7398ca3 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -323,7 +323,13 @@ public class BuiltInRegistries {
@@ -338,7 +338,13 @@ public class BuiltInRegistries {
}
public static void bootStrap() {
@ -7082,10 +7082,10 @@ index 1eabd8b5a99850298838b11ba97e3d220f444378..8ff786c366332588a2df053438f23cc9
Bootstrap.wrapStreams();
Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 9cfdd5d8c1650d9c9bdfbc07980239e507ff942d..ae0b713870976d4b1e469a90cef9b2e282dbcaab 100644
index f3130afbfd70e39a8000b0471854f8ef892bbbf5..884731fa4ebbbdc7c06ff670941f36ef3bf384ad 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -130,6 +130,7 @@ public class Main {
@@ -128,6 +128,7 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
@ -7094,10 +7094,10 @@ index 9cfdd5d8c1650d9c9bdfbc07980239e507ff942d..ae0b713870976d4b1e469a90cef9b2e2
Bootstrap.validate();
Util.startTimerHackThread();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f48d3cc6afe76f35b087b49ca1b0d9a7fcca08cf..e43969ac2881f14082ecb2af30c7e9145e1269bc 100644
index 9fb7b743c7d8a7051fa145594bc6dd357b55a1cb..6a8b3ad8848119e3c448ff976c60bfc6eda22e59 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -275,7 +275,8 @@ public final class CraftServer implements Server {
@@ -276,7 +276,8 @@ public final class CraftServer implements Server {
private final CraftCommandMap commandMap = new CraftCommandMap(this);
private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger();
@ -7107,7 +7107,7 @@ index f48d3cc6afe76f35b087b49ca1b0d9a7fcca08cf..e43969ac2881f14082ecb2af30c7e914
private final StructureManager structureManager;
protected final DedicatedServer console;
protected final DedicatedPlayerList playerList;
@@ -427,24 +428,7 @@ public final class CraftServer implements Server {
@@ -422,24 +423,7 @@ public final class CraftServer implements Server {
}
public void loadPlugins() {
@ -7133,7 +7133,7 @@ index f48d3cc6afe76f35b087b49ca1b0d9a7fcca08cf..e43969ac2881f14082ecb2af30c7e914
}
public void enablePlugins(PluginLoadOrder type) {
@@ -533,15 +517,17 @@ public final class CraftServer implements Server {
@@ -528,15 +512,17 @@ public final class CraftServer implements Server {
private void enablePlugin(Plugin plugin) {
try {
List<Permission> perms = plugin.getDescription().getPermissions();
@ -7157,7 +7157,7 @@ index f48d3cc6afe76f35b087b49ca1b0d9a7fcca08cf..e43969ac2881f14082ecb2af30c7e914
this.pluginManager.enablePlugin(plugin);
} catch (Throwable ex) {
@@ -967,6 +953,7 @@ public final class CraftServer implements Server {
@@ -962,6 +948,7 @@ public final class CraftServer implements Server {
"This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin"
));
}
@ -7183,10 +7183,10 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7
@Override
public FileConfiguration getConfig() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index da7bc4cfde594dba68dfc644b49748b4865f7d89..1c70aa4475bb43aba2f66eedabd4d1f5c5ae3409 100644
index 1c98b1f1a1c6ab27bb31fd9b32927c97728f980c..72c1b7f1468c47ad7053a7ff6b3248324b2bf604 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -424,6 +424,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -421,6 +421,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
}

View file

@ -697,31 +697,11 @@ index 0000000000000000000000000000000000000000..2f0d9b953802dee821cfde82d22b0567
+ return Timings.ofSafe(((PrimaryLevelData) worldserver.getLevelData()).getLevelName() + " - Scheduled " + timingsType);
+ }
+}
diff --git a/src/main/java/net/minecraft/commands/CommandFunction.java b/src/main/java/net/minecraft/commands/CommandFunction.java
index 0e460de37ac2ae8accbd0d3da73faac6cd7df8e0..956cddf5d975b91619316b9b6779cf51575cfc0a 100644
--- a/src/main/java/net/minecraft/commands/CommandFunction.java
+++ b/src/main/java/net/minecraft/commands/CommandFunction.java
@@ -32,6 +32,15 @@ import net.minecraft.server.ServerFunctionManager;
public class CommandFunction {
private final CommandFunction.Entry[] entries;
final ResourceLocation id;
+ // Paper start
+ public co.aikar.timings.Timing timing;
+ public co.aikar.timings.Timing getTiming() {
+ if (timing == null) {
+ timing = co.aikar.timings.MinecraftTimings.getCommandFunctionTiming(this);
+ }
+ return timing;
+ }
+ // Paper end
public CommandFunction(ResourceLocation id, CommandFunction.Entry[] elements) {
this.id = id;
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 6f1501e13e29ce25919c23213df53248c4b454d7..047fc7206131e0f36ab45d04e98b7a235431e342 100644
index daedf825e68655492f5ab776bc206a5eb87c0170..7de24c39b460e43d27839b3821e67213508ece81 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -28,7 +28,8 @@ public class PacketUtils {
@@ -29,7 +29,8 @@ public class PacketUtils {
engine.executeIfPossible(() -> {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.shouldHandleMessage(packet)) {
@ -730,12 +710,12 @@ index 6f1501e13e29ce25919c23213df53248c4b454d7..047fc7206131e0f36ab45d04e98b7a23
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
} catch (Exception exception) {
if (exception instanceof ReportedException) {
label25:
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd230879b6ac804 100644
index 1eb0809addfd77303b94bb594701ee7f38483909..337a1e89ba63471ea6b413cdec3e68d343a0b46b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -185,7 +185,7 @@ import org.bukkit.craftbukkit.Main;
@@ -186,7 +186,7 @@ import org.bukkit.craftbukkit.Main;
import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end
@ -744,7 +724,7 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable {
@@ -845,6 +845,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -891,6 +891,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
MinecraftServer.LOGGER.info("Stopping server");
@ -752,12 +732,12 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -1080,9 +1081,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1144,9 +1145,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean haveTime() {
// CraftBukkit start
+ if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
return this.forceTicks || this.runningTask() || Util.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
return this.forceTicks || this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
}
+ // Paper start
@ -774,7 +754,7 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
private void executeModerately() {
this.runAllTasks();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -1090,9 +1103,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1154,9 +1167,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void waitUntilNextTick() {
@ -786,8 +766,8 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
});
}
@@ -1177,9 +1190,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
@@ -1245,9 +1258,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickServer(BooleanSupplier shouldKeepTicking) {
- SpigotTimings.serverTickTimer.startTiming(); // Spigot
@ -803,12 +783,12 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
+ // Paper end
+
++this.tickCount;
this.tickRateManager.tick();
this.tickChildren(shouldKeepTicking);
if (i - this.lastServerStatus >= 5000000000L) {
@@ -1188,15 +1209,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit
@@ -1261,15 +1282,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.autosavePeriod > 0 && this.ticksUntilAutosave <= 0) {
this.ticksUntilAutosave = this.autosavePeriod;
// CraftBukkit end
- SpigotTimings.worldSaveTimer.startTiming(); // Spigot
MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save");
@ -824,10 +804,10 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
+ }
+ // Paper end
this.profiler.push("tallying");
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -1206,8 +1230,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.logTickTime(k - i);
long j = Util.getNanos() - i;
int k = this.tickCount % 100;
@@ -1283,8 +1307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.logTickTime(l - i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
- SpigotTimings.serverTickTimer.stopTiming(); // Spigot
@ -835,8 +815,8 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
protected void logTickTime(long nanos) {}
@@ -1244,26 +1267,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private int computeNextAutosaveInterval() {
@@ -1346,26 +1369,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
@ -870,7 +850,7 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.tickCount % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -1271,7 +1294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1373,7 +1396,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
}
}
@ -879,22 +859,22 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1317,24 +1340,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1419,24 +1442,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.profiler.popPush("connection");
- SpigotTimings.connectionTimer.startTiming(); // Spigot
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
this.getConnection().tick();
- SpigotTimings.connectionTimer.stopTiming(); // Spigot
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Paper
this.profiler.popPush("players");
- SpigotTimings.playerListTimer.startTiming(); // Spigot
+ MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
this.playerList.tick();
- SpigotTimings.playerListTimer.stopTiming(); // Spigot
+ MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
if (SharedConstants.IS_RUNNING_IN_IDE) {
if (SharedConstants.IS_RUNNING_IN_IDE && this.tickRateManager.runsNormally()) {
GameTestTicker.SINGLETON.tick();
}
@ -910,21 +890,8 @@ index b04967ebfc45222e294f932cfd3df3785f8198c6..7abd42e34ce14618f4987933cdd23087
this.profiler.popPush("send chunks");
iterator = this.playerList.getPlayers().iterator();
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 188ac9b2879d339a268f6c100c23f1dce90c195a..d10abd28c522612934aada8124e5bb67a9b4e9da 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -97,7 +97,7 @@ public class ServerFunctionManager {
} else {
int i;
- try {
+ try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
this.context = new ServerFunctionManager.ExecutionContext(tracer);
i = this.context.runTopCommand(customfunction1, source);
} finally {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 672c9d304f448922c5a50c725ac1f0dd988b1853..4b94b1ca21dbc0d9f993c5c9b86965f03aef75b4 100644
index 4b303d8acc663cfd3b86e37f4a3110d5335d07ad..cb95818bfb5f0a9274b4e0f2530000bfca7ffc87 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -58,8 +58,9 @@ import org.apache.logging.log4j.Level;
@ -1064,10 +1031,10 @@ index 770f6a08c613093577172385549df8040ded627b..c1bb511cc25ca97282ee02d2b207e294
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 4ff18d9995d5d26bde4dbe2ec31c77c2d1515227..c2db2aad2498f0be2e904d5869a9b0bd3411618c 100644
index 7cacfceed5ef9276a19123a8a9079579423d03ac..d62f6ef628f591e4362c4aa7db9d38fa2304af4c 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -415,13 +415,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -413,13 +413,15 @@ public class ServerChunkCache extends ChunkSource {
}
gameprofilerfiller.incrementCounter("getChunkCacheMiss");
@ -1085,7 +1052,7 @@ index 4ff18d9995d5d26bde4dbe2ec31c77c2d1515227..c2db2aad2498f0be2e904d5869a9b0bd
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
}, (playerchunk_failure) -> {
@@ -620,7 +622,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -618,7 +620,9 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
@ -1095,51 +1062,47 @@ index 4ff18d9995d5d26bde4dbe2ec31c77c2d1515227..c2db2aad2498f0be2e904d5869a9b0bd
}
@Override
@@ -659,7 +663,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -657,10 +661,10 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.doChunkMap.stopTiming(); // Spigot
this.level.getProfiler().popPush("chunks");
if (tickChunks) {
+ this.level.timings.chunks.startTiming(); // Paper - timings
this.tickChunks();
- this.level.timings.tracker.startTiming(); // Spigot
+ this.level.timings.chunks.stopTiming(); // Paper - timings
this.chunkMap.tick();
- this.level.timings.tracker.stopTiming(); // Spigot
}
this.level.timings.doChunkUnload.startTiming(); // Spigot
@@ -688,13 +694,16 @@ public class ServerChunkCache extends ChunkSource {
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
gameprofilerfiller.push("naturalSpawnCount");
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("filteringLoadedChunks");
List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(l);
@@ -683,6 +687,7 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.push("filteringLoadedChunks");
List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(this.chunkMap.size());
Iterator iterator = this.chunkMap.getChunks().iterator();
+ this.level.timings.chunkTicks.startTiming(); // Paper
while (iterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) iterator.next();
@@ -723,27 +732,27 @@ public class ServerChunkCache extends ChunkSource {
}
@@ -695,8 +700,10 @@ public class ServerChunkCache extends ChunkSource {
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
- this.level.timings.doTickTiles.startTiming(); // Spigot
this.level.tickChunk(chunk1, k);
- this.level.timings.doTickTiles.stopTiming(); // Spigot
}
if (this.level.getServer().tickRateManager().runsNormally()) {
gameprofilerfiller.popPush("naturalSpawnCount");
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int k = this.distanceManager.getNaturalSpawnChunkCount();
NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(k, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("spawnAndTick");
@@ -728,13 +735,17 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.popPush("customSpawners");
if (flag) {
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
+ } // Paper - timings
}
}
-
+ this.level.timings.chunkTicks.stopTiming(); // Paper
gameprofilerfiller.popPush("customSpawners");
if (flag2) {
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
+ } // Paper - timings
}
gameprofilerfiller.popPush("broadcast");
list.forEach((chunkproviderserver_a1) -> {
@ -1149,14 +1112,8 @@ index 4ff18d9995d5d26bde4dbe2ec31c77c2d1515227..c2db2aad2498f0be2e904d5869a9b0bd
});
gameprofilerfiller.pop();
gameprofilerfiller.pop();
- this.level.timings.tracker.startTiming(); // Spigot
this.chunkMap.tick();
- this.level.timings.tracker.stopTiming(); // Spigot
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae3023204d 100644
index 0995b63953d62198c117fdc7a8c4703a986d2db2..b698cdc4ef9e2bf824b9e5a4f985b6832c15f8f6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,6 +1,8 @@
@ -1168,7 +1125,7 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
@@ -165,7 +167,6 @@ import org.slf4j.Logger;
@@ -167,7 +169,6 @@ import org.slf4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.WeatherType;
@ -1176,16 +1133,16 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -461,7 +462,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
@@ -472,7 +473,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
gameprofilerfiller.popPush("tickPending");
- this.timings.doTickPending.startTiming(); // Spigot
+ this.timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug()) {
if (!this.isDebug() && flag) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");
@@ -470,12 +471,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -481,15 +482,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.fluidTicks.tick(j, 65536, this::tickFluid);
gameprofilerfiller.pop();
}
@ -1193,17 +1150,20 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
+ this.timings.scheduledBlocks.stopTiming(); // Paper
gameprofilerfiller.popPush("raid");
+ this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
+ this.timings.raids.stopTiming(); // Paper - timings
if (flag) {
+ this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
+ this.timings.raids.stopTiming(); // Paper - timings
}
gameprofilerfiller.popPush("chunkSource");
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking, true);
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
gameprofilerfiller.popPush("blockEvents");
this.timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
@@ -625,6 +630,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (flag) {
this.timings.doSounds.startTiming(); // Spigot
@@ -642,6 +647,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
gameprofilerfiller.popPush("tickBlocks");
@ -1211,7 +1171,7 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
if (randomTickSpeed > 0) {
LevelChunkSection[] achunksection = chunk.getSections();
@@ -657,6 +663,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -674,6 +680,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@ -1219,7 +1179,7 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
gameprofilerfiller.pop();
}
@@ -931,14 +938,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -950,14 +957,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void tickNonPassenger(Entity entity) {
@ -1243,7 +1203,7 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -957,7 +972,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -976,7 +991,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1);
}
@ -1252,7 +1212,7 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
}
@@ -999,6 +1014,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1018,6 +1033,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit
@ -1260,7 +1220,7 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -1008,7 +1024,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1027,7 +1043,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
@ -1272,10 +1232,10 @@ index 44ae05684a2fe19d3e25617a4fa133c932fd4e51..2a3f9168d38350eb3f6d97836fea70ae
this.entityManager.saveAll();
} else {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 986575ed7bdbe9aecb8f303756538049ce9b6ef2..0649344ca2290446ff27cf9fa0d6f84ad0fe91c2 100644
index bc9ca925db912b637def658fd123105ac1c75412..d6b9fee57d22da0eaf3dcc4abfd3995d69abef95 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -320,7 +320,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -323,7 +323,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void tick() {
@ -1283,7 +1243,7 @@ index 986575ed7bdbe9aecb8f303756538049ce9b6ef2..0649344ca2290446ff27cf9fa0d6f84a
if (this.ackBlockChangesUpTo > -1) {
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
this.ackBlockChangesUpTo = -1;
@@ -387,7 +386,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -390,7 +389,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
}
@ -1291,7 +1251,7 @@ index 986575ed7bdbe9aecb8f303756538049ce9b6ef2..0649344ca2290446ff27cf9fa0d6f84a
}
@@ -2006,7 +2004,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2014,7 +2012,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
private void handleCommand(String s) {
@ -1300,7 +1260,7 @@ index 986575ed7bdbe9aecb8f303756538049ce9b6ef2..0649344ca2290446ff27cf9fa0d6f84a
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2016,7 +2014,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2024,7 +2022,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -1309,7 +1269,7 @@ index 986575ed7bdbe9aecb8f303756538049ce9b6ef2..0649344ca2290446ff27cf9fa0d6f84a
return;
}
@@ -2029,7 +2027,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2037,7 +2035,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return;
} finally {
@ -1319,7 +1279,7 @@ index 986575ed7bdbe9aecb8f303756538049ce9b6ef2..0649344ca2290446ff27cf9fa0d6f84a
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cb8859c37fb8ce46a8fd529ca885456ea86c1c2b..8f7bc04fc32e3b9c0625d795b09ea7f2e950fc05 100644
index 6e9f5a404511f3703298def67402b87eca2f28a0..f5a4191977e8675952fc689744c8a39e86f62a07 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1,5 +1,6 @@
@ -1329,7 +1289,7 @@ index cb8859c37fb8ce46a8fd529ca885456ea86c1c2b..8f7bc04fc32e3b9c0625d795b09ea7f2
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1040,10 +1041,11 @@ public abstract class PlayerList {
@@ -1039,10 +1040,11 @@ public abstract class PlayerList {
}
public void saveAll() {
@ -1343,10 +1303,10 @@ index cb8859c37fb8ce46a8fd529ca885456ea86c1c2b..8f7bc04fc32e3b9c0625d795b09ea7f2
public UserWhiteList getWhiteList() {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 140c6befe7f5cba51904eaae0dc88e936f660a12..46853c3daa7f3f552632444fbf41624cfd1c8dc4 100644
index d0f1cd32aa71f275c9975d1cedc8895fb2e8a174..a1a744657f8802852c161258382c5891858ebfa6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -134,7 +134,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent;
@@ -135,7 +135,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle;
@ -1354,15 +1314,15 @@ index 140c6befe7f5cba51904eaae0dc88e936f660a12..46853c3daa7f3f552632444fbf41624c
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
@@ -307,7 +306,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
public boolean persistentInvisibility = false;
public BlockPos lastLavaContact;
@@ -312,7 +311,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// Marks an entity, that it was removed by a plugin via Entity#remove
// Main use case currently is for SPIGOT-7487, preventing dropping of leash when leash is removed
public boolean pluginRemoved = false;
- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
// Spigot start
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
@@ -804,7 +802,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -809,7 +807,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public void move(MoverType movementType, Vec3 movement) {
@ -1370,7 +1330,7 @@ index 140c6befe7f5cba51904eaae0dc88e936f660a12..46853c3daa7f3f552632444fbf41624c
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -965,7 +962,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -970,7 +967,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.level().getProfiler().pop();
}
}
@ -1379,10 +1339,10 @@ index 140c6befe7f5cba51904eaae0dc88e936f660a12..46853c3daa7f3f552632444fbf41624c
private boolean isStateClimbable(BlockState state) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index fe7180dfc7ddaac8d60422c072d2e172d669cf57..cea1a8eaae8dfc36efd09e3ac57a7062bf536aac 100644
index c4bc491eed487c0a7e30538b0fb46fde91cd7b31..382b55167dede435b034866bd394455f0f6f2a00 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -323,6 +323,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -327,6 +327,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
@ -1398,7 +1358,7 @@ index fe7180dfc7ddaac8d60422c072d2e172d669cf57..cea1a8eaae8dfc36efd09e3ac57a7062
this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this);
this.factory = factory;
this.category = spawnGroup;
@@ -644,6 +653,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -648,6 +657,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return this.updateInterval;
}
@ -1411,7 +1371,7 @@ index fe7180dfc7ddaac8d60422c072d2e172d669cf57..cea1a8eaae8dfc36efd09e3ac57a7062
public boolean trackDeltas() {
return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
}
@@ -753,7 +768,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -757,7 +772,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
Util.fetchChoiceType(References.ENTITY_TREE, id);
}
@ -1421,7 +1381,7 @@ index fe7180dfc7ddaac8d60422c072d2e172d669cf57..cea1a8eaae8dfc36efd09e3ac57a7062
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105f9426ae7 100644
index c2c3fa92235c365f4e4a8bdffa3295e32ebd8d16..4afd257f30ab063c4805e8a3144f51d643c49db3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -140,7 +140,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
@ -1433,7 +1393,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
public abstract class LivingEntity extends Entity implements Attackable {
@@ -2869,7 +2869,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2866,7 +2866,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void tick() {
@ -1441,7 +1401,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
super.tick();
this.updatingUsingItem();
this.updateSwimAmount();
@@ -2911,9 +2910,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2908,9 +2907,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (!this.isRemoved()) {
@ -1451,7 +1411,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
}
double d0 = this.getX() - this.xo;
@@ -2997,7 +2994,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2994,7 +2991,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.refreshDirtyAttributes();
@ -1459,7 +1419,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
}
public void detectEquipmentUpdatesPublic() { // CraftBukkit
@@ -3167,7 +3163,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3169,7 +3165,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.setDeltaMovement(d0, d1, d2);
this.level().getProfiler().push("ai");
@ -1467,7 +1427,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
@@ -3177,7 +3172,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3179,7 +3174,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.serverAiStep();
this.level().getProfiler().pop();
}
@ -1475,7 +1435,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
this.level().getProfiler().pop();
this.level().getProfiler().push("jump");
@@ -3217,7 +3211,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3219,7 +3213,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.resetFallDistance();
}
@ -1483,7 +1443,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
label104:
{
LivingEntity entityliving = this.getControllingPassenger();
@@ -3233,7 +3226,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3235,7 +3228,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.travel(vec3d1);
}
@ -1491,7 +1451,7 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
this.level().getProfiler().pop();
this.level().getProfiler().push("freezing");
@@ -3260,9 +3252,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3262,9 +3254,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
}
@ -1502,10 +1462,10 @@ index 8fa96e6875b1d5dd66ef536d76648170b912c919..f6cfed5ac40726475d1c121d0095c105
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 384cb02b124dac42521767b0aff481a1b12c0eab..43b631634ff225fa007af552f51f00150892185b 100644
index 915c1dfae28ccac02d5ebb97d5cf797c66d2c8e4..26fe1603b3899f5b69980dc64d46d26d9c944fde 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -88,7 +88,6 @@ import org.bukkit.Bukkit;
@@ -91,7 +91,6 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
@ -1513,7 +1473,7 @@ index 384cb02b124dac42521767b0aff481a1b12c0eab..43b631634ff225fa007af552f51f0015
import org.bukkit.craftbukkit.block.CapturedBlockState;
import org.bukkit.craftbukkit.block.CraftBlockState;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -163,7 +162,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -166,7 +165,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Paper end
@ -1522,7 +1482,7 @@ index 384cb02b124dac42521767b0aff481a1b12c0eab..43b631634ff225fa007af552f51f0015
public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter;
@@ -261,7 +260,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -264,7 +263,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {}
});
// CraftBukkit end
@ -1531,7 +1491,7 @@ index 384cb02b124dac42521767b0aff481a1b12c0eab..43b631634ff225fa007af552f51f0015
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
}
@@ -714,15 +713,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -725,15 +724,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;
@ -1549,10 +1509,10 @@ index 384cb02b124dac42521767b0aff481a1b12c0eab..43b631634ff225fa007af552f51f0015
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being ticked");
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 96ff9373e89a3f0b174c82a75e09dd91a3639508..7ed82beb538a25a5246f6288c1dddb4f5f85e997 100644
index 74f380afac8a91cd1d2bbd3cd679f0eaee53fdee..756a8ae14ffc46d6ebe0a858a03fb2e89b8e118a 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -87,6 +87,15 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -89,6 +89,15 @@ public class Block extends BlockBehaviour implements ItemLike {
public static final int UPDATE_LIMIT = 512;
protected final StateDefinition<Block, BlockState> stateDefinition;
private BlockState defaultBlockState;
@ -1633,10 +1593,10 @@ index 0eb09ce5c850d85ffd7229d27cf06b3e0edda11b..cc1d7626a82881c4410d65c6a33dadae
};
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e43969ac2881f14082ecb2af30c7e9145e1269bc..e08c7af19ec142c2aa1b918ffd6cb9e1aa7f0c4d 100644
index 6a8b3ad8848119e3c448ff976c60bfc6eda22e59..0f3659d2d60426275869dec76412aecb8e407442 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -377,7 +377,7 @@ public final class CraftServer implements Server {
@@ -372,7 +372,7 @@ public final class CraftServer implements Server {
this.saveCommandsConfig();
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@ -1645,7 +1605,7 @@ index e43969ac2881f14082ecb2af30c7e9145e1269bc..e08c7af19ec142c2aa1b918ffd6cb9e1
this.overrideSpawnLimits();
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@@ -2515,12 +2515,31 @@ public final class CraftServer implements Server {
@@ -2547,12 +2547,31 @@ public final class CraftServer implements Server {
private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot()
{
@ -1847,10 +1807,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 405142188f1b4089fbec38e54266514a9edc0a73..9cec05442734dd9e08e749dc73358c045c6d3d24 100644
index 336045ecb9e6b3803fdf9531b07bb72ceff0ee73..c74428dccd9db8c4d2809bbd23f3268a16d7e282 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2570,6 +2570,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2585,6 +2585,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR));
}
@ -2047,10 +2007,10 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222
+ } // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1c70aa4475bb43aba2f66eedabd4d1f5c5ae3409..0a2a6697118833d45ffe95252cee8011b505d566 100644
index 72c1b7f1468c47ad7053a7ff6b3248324b2bf604..677335c3888adc25fbf3c5ec4d5a6c5ecf58ea5d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -211,6 +211,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -209,6 +209,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end
// ========================================================================
@ -2063,7 +2023,7 @@ index 1c70aa4475bb43aba2f66eedabd4d1f5c5ae3409..0a2a6697118833d45ffe95252cee8011
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
@@ -445,6 +451,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -442,6 +448,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
return new CraftPotionType(namespacedKey, potionRegistry);
}

View file

@ -196,10 +196,10 @@ index 0000000000000000000000000000000000000000..dde9d36bf6212196caa18f3c9c535aec
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..127da265fe98f9f15476c589b5ecd950ccdbdfb8
index 0000000000000000000000000000000000000000..4a392b3d53e330bf22100d57aec7ee1755e80a11
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
@@ -0,0 +1,384 @@
@@ -0,0 +1,388 @@
+package ca.spottedleaf.dataconverter.minecraft;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
@ -353,6 +353,7 @@ index 0000000000000000000000000000000000000000..127da265fe98f9f15476c589b5ecd950
+ 2531,
+ 2533,
+ 2535,
+ 2538,
+ 2550,
+ 2551,
+ 2552,
@ -421,8 +422,11 @@ index 0000000000000000000000000000000000000000..127da265fe98f9f15476c589b5ecd950
+ 3564,
+ 3565,
+ 3566,
+ 3568
+ // All up to 1.20.2
+ 3568,
+ 3683,
+ 3685,
+ 3692,
+ // All up to 1.20.3
+ };
+ Arrays.sort(converterVersions);
+
@ -586,10 +590,10 @@ index 0000000000000000000000000000000000000000..127da265fe98f9f15476c589b5ecd950
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
new file mode 100644
index 0000000000000000000000000000000000000000..86793648d7b8376e08ea145a80753ce70944e8a4
index 0000000000000000000000000000000000000000..9b92547b72c0e188293fcc0c7b8ad1e133520c70
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
@@ -0,0 +1,479 @@
@@ -0,0 +1,499 @@
+package ca.spottedleaf.dataconverter.minecraft;
+
+@SuppressWarnings("unused")
@ -1067,6 +1071,26 @@ index 0000000000000000000000000000000000000000..86793648d7b8376e08ea145a80753ce7
+ public static final int V23W33A = 3570;
+ public static final int V23W35A = 3571;
+ public static final int V1_20_2_PRE1 = 3572;
+ public static final int V1_20_2_PRE2 = 3573;
+ public static final int V1_20_2_PRE3 = 3574;
+ public static final int V1_20_2_PRE4 = 3575;
+ public static final int V1_20_2_RC1 = 3576;
+ public static final int V1_20_2_RC2 = 3577;
+ public static final int V1_20_2 = 3578;
+ public static final int V23W40A = 3679;
+ public static final int V23W41A = 3681;
+ public static final int V23W42A = 3684;
+ public static final int V23W43A = 3686;
+ public static final int V23W43B = 3687;
+ public static final int V23W44A = 3688;
+ public static final int V23W45A = 3690;
+ public static final int V23W46A = 3691;
+ public static final int V1_20_3_PRE1 = 3693;
+ public static final int V1_20_3_PRE2 = 3694;
+ public static final int V1_20_3_PRE3 = 3695;
+ public static final int V1_20_3_PRE4 = 3696;
+ public static final int V1_20_3_RC1 = 3697;
+ public static final int V1_20_3 = 3698;
+
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/advancements/ConverterAbstractAdvancementsRename.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/advancements/ConverterAbstractAdvancementsRename.java
@ -6380,10 +6404,10 @@ index 0000000000000000000000000000000000000000..a1985c85aa9193699d7d20e6f4f11b6e
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/stats/ConverterFlattenStats.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/stats/ConverterFlattenStats.java
new file mode 100644
index 0000000000000000000000000000000000000000..9c1c6627733839d62bc552c158cb556303c5d1bb
index 0000000000000000000000000000000000000000..891be75bf5c4af56e839c88b26f0a828554ae5c4
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/stats/ConverterFlattenStats.java
@@ -0,0 +1,309 @@
@@ -0,0 +1,321 @@
+package ca.spottedleaf.dataconverter.minecraft.converters.stats;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
@ -6674,21 +6698,33 @@ index 0000000000000000000000000000000000000000..9c1c6627733839d62bc552c158cb5563
+ return new DataConverter<>(VERSION, VERSION_STEP) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ final String criteriaName = data.getString("CriteriaName");
+ convertCriteriaName(data, "CriteriaName");
+
+ // We also need to update CriteriaType that is created by the data hook in V1451,
+ // otherwise that data hook will overwrite our CriteriaName
+ final MapType<String> criteriaType = data.getMap("CriteriaType");
+ if (criteriaType != null) {
+ if ("_special".equals(criteriaType.getString("type"))) {
+ convertCriteriaName(criteriaType, "id");
+ }
+ }
+
+ return null;
+ }
+
+ private void convertCriteriaName(final MapType<String> data, final String key) {
+ final String criteriaName = data.getString(key);
+
+ if (criteriaName == null) {
+ return null;
+ return;
+ }
+
+ if (SPECIAL_OBJECTIVE_CRITERIA.contains(criteriaName)) {
+ return null;
+ return;
+ }
+
+ final StatType converted = convertLegacyKey(criteriaName);
+ data.setString("CriteriaName",
+ converted == null ? "dummy" : V1451.packWithDot(converted.category()) + ":" + V1451.packWithDot(converted.key()));
+
+ return null;
+ data.setString(key, converted == null ? "dummy" : V1451.packWithDot(converted.category()) + ":" + V1451.packWithDot(converted.key()));
+ }
+ };
+ }
@ -7042,10 +7078,10 @@ index 0000000000000000000000000000000000000000..76a6e3efa5c69150e8f5e0063cb6357b
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..e5bcd86aac84ddd7f4e050f6e2ff6e829e6fd69d
index 0000000000000000000000000000000000000000..bc7303964625d740b902dda72d9543c5f4120475
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
@@ -0,0 +1,269 @@
@@ -0,0 +1,275 @@
+package ca.spottedleaf.dataconverter.minecraft.datatypes;
+
+import ca.spottedleaf.dataconverter.minecraft.versions.*;
@ -7228,6 +7264,7 @@ index 0000000000000000000000000000000000000000..e5bcd86aac84ddd7f4e050f6e2ff6e82
+ V2531.register();
+ V2533.register();
+ V2535.register();
+ V2538.register();
+ V2550.register();
+ V2551.register();
+ V2552.register();
@ -7311,6 +7348,11 @@ index 0000000000000000000000000000000000000000..e5bcd86aac84ddd7f4e050f6e2ff6e82
+ V3565.register();
+ V3566.register();
+ V3568.register();
+ V3682.register();
+ V3683.register();
+ V3685.register();
+ V3689.register();
+ V3692.register();
+ }
+
+ private MCTypeRegistry() {}
@ -7468,6 +7510,39 @@ index 0000000000000000000000000000000000000000..7f88487e7db589070512fafef1eb243a
+ return null;
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/util/ComponentUtils.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/util/ComponentUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..952c64fbc4b21a2d85d66c5183e8094a584e0d17
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/util/ComponentUtils.java
@@ -0,0 +1,27 @@
+package ca.spottedleaf.dataconverter.minecraft.util;
+
+import com.google.gson.JsonObject;
+import net.minecraft.util.GsonHelper;
+
+public final class ComponentUtils {
+
+ public static final String EMPTY = createPlainTextComponent("");
+
+ public static String createPlainTextComponent(final String text) {
+ final JsonObject ret = new JsonObject();
+
+ ret.addProperty("text", text);
+
+ return GsonHelper.toStableString(ret);
+ }
+
+ public static String createTranslatableComponent(final String key) {
+ final JsonObject ret = new JsonObject();
+
+ ret.addProperty("translate", key);
+
+ return GsonHelper.toStableString(ret);
+ }
+
+ private ComponentUtils() {}
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V100.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V100.java
new file mode 100644
index 0000000000000000000000000000000000000000..7e8f42eb57c12c885a1c17eafab1c9d9be4d8963
@ -9379,7 +9454,7 @@ index 0000000000000000000000000000000000000000..8ca5b9d7292ba9c81f7f0fdfb6ca8fd1
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1458.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1458.java
new file mode 100644
index 0000000000000000000000000000000000000000..1de3a47887f29134e3e0ae6467afb54c8ab7ef68
index 0000000000000000000000000000000000000000..a7cc825c1e5d01ef3eb2fce0931230d936286cb0
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1458.java
@@ -0,0 +1,88 @@
@ -9388,8 +9463,8 @@ index 0000000000000000000000000000000000000000..1de3a47887f29134e3e0ae6467afb54c
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.util.ComponentUtils;
+import ca.spottedleaf.dataconverter.types.MapType;
+import net.minecraft.network.chat.Component;
+
+public final class V1458 {
+
@ -9401,7 +9476,7 @@ index 0000000000000000000000000000000000000000..1de3a47887f29134e3e0ae6467afb54c
+ if (customName.isEmpty()) {
+ data.remove("CustomName");
+ } else {
+ data.setString("CustomName", Component.Serializer.toJson(Component.literal(customName)));
+ data.setString("CustomName", ComponentUtils.createPlainTextComponent(customName));
+ }
+
+ return null;
@ -9442,11 +9517,11 @@ index 0000000000000000000000000000000000000000..1de3a47887f29134e3e0ae6467afb54c
+
+ final String name = display.getString("Name");
+ if (name != null) {
+ display.setString("Name", Component.Serializer.toJson(Component.literal(name)));
+ display.setString("Name", ComponentUtils.createPlainTextComponent(name));
+ } else {
+ final String localisedName = display.getString("LocName");
+ if (localisedName != null) {
+ display.setString("Name", Component.Serializer.toJson(Component.translatable(localisedName)));
+ display.setString("Name", ComponentUtils.createTranslatableComponent(localisedName));
+ display.remove("LocName");
+ }
+ }
@ -9714,16 +9789,17 @@ index 0000000000000000000000000000000000000000..68dd3ce7709a998bc50a5080fe9c805b
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1470.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1470.java
new file mode 100644
index 0000000000000000000000000000000000000000..669509286b18a173826938bae347c1aefffeed51
index 0000000000000000000000000000000000000000..d29c79b44f619891ed07d7f13a63c960dfa985cd
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1470.java
@@ -0,0 +1,31 @@
@@ -0,0 +1,33 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.DataWalkerTypePaths;
+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItemLists;
+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItems;
+
+public final class V1470 {
+
@ -9744,6 +9820,7 @@ index 0000000000000000000000000000000000000000..669509286b18a173826938bae347c1ae
+ registerMob("minecraft:drowned");
+
+ MCTypeRegistry.ENTITY.addWalker(VERSION, "minecraft:trident", new DataWalkerTypePaths<>(MCTypeRegistry.BLOCK_STATE, "inBlockState"));
+ MCTypeRegistry.ENTITY.addWalker(VERSION, "minecraft:trident", new DataWalkerItems("Trident"));
+ }
+
+ private V1470() {}
@ -11361,7 +11438,7 @@ index 0000000000000000000000000000000000000000..97f92a4ee54364616181a2803351481d
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1514.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1514.java
new file mode 100644
index 0000000000000000000000000000000000000000..952598369cb8e5fd567544853bae4f4f7778f6d5
index 0000000000000000000000000000000000000000..2a159164a6ce37d9c0900d4e8d95c26a38bea041
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1514.java
@@ -0,0 +1,68 @@
@ -11370,8 +11447,8 @@ index 0000000000000000000000000000000000000000..952598369cb8e5fd567544853bae4f4f
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.util.ComponentUtils;
+import ca.spottedleaf.dataconverter.types.MapType;
+import net.minecraft.network.chat.Component;
+
+public final class V1514 {
+
@ -11388,7 +11465,7 @@ index 0000000000000000000000000000000000000000..952598369cb8e5fd567544853bae4f4f
+ return null;
+ }
+
+ final String update = Component.Serializer.toJson(Component.literal(displayName));
+ final String update = ComponentUtils.createPlainTextComponent(displayName);
+
+ data.setString("DisplayName", update);
+
@ -11404,7 +11481,7 @@ index 0000000000000000000000000000000000000000..952598369cb8e5fd567544853bae4f4f
+ return null;
+ }
+
+ final String update = Component.Serializer.toJson(Component.literal(displayName));
+ final String update = ComponentUtils.createPlainTextComponent(displayName);
+
+ data.setString("DisplayName", update);
+
@ -11770,7 +11847,7 @@ index 0000000000000000000000000000000000000000..cd5110ef3c18662871020456b60edfb3
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1803.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1803.java
new file mode 100644
index 0000000000000000000000000000000000000000..5f22419287400399dfb31653a9208a54e0811f94
index 0000000000000000000000000000000000000000..9ca850f1bfc9138c68a127a9c90fd33ca81e5dbc
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1803.java
@@ -0,0 +1,47 @@
@ -11779,10 +11856,10 @@ index 0000000000000000000000000000000000000000..5f22419287400399dfb31653a9208a54
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.util.ComponentUtils;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import net.minecraft.network.chat.Component;
+
+public final class V1803 {
+
@ -11812,7 +11889,7 @@ index 0000000000000000000000000000000000000000..5f22419287400399dfb31653a9208a54
+ }
+
+ for (int i = 0, len = lore.size(); i < len; ++i) {
+ lore.setString(i, Component.Serializer.toJson(Component.literal(lore.getString(i))));
+ lore.setString(i, ComponentUtils.createPlainTextComponent(lore.getString(i)));
+ }
+
+ return null;
@ -14541,6 +14618,53 @@ index 0000000000000000000000000000000000000000..9648299bb96c20c783bb7c7010173a0f
+ });
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2538.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2538.java
new file mode 100644
index 0000000000000000000000000000000000000000..17ec2cdecdd794739f5eca5242b3a12211adf1bc
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2538.java
@@ -0,0 +1,41 @@
+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 V2538 {
+
+ private static final int VERSION = MCVersions.V20W20B + 1;
+ private static final String[] MERGE_KEYS = new String[] {
+ "RandomSeed",
+ "generatorName",
+ "generatorOptions",
+ "generatorVersion",
+ "legacy_custom_options",
+ "MapFeatures",
+ "BonusChest"
+ };
+
+ public static void register() {
+ MCTypeRegistry.LEVEL.addStructureConverter(new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ final MapType<String> worldGenSettings = data.getOrCreateMap("WorldGenSettings");
+
+ for (final String key : MERGE_KEYS) {
+ final Object value = data.getGeneric(key);
+ if (value == null) {
+ continue;
+ }
+
+ data.remove(key);
+ worldGenSettings.setGeneric(key, value);
+ }
+
+ return null;
+ }
+ });
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2550.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2550.java
new file mode 100644
index 0000000000000000000000000000000000000000..682b6f16c23ac9ce1a683bac6d36e5d07804b35d
@ -18508,10 +18632,10 @@ index 0000000000000000000000000000000000000000..e9decfa3a1f819354d3b3e6a1cb09b91
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3327.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3327.java
new file mode 100644
index 0000000000000000000000000000000000000000..a2d955a61d6496f19d2d4610057f8325618dfb0d
index 0000000000000000000000000000000000000000..8f12da18cedc50adedf08a4e12428e7e49788886
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3327.java
@@ -0,0 +1,16 @@
@@ -0,0 +1,17 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
@ -18525,6 +18649,7 @@ index 0000000000000000000000000000000000000000..a2d955a61d6496f19d2d4610057f8325
+
+ public static void register() {
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:decorated_pot", new DataWalkerListPaths<>(MCTypeRegistry.ITEM_NAME, "shards"));
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:decorated_pot", new DataWalkerItems("item"));
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:suspicious_sand", new DataWalkerItems("item"));
+ }
+}
@ -18600,19 +18725,18 @@ index 0000000000000000000000000000000000000000..b4584cb2b99abd8739f815c741ea2424
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3439.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3439.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb91879e4e3faa55f2cc546f5f4d69941648f85e
index 0000000000000000000000000000000000000000..301f8582a38fc130bf48be785b7368ac5425e510
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3439.java
@@ -0,0 +1,96 @@
@@ -0,0 +1,94 @@
+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.minecraft.util.ComponentUtils;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import net.minecraft.network.chat.CommonComponents;
+import net.minecraft.network.chat.Component;
+
+public final class V3439 {
+
@ -18620,7 +18744,6 @@ index 0000000000000000000000000000000000000000..eb91879e4e3faa55f2cc546f5f4d6994
+
+ public static void register() {
+ final DataConverter<MapType<String>, MapType<String>> signTileUpdater = new DataConverter<>(VERSION) {
+ private static final String BLANK_TEXT_LINE = Component.Serializer.toJson(CommonComponents.EMPTY);
+ private static final String DEFAULT_COLOR = "black";
+
+ private static ListType migrateToList(final MapType<String> root, final String prefix) {
@ -18630,10 +18753,10 @@ index 0000000000000000000000000000000000000000..eb91879e4e3faa55f2cc546f5f4d6994
+
+ final ListType ret = root.getTypeUtil().createEmptyList();
+
+ ret.addString(root.getString(prefix.concat("1"), BLANK_TEXT_LINE));
+ ret.addString(root.getString(prefix.concat("2"), BLANK_TEXT_LINE));
+ ret.addString(root.getString(prefix.concat("3"), BLANK_TEXT_LINE));
+ ret.addString(root.getString(prefix.concat("4"), BLANK_TEXT_LINE));
+ ret.addString(root.getString(prefix.concat("1"), ComponentUtils.EMPTY));
+ ret.addString(root.getString(prefix.concat("2"), ComponentUtils.EMPTY));
+ ret.addString(root.getString(prefix.concat("3"), ComponentUtils.EMPTY));
+ ret.addString(root.getString(prefix.concat("4"), ComponentUtils.EMPTY));
+
+ return ret;
+ }
@ -18684,7 +18807,7 @@ index 0000000000000000000000000000000000000000..eb91879e4e3faa55f2cc546f5f4d6994
+ backText.setList("messages", blankMessages);
+
+ for (int i = 0; i < 4; ++i) {
+ blankMessages.addString(BLANK_TEXT_LINE);
+ blankMessages.addString(ComponentUtils.EMPTY);
+ }
+
+ backText.setString("color", DEFAULT_COLOR);
@ -18809,10 +18932,10 @@ index 0000000000000000000000000000000000000000..f5a7b72755b53d4e406c95f5ea5857d7
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3448.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3448.java
new file mode 100644
index 0000000000000000000000000000000000000000..b8301cf3328d3cb51374ace856c8b2ca9056cb2b
index 0000000000000000000000000000000000000000..6861a732d551b4ee0a12eb1321a12f86d352ad0a
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3448.java
@@ -0,0 +1,24 @@
@@ -0,0 +1,26 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
@ -18820,6 +18943,7 @@ index 0000000000000000000000000000000000000000..b8301cf3328d3cb51374ace856c8b2ca
+import ca.spottedleaf.dataconverter.minecraft.converters.helpers.RenameHelper;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.DataWalkerListPaths;
+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItems;
+import ca.spottedleaf.dataconverter.types.MapType;
+
+public final class V3448 {
@ -18828,6 +18952,7 @@ index 0000000000000000000000000000000000000000..b8301cf3328d3cb51374ace856c8b2ca
+
+ public static void register() {
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:decorated_pot", new DataWalkerListPaths<>(MCTypeRegistry.ITEM_NAME, "sherds"));
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:decorated_pot", new DataWalkerItems("item"));
+ MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:decorated_pot", new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
@ -18948,20 +19073,19 @@ index 0000000000000000000000000000000000000000..86509b2fa3c83dc485776d36b7bc2944
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3564.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3564.java
new file mode 100644
index 0000000000000000000000000000000000000000..b98d117ec8d5e8be88172d3089b39044acf8bb3a
index 0000000000000000000000000000000000000000..2421a884780d29a1f7776db8cc1f6fd7316fd0de
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3564.java
@@ -0,0 +1,93 @@
@@ -0,0 +1,91 @@
+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.minecraft.util.ComponentUtils;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import net.minecraft.network.chat.CommonComponents;
+import net.minecraft.network.chat.Component;
+
+public final class V3564 {
+
@ -18986,7 +19110,6 @@ index 0000000000000000000000000000000000000000..b98d117ec8d5e8be88172d3089b39044
+ "GlowingText"
+ };
+
+ private static final String EMPTY = Component.Serializer.toJson(CommonComponents.EMPTY);
+
+ private static void updateText(final MapType<String> text) {
+ if (text == null) {
@ -19012,13 +19135,13 @@ index 0000000000000000000000000000000000000000..b98d117ec8d5e8be88172d3089b39044
+
+ for (int i = 0, len = filteredMessages.size(); i < len; ++i) {
+ final String filtered = filteredMessages.getString(i);
+ final String message = messages != null && i < messages.size() ? messages.getString(i) : EMPTY;
+ final String message = messages != null && i < messages.size() ? messages.getString(i) : ComponentUtils.EMPTY;
+
+ final String newFiltered = EMPTY.equals(filtered) ? message : filtered;
+ final String newFiltered = ComponentUtils.EMPTY.equals(filtered) ? message : filtered;
+
+ newFilteredList.addString(newFiltered);
+
+ newFilteredIsEmpty = newFilteredIsEmpty && EMPTY.equals(newFiltered);
+ newFilteredIsEmpty = newFilteredIsEmpty && ComponentUtils.EMPTY.equals(newFiltered);
+ }
+
+ if (newFilteredIsEmpty) {
@ -19392,6 +19515,203 @@ index 0000000000000000000000000000000000000000..311a57529c5f95ce48631b48fefb4eba
+ MCTypeRegistry.ITEM_STACK.addStructureConverter(itemConverter);
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3682.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3682.java
new file mode 100644
index 0000000000000000000000000000000000000000..43cb10e3f13f9a2ffd82af70c7cae3b845cfc413
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3682.java
@@ -0,0 +1,14 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItemLists;
+
+public final class V3682 {
+
+ private static final int VERSION = MCVersions.V23W41A + 1;
+
+ public static void register() {
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:crafter", new DataWalkerItemLists("Items"));
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3683.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3683.java
new file mode 100644
index 0000000000000000000000000000000000000000..d52a5a17da2c20cdc1b39f6ba6b1dbfbb9a21a0f
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3683.java
@@ -0,0 +1,31 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.converters.helpers.RenameHelper;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.DataWalkerTypePaths;
+import ca.spottedleaf.dataconverter.types.MapType;
+
+public final class V3683 {
+
+ private static final int VERSION = MCVersions.V23W41A + 2;
+
+ public static void register() {
+ MCTypeRegistry.ENTITY.addConverterForId("minecraft:tnt", new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ RenameHelper.renameSingle(data, "Fuse", "fuse");
+
+ final MapType<String> defaultState = data.getTypeUtil().createEmptyMap();
+ data.setMap("block_state", defaultState);
+
+ defaultState.setString("Name", "minecraft:tnt");
+
+ return null;
+ }
+ });
+
+ MCTypeRegistry.ENTITY.addWalker(VERSION, "minecraft:tnt", new DataWalkerTypePaths<>(MCTypeRegistry.BLOCK_STATE, "block_state"));
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3685.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3685.java
new file mode 100644
index 0000000000000000000000000000000000000000..e0eed7f2c636e5ff65ad4c8c49c0111c6f1c04f2
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3685.java
@@ -0,0 +1,62 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.converters.helpers.RenameHelper;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.DataWalkerTypePaths;
+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItems;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.TypeUtil;
+
+public final class V3685 {
+
+ private static final int VERSION = MCVersions.V23W42A + 1;
+
+ private static String getType(final MapType<String> arrow) {
+ return "minecraft:empty".equals(arrow.getString("Potion", "minecraft:empty")) ? "minecraft:arrow" : "minecraft:tipped_arrow";
+ }
+
+ private static MapType<String> createItem(final TypeUtil util, final String id, final int count) {
+ final MapType<String> ret = util.createEmptyMap();
+
+ ret.setString("id", id);
+ ret.setInt("Count", count);
+
+ return ret;
+ }
+
+ private static void registerArrowEntity(final String id) {
+ MCTypeRegistry.ENTITY.addWalker(VERSION, id, new DataWalkerTypePaths<>(MCTypeRegistry.BLOCK_STATE, "inBlockState"));
+ // new: item
+ MCTypeRegistry.ENTITY.addWalker(VERSION, id, new DataWalkerItems("item"));
+ }
+
+ public static void register() {
+ MCTypeRegistry.ENTITY.addConverterForId("minecraft:trident", new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ RenameHelper.renameSingle(data, "Trident", "item");
+ return null;
+ }
+ });
+ MCTypeRegistry.ENTITY.addConverterForId("minecraft:arrow", new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ data.setMap("item", createItem(data.getTypeUtil(), getType(data), 1));
+ return null;
+ }
+ });
+ MCTypeRegistry.ENTITY.addConverterForId("minecraft:spectral_arrow", new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ data.setMap("item", createItem(data.getTypeUtil(), "minecraft:spectral_arrow", 1));
+ return null;
+ }
+ });
+
+ registerArrowEntity("minecraft:trident");
+ registerArrowEntity("minecraft:spectral_arrow");
+ registerArrowEntity("minecraft:arrow");
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3689.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3689.java
new file mode 100644
index 0000000000000000000000000000000000000000..427841b46b4fbb993aee6d8670d42eaf91f41793
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3689.java
@@ -0,0 +1,37 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.converters.datatypes.DataWalker;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.WalkerUtils;
+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItemLists;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+
+public final class V3689 {
+
+ private static final int VERSION = MCVersions.V23W44A + 1;
+
+ private static void registerMob(final String id) {
+ MCTypeRegistry.ENTITY.addWalker(VERSION, id, new DataWalkerItemLists("ArmorItems", "HandItems"));
+ }
+
+ public static void register() {
+ registerMob("minecraft:breeze");
+ // minecraft:wind_charge is a simple entity
+
+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:trial_spawner", (final MapType<String> data, final long fromVersion, final long toVersion) -> {
+ final ListType spawnPotentials = data.getList("spawn_potentials", ObjectType.MAP);
+ if (spawnPotentials != null) {
+ for (int i = 0, len = spawnPotentials.size(); i < len; ++i) {
+ WalkerUtils.convert(MCTypeRegistry.ENTITY, spawnPotentials.getMap(i).getMap("data"), "entity", fromVersion, toVersion);
+ }
+ }
+
+ WalkerUtils.convert(MCTypeRegistry.ENTITY, data, "spawn_data", fromVersion, toVersion);
+ return null;
+ });
+ }
+
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3692.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3692.java
new file mode 100644
index 0000000000000000000000000000000000000000..d49be320a8bc5f84ec1e0392257eede1a673bb27
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3692.java
@@ -0,0 +1,23 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.converters.blockname.ConverterAbstractBlockRename;
+import ca.spottedleaf.dataconverter.minecraft.converters.itemname.ConverterAbstractItemRename;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class V3692 {
+
+ private static final int VERSION = MCVersions.V23W46A + 1;
+
+ private static final Map<String, String> GRASS_RENAME = new HashMap<>(
+ Map.of(
+ "minecraft:grass", "minecraft:short_grass"
+ )
+ );
+
+ public static void register() {
+ ConverterAbstractBlockRename.registerAndFixJigsaw(VERSION, GRASS_RENAME::get);
+ ConverterAbstractItemRename.register(VERSION, GRASS_RENAME::get);
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java
new file mode 100644
index 0000000000000000000000000000000000000000..6ab2bf99d72983fc2742a1f6f2f7fa671611526d
@ -19722,10 +20042,10 @@ index 0000000000000000000000000000000000000000..88d9c0fcd88ccfd6d6b46ae050914079
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V704.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V704.java
new file mode 100644
index 0000000000000000000000000000000000000000..c28f1ec9ea87105eb1391d99f4f5858f03b0a503
index 0000000000000000000000000000000000000000..ef080b7c625c977c1dd4fe179ac2ca40889720b2
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V704.java
@@ -0,0 +1,392 @@
@@ -0,0 +1,394 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
@ -19880,6 +20200,7 @@ index 0000000000000000000000000000000000000000..c28f1ec9ea87105eb1391d99f4f5858f
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:beehive", "minecraft:beehive");
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:sculk_sensor", "minecraft:sculk_sensor");
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:decorated_pot", "minecraft:decorated_pot");
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:crafter", "minecraft:crafter");
+
+ // These are missing from Vanilla (TODO check on update)
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:enchanting_table", "minecraft:enchanting_table");
@ -19908,6 +20229,7 @@ index 0000000000000000000000000000000000000000..c28f1ec9ea87105eb1391d99f4f5858f
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:cherry_hanging_sign", "minecraft:sign");
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:suspicious_gravel", "minecraft:brushable_block");
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:calibrated_sculk_sensor", "minecraft:calibrated_sculk_sensor");
+ ITEM_ID_TO_TILE_ENTITY_ID.put("minecraft:trial_spawner", "minecraft:trial_spawner");
+ }
+
+ // This class is responsible for also integrity checking the item id to tile id map here, we just use the item registry to figure it out
@ -24471,11 +24793,11 @@ index 0000000000000000000000000000000000000000..5a6536377c9c1e1753e930ff2a6bb98e
+ }
+}
diff --git a/src/main/java/net/minecraft/data/structures/StructureUpdater.java b/src/main/java/net/minecraft/data/structures/StructureUpdater.java
index d45b0b75509802c396fd4415d9f0adf5707f7515..26f901e34e7d8b1c52788c9dbe8859920bd4d498 100644
index 2939fad9c86f358b317f815d6efff0f41f6a3ea8..3e4cd09fc37d72d22a0f966039d1e65b1d80cc84 100644
--- a/src/main/java/net/minecraft/data/structures/StructureUpdater.java
+++ b/src/main/java/net/minecraft/data/structures/StructureUpdater.java
@@ -25,7 +25,7 @@ public class StructureUpdater implements SnbtToNbt.Filter {
LOGGER.warn("SNBT Too old, do not forget to update: {} < {}: {}", i, 3563, name);
LOGGER.warn("SNBT Too old, do not forget to update: {} < {}: {}", i, 3678, name);
}
- CompoundTag compoundTag = DataFixTypes.STRUCTURE.updateToCurrentVersion(DataFixers.getDataFixer(), nbt, i);
@ -24561,10 +24883,10 @@ index 15a9736a870055d639d03063c7cf67fd769fff36..1ca00340aaa201dd34e5c350d23ef53e
LOGGER.warn("Failed to partially datafix chunk {}", pos, var12);
return StructureCheckResult.CHUNK_LOAD_NEEDED;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java
index cd4bdde9f67231ed767ea0c5728d0e75001ba917..a014666a6d7ca8306316af56e7fb35778b668ce6 100644
index e534dac9d69147174f6b9e8ce7f27fde536351ce..270fd52ec733c89bd91155c8222936fafbcf94d6 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java
@@ -235,7 +235,7 @@ public class StructureTemplateManager {
@@ -236,7 +236,7 @@ public class StructureTemplateManager {
public StructureTemplate readStructure(CompoundTag nbt) {
StructureTemplate structureTemplate = new StructureTemplate();
int i = NbtUtils.getDataVersion(nbt, 500);
@ -24573,29 +24895,33 @@ index cd4bdde9f67231ed767ea0c5728d0e75001ba917..a014666a6d7ca8306316af56e7fb3577
return structureTemplate;
}
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
index 836bcea1c6a9de29b4a248220331f3a8c697204d..ff33031e59db6f9a4a11c7877f97615ef00a5a27 100644
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
+++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
@@ -290,10 +290,10 @@ public class LevelStorageSource {
static Dynamic<?> readLevelDataTagFixed(Path path, DataFixer dataFixer) throws IOException {
CompoundTag nbttagcompound = LevelStorageSource.readLevelDataTagRaw(path);
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Data");
- int i = NbtUtils.getDataVersion(nbttagcompound1, -1);
+ int i = NbtUtils.getDataVersion(nbttagcompound1, -1); final int version = i; // Paper - obfuscation helpers
Dynamic<?> dynamic = DataFixTypes.LEVEL.updateToCurrentVersion(dataFixer, new Dynamic(NbtOps.INSTANCE, nbttagcompound1), i);
Dynamic<?> dynamic1 = dynamic.get("Player").orElseEmptyMap();
- Dynamic<?> dynamic2 = DataFixTypes.PLAYER.updateToCurrentVersion(dataFixer, dynamic1, i);
+ Dynamic<?> dynamic2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, dynamic1, version, SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper
dynamic = dynamic.set("Player", dynamic2);
Dynamic<?> dynamic3 = dynamic.get("WorldGenSettings").orElseEmptyMap();
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index a5c67686f7c1be10d31601903e27d24e41cff83e..e2c0ab0ab06b15dcfa6ce8c82ad4136f2be33b5c 100644
index 8292978e1386c55d99241c3ee2ead3440b9e2570..3d74ffc6e38b0dbe7ca6d8d84a63f78d6b1908a7 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -93,7 +93,7 @@ public class PlayerDataStorage {
@@ -97,7 +97,7 @@ public class PlayerDataStorage {
// CraftBukkit end
int i = NbtUtils.getDataVersion(nbttagcompound, -1);
- player.load(DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i));
+ player.load(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, nbttagcompound, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion())); // Paper - replace player converter
- nbttagcompound = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i);
+ nbttagcompound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, nbttagcompound, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - replace player converter
player.load(nbttagcompound);
}
return nbttagcompound;
diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
index b075f990692e68e82c10625d843109e90b1b6118..8f661e3080f8145c1e78ff7bd84d77707eef6d9e 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -316,7 +316,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
throw (NullPointerException) Util.pauseInIde(new NullPointerException("Fixer Upper not set inside LevelData, and the player tag is not upgraded."));
}
- this.loadedPlayerTag = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, this.loadedPlayerTag, this.playerDataVersion);
+ this.loadedPlayerTag = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, this.loadedPlayerTag, version, SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper
}
this.upgradedPlayerTag = true;