More compilation error fixes

This commit is contained in:
Nassim Jahnke 2022-06-08 16:24:55 +02:00
parent b561fd8b25
commit 1d5b298c19
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
8 changed files with 37 additions and 23 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

@ -26,10 +26,10 @@ index 80a3d5890aab91e6a48d5734140187851106bde3..c1eb4201ecb0541c606ef0d05b828ae9
}
diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
new file mode 100644
index 0000000000000000000000000000000000000000..1c820b01c65f69b4b158a5d2134419b52e77f5ee
index 0000000000000000000000000000000000000000..07cd02c6f9df00844b808218be2afd793c24b69a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
@@ -0,0 +1,84 @@
@@ -0,0 +1,86 @@
+package io.papermc.paper.adventure;
+
+import com.google.gson.JsonElement;
@ -41,8 +41,10 @@ index 0000000000000000000000000000000000000000..1c820b01c65f69b4b158a5d2134419b5
+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..1c820b01c65f69b4b158a5d2134419b5
+ }
+
+ @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();
+ }
@ -2480,7 +2482,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa
public boolean isOp() {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fe392a144edc3282793449cac6c9c953d9648a9e..aff5fa1fe20b4b3aa7562cafa4117b43bc904d0a 100644
index ddc06ac935d7f35a66cbbaa3d4f974800ae0b3e8..3ac1d0f7ad41ac66d6061fffe32efd7ea4757653 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -269,14 +269,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -30,7 +30,7 @@ easy to add threading, so I did.
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
new file mode 100644
index 0000000000000000000000000000000000000000..ca4e9acb4b7beb739546954d0aa02461559a28c8
index 0000000000000000000000000000000000000000..95cac7edae8ac64811fc6a2f6b97dd4a0fceb0b0
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
@@ -0,0 +1,209 @@
@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..ca4e9acb4b7beb739546954d0aa02461
+ 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

@ -1189,19 +1189,22 @@ index 0000000000000000000000000000000000000000..18bcb79899a5ccb63096cba8075d6438
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/ReplacedDataFixerUpper.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/ReplacedDataFixerUpper.java
new file mode 100644
index 0000000000000000000000000000000000000000..5ddf54649fc0ddcee1b1f6bdc6e8d7be7ae46618
index 0000000000000000000000000000000000000000..0c8eb9e326ce1941db176e5e5bc3ea7738c4b80a
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/ReplacedDataFixerUpper.java
@@ -0,0 +1,140 @@
@@ -0,0 +1,154 @@
+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..5ddf54649fc0ddcee1b1f6bdc6e8d7be
+ 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..5ddf54649fc0ddcee1b1f6bdc6e8d7be
+ }
+ }
+
+ 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);

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 7fd9f20d60339270d5e4adbf098ac38a832fb224..7f538d8a6918fbb659d4090c7157d02b3d085478 100644
index 7fd9f20d60339270d5e4adbf098ac38a832fb224..77b88eec2b6ba88605cdd5f4a60c2e2eda88288e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -283,13 +283,17 @@ public class CraftChunk implements Chunk {
@ -37,7 +37,7 @@ index 7fd9f20d60339270d5e4adbf098ac38a832fb224..7f538d8a6918fbb659d4090c7157d02b
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

@ -25,10 +25,6 @@ index 17828c924fa20ebc1d72f73adf62f1c0cb078a68..2e9b782e34ae25e982b45011a36c3b08
- /*
- 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 17828c924fa20ebc1d72f73adf62f1c0cb078a68..2e9b782e34ae25e982b45011a36c3b08
+ 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

@ -158,10 +158,10 @@ index 3c93bfeb94168f832904a8462ae23b06e81e080d..468c635d31cfa8051666bbefce8df4b4
this.onChanged(server);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 105869020cd5b056b984c57f7196e9256e07b83e..7dc99902f8b199a74356c0510397000253c26b6a 100644
index e30cd412f30e26aa4c59f367b3cc26ba47e1b21c..2211365ea3d6907c92d43d45ad61b66d7b57ad7b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1915,7 +1915,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1914,7 +1914,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper end
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
handle.deserialize(event.getValue()); // Paper
@ -170,7 +170,7 @@ index 105869020cd5b056b984c57f7196e9256e07b83e..7dc99902f8b199a74356c05103970002
return true;
}
@@ -1955,7 +1955,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1954,7 +1954,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper end
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
handle.deserialize(event.getValue()); // Paper

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