net.minecraft.util.worldupdate

This commit is contained in:
Noah van der Aa 2024-12-14 19:27:16 +01:00
parent c8d3ed4430
commit 33efd7ee12
No known key found for this signature in database
GPG key ID: 547D90BC6FF753CF
2 changed files with 22 additions and 32 deletions

View file

@ -0,0 +1,22 @@
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
@@ -79,7 +_,7 @@
LevelStorageSource.LevelStorageAccess levelStorage, DataFixer dataFixer, RegistryAccess registryAccess, boolean eraseCache, boolean recreateRegionFiles
) {
this.dimensions = registryAccess.lookupOrThrow(Registries.LEVEL_STEM);
- this.levels = this.dimensions.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet());
+ this.levels = java.util.stream.Stream.of(levelStorage.dimensionType).map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); // CraftBukkit
this.eraseCache = eraseCache;
this.dataFixer = dataFixer;
this.levelStorage = levelStorage;
@@ -357,9 +_,7 @@
if (compoundTag != null) {
int version = ChunkStorage.getVersion(compoundTag);
ChunkGenerator chunkGenerator = WorldUpgrader.this.dimensions.getValueOrThrow(Registries.levelToLevelStem(dimension)).generator();
- CompoundTag compoundTag1 = chunkStorage.upgradeChunkTag(
- dimension, () -> WorldUpgrader.this.overworldDataStorage, compoundTag, chunkGenerator.getTypeNameForDataFixer()
- );
+ CompoundTag compoundTag1 = chunkStorage.upgradeChunkTag(Registries.levelToLevelStem(dimension), () -> WorldUpgrader.this.overworldDataStorage, compoundTag, chunkGenerator.getTypeNameForDataFixer(), chunkPos, null); // CraftBukkit
ChunkPos chunkPos1 = new ChunkPos(compoundTag1.getInt("xPos"), compoundTag1.getInt("zPos"));
if (!chunkPos1.equals(chunkPos)) {
WorldUpgrader.LOGGER.warn("Chunk {} has invalid position {}", chunkPos, chunkPos1);

View file

@ -1,32 +0,0 @@
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
@@ -80,7 +80,7 @@
public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, RegistryAccess dynamicRegistryManager, boolean eraseCache, boolean recreateRegionFiles) {
this.dimensions = dynamicRegistryManager.lookupOrThrow(Registries.LEVEL_STEM);
- this.levels = (Set) this.dimensions.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet());
+ this.levels = (Set) java.util.stream.Stream.of(session.dimensionType).map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); // CraftBukkit
this.eraseCache = eraseCache;
this.dataFixer = dataFixer;
this.levelStorage = session;
@@ -197,9 +197,9 @@
if (nbttagcompound != null) {
int i = ChunkStorage.getVersion(nbttagcompound);
ChunkGenerator chunkgenerator = ((LevelStem) WorldUpgrader.this.dimensions.getValueOrThrow(Registries.levelToLevelStem(worldKey))).generator();
- CompoundTag nbttagcompound1 = storage.upgradeChunkTag(worldKey, () -> {
+ CompoundTag nbttagcompound1 = storage.upgradeChunkTag(Registries.levelToLevelStem(worldKey), () -> { // CraftBukkit
return WorldUpgrader.this.overworldDataStorage;
- }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer());
+ }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer(), chunkPos, null); // CraftBukkit
ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos"));
if (!chunkcoordintpair1.equals(chunkPos)) {
@@ -321,7 +321,7 @@
WorldUpgrader.DimensionToUpgrade<T> worldupgrader_c = (WorldUpgrader.DimensionToUpgrade) iterator.next();
ResourceKey<Level> resourcekey = worldupgrader_c.dimensionKey;
ListIterator<WorldUpgrader.FileToUpgrade> listiterator = worldupgrader_c.files;
- T t0 = (AutoCloseable) worldupgrader_c.storage;
+ T t0 = (T) worldupgrader_c.storage; // CraftBukkit - decompile error
if (listiterator.hasNext()) {
WorldUpgrader.FileToUpgrade worldupgrader_e = (WorldUpgrader.FileToUpgrade) listiterator.next();