diff --git a/README.md b/README.md index 83caa19025..b93f75694d 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ repositories { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT") } java { diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 3aa78d92bd..ee4335d0b4 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -41,8 +41,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; ++import net.minecraft.network.chat.ComponentContents; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; ++import net.minecraft.network.chat.contents.LiteralContents; +import net.minecraft.util.FormattedCharSequence; +import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.jetbrains.annotations.Nullable; @@ -74,9 +76,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public String getContents() { ++ public ComponentContents getContents() { + if (this.adventure instanceof TextComponent) { -+ return ((TextComponent) this.adventure).content(); ++ return new LiteralContents(((TextComponent) this.adventure).content()); + } else { + return this.deepConverted().getContents(); + } diff --git a/patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch b/patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch index 3bcefa9942..ff0e7c0e39 100644 --- a/patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch +++ b/patches/server/Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (biome != null) { - data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get()); - biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get(); -+ biome[i] = cs[i].getBiomes().copy(); // Paper - use copy instead of round tripping with codecs ++ biome[i] = ((PalettedContainer>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs } } diff --git a/patches/server/Fix-and-optimise-world-force-upgrading.patch b/patches/server/Fix-and-optimise-world-force-upgrading.patch index c2b8080f37..2adfd436f4 100644 --- a/patches/server/Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/Fix-and-optimise-world-force-upgrading.patch @@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + // no need to check the coordinate of the chunk, the regionfilecache does that for us + -+ CompoundTag chunkNBT = loader.read(chunkPos); ++ CompoundTag chunkNBT = (loader.read(chunkPos).join()).orElse(null); + + if (chunkNBT == null) { + continue; diff --git a/patches/server/Implement-regenerateChunk.patch b/patches/server/Implement-regenerateChunk.patch index dafd833637..5e2f63a908 100644 --- a/patches/server/Implement-regenerateChunk.patch +++ b/patches/server/Implement-regenerateChunk.patch @@ -25,10 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - /* - if (!unloadChunk0(x, z, false)) { - return false; -- } -- -- final long chunkKey = ChunkCoordIntPair.pair(x, z); -- world.getChunkProvider().unloadQueue.remove(chunkKey); + // Paper start - implement regenerateChunk method + final ServerLevel serverLevel = this.world; + final net.minecraft.server.level.ServerChunkCache serverChunkCache = serverLevel.getChunkSource(); @@ -37,8 +33,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (final BlockPos blockPos : BlockPos.betweenClosed(chunkPos.getMinBlockX(), serverLevel.getMinBuildHeight(), chunkPos.getMinBlockZ(), chunkPos.getMaxBlockX(), serverLevel.getMaxBuildHeight() - 1, chunkPos.getMaxBlockZ())) { + levelChunk.removeBlockEntity(blockPos); + serverLevel.setBlock(blockPos, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState(), 16); -+ } -+ + } + +- final long chunkKey = ChunkCoordIntPair.pair(x, z); +- world.getChunkProvider().unloadQueue.remove(chunkKey); + for (final ChunkStatus chunkStatus : REGEN_CHUNK_STATUSES) { + final List list = new ArrayList<>(); + final int range = Math.max(1, chunkStatus.getRange()); diff --git a/patches/server/Rewrite-dataconverter-system.patch b/patches/server/Rewrite-dataconverter-system.patch index e96ab39c5b..c96cd5d62e 100644 --- a/patches/server/Rewrite-dataconverter-system.patch +++ b/patches/server/Rewrite-dataconverter-system.patch @@ -1196,12 +1196,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package ca.spottedleaf.dataconverter.minecraft; + +import ca.spottedleaf.dataconverter.converters.datatypes.DataType; ++import ca.spottedleaf.dataconverter.minecraft.datatypes.MCDataType; +import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry; ++import com.google.gson.JsonObject; +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFixer; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; +import net.minecraft.SharedConstants; ++import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.datafix.fixes.References; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; @@ -1308,7 +1311,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (equivType != null) { + if (newVersion > version) { + try { -+ final Dynamic ret = new Dynamic<>(input.getOps(), (T)MCDataConverter.copy(MCDataConverter.convertUnwrapped((DataType)equivType, input.getValue(), false, version, newVersion))); ++ final Dynamic ret = new Dynamic<>(input.getOps(), (T)MCDataConverter.copy(convertUnwrapped((DataType)equivType, input.getValue(), false, version, newVersion))); + return ret; + } catch (final Exception ex) { + LOGGER.error("Failed to convert data using DataConverter, falling back to DFU", new Throwable()); @@ -1328,6 +1331,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + ++ public static R convertUnwrapped(final DataType type, final T data, final boolean compressedJson, final int fromVersion, final int toVersion) { ++ if (data instanceof CompoundTag) { ++ return (R)MCDataConverter.convertTag((MCDataType)type, (CompoundTag)data, fromVersion, toVersion); ++ } ++ if (data instanceof JsonObject) { ++ return (R)MCDataConverter.convertJson((MCDataType)type, (JsonObject)data, compressedJson, fromVersion, toVersion); ++ } ++ ++ return MCDataConverter.convert(type, data, fromVersion, toVersion); ++ } ++ + @Override + public Schema getSchema(final int key) { + return this.wrapped.getSchema(key); diff --git a/work/Spigot b/work/Spigot index ee737122ad..fa893f0bb7 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit ee737122ade6975c33c206b0c753f4dd29cfafb4 +Subproject commit fa893f0bb7c6e1cbd28315f77da5c37a67afbe98