3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

Add DataConverter to StructureCheck, for structure lookups

Mojang added a partial conversion here to quickly check for
structures, which bypasses the chunk system. So we need a
hook here.
Dieser Commit ist enthalten in:
Spottedleaf 2022-02-25 08:46:35 -08:00
Ursprung bfa50ad5b3
Commit 7f65b0b589
2 geänderte Dateien mit 55 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -21672,6 +21672,19 @@ index d73b99d7fde724da4503b5176c3ad7b013197c6a..ec7aa86514f89042c885c0515f074431
OptionalDynamic<T> optionalDynamic = dynamic2.get("Sections");
for(int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); ++l) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
index fa75190ef5fe322a4c78e62b2159bdf18fd014bb..22d3fd0b1951e72ac0315bfc6ab39531f0b2d075 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
@@ -128,7 +128,7 @@ public class StructureCheck {
CompoundTag compoundTag2;
try {
- compoundTag2 = NbtUtils.update(this.fixerUpper, DataFixTypes.CHUNK, compoundTag, i);
+ compoundTag2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, compoundTag, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter
} catch (Exception var12) {
LOGGER.warn("Failed to partially datafix chunk {}", pos, var12);
return StructureCheckResult.CHUNK_LOAD_NEEDED;
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 6727468946ea5f60bd80549f827a7c2b9a42b98b..35c39aed9583275ef25d32c783715798b52bdb63 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java

Datei anzeigen

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 25 Feb 2022 07:14:48 -0800
Subject: [PATCH] Fix missing Level -> LevelStem in StructureCheck from CB
Need to use the right for injectDatafixingContext
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 835a17cd4ec487271ba28232280dd0fbf2687c4b..768017ba650f1bd96e3db0aad8fda939e2ea7add 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -532,7 +532,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
long l = minecraftserver.getWorldData().worldGenSettings().seed();
- this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer);
+ this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), this.getTypeKey(), chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer); // Paper - Fix missing CB diff
this.structureFeatureManager = new StructureFeatureManager(this, this.serverLevelData.worldGenSettings(), this.structureCheck); // CraftBukkit
if (this.dimensionType().createDragonFight()) {
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenSettings().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
index 22d3fd0b1951e72ac0315bfc6ab39531f0b2d075..07379c20433a990a74df2c752f69457c76527cf4 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
@@ -47,7 +47,7 @@ public class StructureCheck {
private final RegistryAccess registryAccess;
private final Registry<Biome> biomes;
private final StructureManager structureManager;
- private final ResourceKey<Level> dimension;
+ private final ResourceKey<net.minecraft.world.level.dimension.LevelStem> dimension; // Paper - fix missing CB diff
private final ChunkGenerator chunkGenerator;
private final LevelHeightAccessor heightAccessor;
private final BiomeSource biomeSource;
@@ -56,7 +56,7 @@ public class StructureCheck {
private final Long2ObjectMap<Object2IntMap<StructureFeature<?>>> loadedChunks = new Long2ObjectOpenHashMap<>();
private final Map<StructureFeature<?>, Long2BooleanMap> featureChecks = new HashMap<>();
- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureManager structureManager, ResourceKey<Level> worldKey, ChunkGenerator chunkGenerator, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) {
+ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureManager structureManager, ResourceKey<net.minecraft.world.level.dimension.LevelStem> worldKey, ChunkGenerator chunkGenerator, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff
this.storageAccess = chunkIoWorker;
this.registryAccess = registryManager;
this.structureManager = structureManager;