More compilation error fixes

This commit is contained in:
Nassim Jahnke 2022-06-08 16:24:55 +02:00
parent 0da6d1d498
commit 3cd8d0c681
7 changed files with 27 additions and 13 deletions

View file

@ -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 {

View file

@ -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();
+ }

View file

@ -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<Holder<Biome>>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs
}
}

View file

@ -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;

View file

@ -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<ChunkAccess> list = new ArrayList<>();
+ final int range = Math.max(1, chunkStatus.getRange());

View file

@ -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<T> ret = new Dynamic<>(input.getOps(), (T)MCDataConverter.copy(MCDataConverter.convertUnwrapped((DataType)equivType, input.getValue(), false, version, newVersion)));
+ final Dynamic<T> 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 <T, R> R convertUnwrapped(final DataType<T, R> 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);

@ -1 +1 @@
Subproject commit ee737122ade6975c33c206b0c753f4dd29cfafb4
Subproject commit fa893f0bb7c6e1cbd28315f77da5c37a67afbe98