Skip to content

Commit

Permalink
Merge branch 'PaperMC:master' into ver/1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
killerprojecte authored Aug 8, 2023
2 parents 5625b94 + 3cf16ee commit a52fd54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions patches/server/0003-Threaded-Regions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14675,7 +14675,7 @@ index 18aac3da3c88f33b1a71a5920a8daa27e9723913..bb07ad1bb895297356b88dfc4cd17e5e
for (ServerPlayer player : ServerLevel.this.players) {
player.getBukkitEntity().onEntityRemove(entity);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af8a9e8791 100644
index 9d46536f80b5b3e6641fd377c02166a431edfd77..7c4ec191dc64968d349b244818f65c64ba7ab308 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -190,7 +190,7 @@ import org.bukkit.inventory.MainHand;
Expand Down Expand Up @@ -14892,7 +14892,7 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
return horizontalSpawnArea <= 16 ? horizontalSpawnArea - 1 : 17;
}

@@ -1161,6 +1258,345 @@ public class ServerPlayer extends Player {
@@ -1161,6 +1258,344 @@ public class ServerPlayer extends Player {
}
}

Expand Down Expand Up @@ -14957,9 +14957,13 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
+ EntityTreeNode passengerTree = this.makePassengerTree();
+
+ this.isChangingDimension = true;
+ // must be manually removed from connections
+ this.serverLevel().getCurrentWorldData().connections.remove(this.connection.connection);
+ origin.removePlayerImmediately(this, RemovalReason.CHANGED_DIMENSION);
+ // reset player if needed, only after removal from world
+ if (!alive) {
+ ServerPlayer.this.reset();
+ }
+ // must be manually removed from connections, delay until after reset() so that we do not trip any thread checks
+ this.serverLevel().getCurrentWorldData().connections.remove(this.connection.connection);
+
+ BlockPos respawnPos = this.getRespawnPosition();
+ float respawnAngle = this.getRespawnAngle();
Expand Down Expand Up @@ -14987,11 +14991,6 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
+ TELEPORT_FLAG_LOAD_CHUNK | TELEPORT_FLAGS_PLAYER_RESPAWN | TELEPORT_FLAGS_AVOID_SUFFOCATION,
+ passengerTree, // note: we expect this to just be the player, no passengers
+ (entity) -> {
+ // reset player if needed
+ // only after placing, so that we don't trip thread checks
+ if (!alive) {
+ ServerPlayer.this.reset();
+ }
+ // now the player is in the world, and can receive sound
+ if (usedRespawnAnchor[0]) {
+ ServerPlayer.this.connection.send(
Expand Down Expand Up @@ -15238,7 +15237,7 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
@Nullable
@Override
public Entity changeDimension(ServerLevel destination) {
@@ -1170,6 +1606,11 @@ public class ServerPlayer extends Player {
@@ -1170,6 +1605,11 @@ public class ServerPlayer extends Player {

@Nullable
public Entity changeDimension(ServerLevel worldserver, PlayerTeleportEvent.TeleportCause cause) {
Expand All @@ -15250,7 +15249,7 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
// CraftBukkit end
if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
// this.isChangingDimension = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
@@ -2114,6 +2555,12 @@ public class ServerPlayer extends Player {
@@ -2114,6 +2554,12 @@ public class ServerPlayer extends Player {
public void setCamera(@Nullable Entity entity) {
Entity entity1 = this.getCamera();

Expand All @@ -15263,7 +15262,7 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) {
// Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event
@@ -2307,7 +2754,7 @@ public class ServerPlayer extends Player {
@@ -2307,7 +2753,7 @@ public class ServerPlayer extends Player {
}

public void untrackChunk(ChunkPos chunkPos) {
Expand All @@ -15272,7 +15271,7 @@ index 9d46536f80b5b3e6641fd377c02166a431edfd77..abbc8992523e55a665318df07dd732af
this.connection.send(new ClientboundForgetLevelChunkPacket(chunkPos.x, chunkPos.z));
// Paper start
if(io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){
@@ -2626,7 +3073,7 @@ public class ServerPlayer extends Player {
@@ -2626,7 +3072,7 @@ public class ServerPlayer extends Player {
this.experienceLevel = this.newLevel;
this.totalExperience = this.newTotalExp;
this.experienceProgress = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly.

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index abbc8992523e55a665318df07dd732af8a9e8791..febd0ba72922462364eb65243640dcb693129e21 100644
index 7c4ec191dc64968d349b244818f65c64ba7ab308..c0ad878cd29e2f72b7899d9539031b15ccbf6193 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -629,7 +629,7 @@ public class ServerPlayer extends Player {
Expand Down

0 comments on commit a52fd54

Please sign in to comment.