1.20: Fix a bunch of compile issues (#9273)

Dieser Commit ist enthalten in:
Noah van der Aa 2023-06-08 01:21:20 +02:00 committet von GitHub
Ursprung f0889559f3
Commit b1a2378144
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
10 geänderte Dateien mit 588 neuen und 655 gelöschten Zeilen

Datei anzeigen

@ -255,7 +255,7 @@ index 0000000000000000000000000000000000000000..3b53d87a52cafb2503419f21ddd87d42
+}
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
new file mode 100644
index 0000000000000000000000000000000000000000..45830cf2b42c2c983cef922c6355e5d6a7cfb982
index 0000000000000000000000000000000000000000..f2141c1bb4e1fd6697326b50db74f78a8367b9e4
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -0,0 +1,412 @@
@ -479,7 +479,7 @@ index 0000000000000000000000000000000000000000..45830cf2b42c2c983cef922c6355e5d6
+
+ final Set<Audience> viewers = event.viewers();
+ final ResourceKey<ChatType> chatTypeKey = renderer instanceof ChatRenderer.Default ? ChatType.CHAT : ChatType.RAW;
+ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player.level.registryAccess(), PaperAdventure.asVanilla(displayName(player)));
+ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player().level.registryAccess(), PaperAdventure.asVanilla(displayName(player)));
+
+ OutgoingChat outgoingChat = viewers instanceof LazyChatAudienceSet lazyAudienceSet && lazyAudienceSet.isLazy() ? new ServerOutgoingChat() : new ViewersOutgoingChat();
+ /* if (this.flags.get(FORCE_PREVIEW_USE)) { // TODO (future, maybe?)

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -4343,7 +4343,7 @@ index 16fdfda717300a3168c27526470f83ce6239e95f..a52e6e8be323863ece6624a8ae7f9455
.flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue())))
diff --git a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..7784d72ddd6db00c674e22759c00c430222c4b85
index 0000000000000000000000000000000000000000..463c6d8d5b114816ed9065558285945817c30385
--- /dev/null
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
@@ -0,0 +1,115 @@
@ -4409,7 +4409,7 @@ index 0000000000000000000000000000000000000000..7784d72ddd6db00c674e22759c00c430
+
+ CraftPlayer player = (CraftPlayer) sender;
+ ServerPlayer handle = player.getHandle();
+ ServerLevel world = (ServerLevel) handle.level;
+ ServerLevel world = (ServerLevel) handle.level();
+ ThreadedLevelLightEngine lightengine = world.getChunkSource().getLightEngine();
+ this.starlightFixLight(handle, world, lightengine, radius, post);
+ }

Datei anzeigen

@ -17,7 +17,7 @@ public org.bukkit.craftbukkit.entity.CraftMinecartContainer setLootTable(Lorg/bu
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
new file mode 100644
index 0000000000000000000000000000000000000000..88e32ed64f90bfd277dac84ba4bd84f0d943f5f8
index 0000000000000000000000000000000000000000..9ca389ca789dc54bba3542cac0aac2e1dc66c870
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
@@ -0,0 +1,63 @@
@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..88e32ed64f90bfd277dac84ba4bd84f0
+
+ @Override
+ public Level getNMSWorld() {
+ return entity.getLevel();
+ return entity.level();
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java

Datei anzeigen

@ -18,7 +18,7 @@ index 04ff01ba9f1f869f90d39645edb7aba42885725e..5ec480397fb043717c63961651f7c624
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
this.trackedPlayers = trackedPlayers;
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 50fa14b045a1f75d43d90741245cc4506ed666a0..f2d455e1730336f17d667d91416077cb8d5fe86d 100644
index 50fa14b045a1f75d43d90741245cc4506ed666a0..1251c704e3b83888133b83757e7773c3e3664e6e 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -95,6 +95,27 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@ -57,7 +57,7 @@ index 50fa14b045a1f75d43d90741245cc4506ed666a0..f2d455e1730336f17d667d91416077cb
+ // Paper start - Optional prevent TNT from moving in water
+ @Override
+ public boolean isPushedByFluid() {
+ return !level.paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
+ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
+ }
+ // Paper end
}

Datei anzeigen

@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
index 8a5e93961dac4d87c81c0e70b6f4124a1f1d2556..bb5870e5f6949790e97cde83665caac8c384ccd2 100644
index 8a5e93961dac4d87c81c0e70b6f4124a1f1d2556..ab2a70bb52f847c753ae0cb8f88476fdbe6cee09 100644
--- a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
+++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
@@ -223,7 +223,17 @@ public final class ChunkSystem {
@ -45,7 +45,7 @@ index 8a5e93961dac4d87c81c0e70b6f4124a1f1d2556..bb5870e5f6949790e97cde83665caac8
+ if (net.minecraft.server.level.ChunkMap.checkDupeUUID(level, entity)) {
+ return;
+ }
+ if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level.paperConfig().entities.spawning.duplicateUuid.mode != io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.NOTHING) {
+ if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level().paperConfig().entities.spawning.duplicateUuid.mode != io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.NOTHING) {
+ if (((Entity) entity).addedToWorldStack != null) {
+ ((Entity) entity).addedToWorldStack.printStackTrace();
+ }

Datei anzeigen

@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 3ab66eb22561971392616c083bae5339e6ddc493..f27e9dd8185892b3948814937380140c45d7fd33 100644
index 3ab66eb22561971392616c083bae5339e6ddc493..b9ba0504590f754366ce9302ae6a267e0a2e84e2 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1565,6 +1565,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -15,7 +15,7 @@ index 3ab66eb22561971392616c083bae5339e6ddc493..f27e9dd8185892b3948814937380140c
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
+ // Paper start - ignore and warn about illegal addEntity calls instead of crashing server
+ if (!entity.valid || entity.level != this.level || this.entityMap.containsKey(entity.getId())) {
+ if (!entity.valid || entity.level() != this.level || this.entityMap.containsKey(entity.getId())) {
+ LOGGER.error("Illegal ChunkMap::addEntity for world " + this.level.getWorld().getName()
+ + ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""), new Throwable());
+ return;

Datei anzeigen

@ -38,7 +38,7 @@ index a1eb5b0357d646b42031a5a21cc7740a94430558..ef5adc495a6feefdcf3ba595334436a5
public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper
diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java
index f2c423154ed6a00882a46d93b69ed4f6ba73782c..90d8d484dd66d6da33f3dd55bdf1d3a059df2a84 100644
index f2c423154ed6a00882a46d93b69ed4f6ba73782c..8e1ca05ef78395b95a992f367214755b8084eee4 100644
--- a/src/main/java/net/minecraft/world/level/BlockCollisions.java
+++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java
@@ -65,22 +65,41 @@ public class BlockCollisions<T> extends AbstractIterator<T> {
@ -76,7 +76,7 @@ index f2c423154ed6a00882a46d93b69ed4f6ba73782c..90d8d484dd66d6da33f3dd55bdf1d3a0
+ }
+
+ if (blockState == null) {
+ if (!(source instanceof net.minecraft.server.level.ServerPlayer) || source.level.paperConfig().chunks.preventMovingIntoUnloadedChunks) {
+ if (!(source instanceof net.minecraft.server.level.ServerPlayer) || source.level().paperConfig().chunks.preventMovingIntoUnloadedChunks) {
+ return Shapes.create(far ? source.getBoundingBox() : new AABB(new BlockPos(x, y, z)));
+ }
+ // Paper end

Datei anzeigen

@ -31,7 +31,7 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f27e9dd8185892b3948814937380140c45d7fd33..3616f106b8bd5824700bfb67678599e6e1eca712 100644
index b9ba0504590f754366ce9302ae6a267e0a2e84e2..a39f5408535e16dc5db885554b13195daeb5fea1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1571,6 +1571,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -55,7 +55,7 @@ index df41fdb2072f80129617f96a4f886724c6a0d744..4495edee3b29c441d14460be1bb3f5e0
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7102315de9acb3220f0f49bacb83386a8bcb0ce7..498516c98f396e601e67b9e47a62e89f709f98a5 100644
index 7102315de9acb3220f0f49bacb83386a8bcb0ce7..6b0c045813c9a628bdbb5f3988995abf2c0cb4b9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -311,6 +311,12 @@ public abstract class PlayerList {
@ -76,7 +76,7 @@ index 7102315de9acb3220f0f49bacb83386a8bcb0ce7..498516c98f396e601e67b9e47a62e89f
}
player.sentListPacket = true;
+ player.supressTrackerForLogin = false; // Paper
+ ((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
+ ((ServerLevel)player.level()).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
// CraftBukkit end
player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn

Datei anzeigen

@ -17,14 +17,14 @@ index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..9edea92834306b39abda36ba9be4e879
private EntitySelector() {}
// Paper start
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..e5a53fd86fd34c88e2a5232085f649e6dd3173c2 100644
index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..9660f517963459396f3ff112fbcab9bb1f9c1949 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -563,6 +563,7 @@ public class Phantom extends FlyingMob implements Enemy {
Player entityhuman = (Player) iterator.next();
if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) {
+ if (!level.paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper
+ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper
Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
return true;
}