@@ -14109,7 +14109,7 @@ index a3c7d68469075bf8d33f2016149a181b0fb87e0e..73c581d3ee21d8fa96eae3e47afd6ce2
1410914109 return blockToFallLocation(blockState);
1411014110 } else {
1411114111diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
14112- index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de97f2d007f 100644
14112+ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..ad95af3d2597b3f125de3fbebd2597fbc2807dad 100644
1411314113--- a/net/minecraft/world/entity/Entity.java
1411414114+++ b/net/minecraft/world/entity/Entity.java
1411514115@@ -156,7 +156,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -14303,7 +14303,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1430314303 if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
1430414304 return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
1430514305 }
14306- @@ -3907,8 +3931,795 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
14306+ @@ -3907,8 +3931,804 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1430714307 this.portalProcess = entity.portalProcess;
1430814308 }
1430914309
@@ -14729,6 +14729,15 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1472914729+ return true;
1473014730+ }
1473114731+ }
14732+ + // Folia start - PlayerChangedWorldEvent
14733+ + else if (this instanceof ServerPlayer) {
14734+ + final org.bukkit.craftbukkit.CraftWorld from = this.level().getWorld();
14735+ + this.getBukkitEntity().taskScheduler.schedule((Entity entity) -> {
14736+ + org.bukkit.event.player.PlayerChangedWorldEvent changeEvent = new org.bukkit.event.player.PlayerChangedWorldEvent(((ServerPlayer)entity).getBukkitEntity(), from);
14737+ + org.bukkit.Bukkit.getPluginManager().callEvent(changeEvent);
14738+ + }, null, 1L);
14739+ + }
14740+ + // Folia end - PlayerChangedWorldEvent
1473214741+
1473314742+ EntityTreeNode passengerTree = this.detachPassengers();
1473414743+ List<EntityTreeNode> fullPassengerTree = passengerTree.getFullTree();
@@ -15099,7 +15108,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1509915108 // Paper start - Fix item duplication and teleport issues
1510015109 if ((!this.isAlive() || !this.valid) && (teleportTransition.newLevel() != this.level)) {
1510115110 LOGGER.warn("Illegal Entity Teleport {} to {}:{}", this, teleportTransition.newLevel(), teleportTransition.position(), new Throwable());
15102- @@ -4106,6 +4917 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15111+ @@ -4106,6 +4926 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1510315112 }
1510415113 }
1510515114
@@ -15112,7 +15121,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1511215121 protected void removeAfterChangingDimensions() {
1511315122 this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
1511415123 if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed
15115- @@ -4436,6 +5253 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15124+ @@ -4436,6 +5262 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1511615125 }
1511715126
1511815127 public void startSeenByPlayer(ServerPlayer serverPlayer) {
@@ -15125,7 +15134,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1512515134 }
1512615135
1512715136 public void stopSeenByPlayer(ServerPlayer serverPlayer) {
15128- @@ -4445,6 +5268 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15137+ @@ -4445,6 +5277 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1512915138 new io.papermc.paper.event.player.PlayerUntrackEntityEvent(serverPlayer.getBukkitEntity(), this.getBukkitEntity()).callEvent();
1513015139 }
1513115140 // Paper end - entity tracking events
@@ -15138,7 +15147,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1513815147 }
1513915148
1514015149 public float rotate(Rotation transformRotation) {
15141- @@ -4977,7 +5806 ,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15150+ @@ -4977,7 +5815 ,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1514215151 return;
1514315152 }
1514415153 // Paper end - Block invalid positions and bounding box
@@ -15148,7 +15157,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1514815157 synchronized (this.posLock) { // Paper - detailed watchdog information
1514915158 this.position = new Vec3(x, y, z);
1515015159 } // Paper - detailed watchdog information
15151- @@ -5010,7 +5840 ,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15160+ @@ -5010,7 +5849 ,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1515215161 }
1515315162 // Paper start - Block invalid positions and bounding box; don't allow desync of pos and AABB
1515415163 // hanging has its own special logic
@@ -15157,7 +15166,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1515715166 this.setBoundingBox(this.makeBoundingBox());
1515815167 }
1515915168 // Paper end - Block invalid positions and bounding box
15160- @@ -5117,6 +5947 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15169+ @@ -5117,6 +5956 ,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1516115170 return this.removalReason != null;
1516215171 }
1516315172
@@ -15170,7 +15179,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1517015179 @Nullable
1517115180 public Entity.RemovalReason getRemovalReason() {
1517215181 return this.removalReason;
15173- @@ -5132,6 +5968 ,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15182+ @@ -5132,6 +5977 ,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1517415183 // Paper end - rewrite chunk system
1517515184 org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit
1517615185 final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
@@ -15180,7 +15189,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1518015189 if (this.removalReason == null) {
1518115190 this.removalReason = removalReason;
1518215191 }
15183- @@ -5155,6 +5994 ,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15192+ @@ -5155,6 +6003 ,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1518415193 this.removalReason = null;
1518515194 }
1518615195
@@ -15191,7 +15200,7 @@ index 9a102b2c58446bd0aac5bd7f00e647f0270e7983..8a17bb73522bf16a35b3b15f318d2de9
1519115200 // Paper start - Folia schedulers
1519215201 /**
1519315202 * Invoked only when the entity is truly removed from the server, never to be added to any world.
15194- @@ -5166,7 +6009 ,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
15203+ @@ -5166,7 +6018 ,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
1519515204 // Paper end - Folia schedulers
1519615205 // Paper start - optimise Folia entity scheduler
1519715206 public final void registerScheduler() {
0 commit comments