mirror of
https://github.com/PaperMC/Folia.git
synced 2025-04-23 04:39:19 +08:00
Fix flickering with teleportAsync
Fixes flickering of entities without passengers when teleporting them with teleportAsync. We do not need to untrack/track the entity when there are no passengers, so we should not.
This commit is contained in:
parent
35d31075a6
commit
5cc35a8e23
@ -200,7 +200,7 @@
|
|||||||
if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
|
if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
|
||||||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||||
}
|
}
|
||||||
@@ -3726,8 +_,782 @@
|
@@ -3726,8 +_,789 @@
|
||||||
this.portalProcess = entity.portalProcess;
|
this.portalProcess = entity.portalProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,16 +589,22 @@
|
|||||||
+ ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(pos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(pos)
|
+ ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(pos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(pos)
|
||||||
+ )
|
+ )
|
||||||
+ ) {
|
+ ) {
|
||||||
|
+ boolean hasPassengers = !this.passengers.isEmpty();
|
||||||
+ EntityTreeNode passengerTree = this.detachPassengers();
|
+ EntityTreeNode passengerTree = this.detachPassengers();
|
||||||
|
+
|
||||||
|
+ if (hasPassengers) {
|
||||||
+ // Note: The client does not accept position updates for controlled entities. So, we must
|
+ // Note: The client does not accept position updates for controlled entities. So, we must
|
||||||
+ // perform a lot of tracker updates here to make it all work out.
|
+ // perform a lot of tracker updates here to make it all work out.
|
||||||
+
|
+
|
||||||
+ // first, clear the tracker
|
+ // first, clear the tracker
|
||||||
+ passengerTree.clearTracker();
|
+ passengerTree.clearTracker();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ for (EntityTreeNode entity : passengerTree.getFullTree()) {
|
+ for (EntityTreeNode entity : passengerTree.getFullTree()) {
|
||||||
+ entity.root.teleportSyncSameRegion(pos, yaw, pitch, velocity);
|
+ entity.root.teleportSyncSameRegion(pos, yaw, pitch, velocity);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (hasPassengers) {
|
||||||
+ passengerTree.restore();
|
+ passengerTree.restore();
|
||||||
+ // re-add to the tracker once the tree is restored
|
+ // re-add to the tracker once the tree is restored
|
||||||
+ passengerTree.addTracker();
|
+ passengerTree.addTracker();
|
||||||
@ -608,6 +614,7 @@
|
|||||||
+
|
+
|
||||||
+ // the tracker clear/add logic is only used in the same region, as the other logic
|
+ // the tracker clear/add logic is only used in the same region, as the other logic
|
||||||
+ // performs add/remove from world logic which will also perform add/remove tracker logic
|
+ // performs add/remove from world logic which will also perform add/remove tracker logic
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if (teleportComplete != null) {
|
+ if (teleportComplete != null) {
|
||||||
+ teleportComplete.accept(this);
|
+ teleportComplete.accept(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user