mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-22 16:29:16 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@9aea240 Properly lookup plugin classes when looked up by spark PaperMC/Paper@7e91a2c Update the bundled spark version PaperMC/Paper@3a47518 Deprecate more Timings things for removal (#11126) PaperMC/Paper@aa36ae6 Fix EntityUnleashEvent cancellation on distance cause (#11131) PaperMC/Paper@73a863b Fix horse inventories indices (#11139) PaperMC/Paper@5512af7 [ci skip] remove timings from issue templates (#11127) PaperMC/Paper@5a5035b Fix a couple of ItemMeta related NPEs (#11149) PaperMC/Paper@e1462a9 Bump MCUtils#asyncExecutor core size PaperMC/Paper@645a677 Make max interaction range configurable (#11164) PaperMC/Paper@66165f7 Fix PickupStatus getting reset (#11154) PaperMC/Paper@dcbd99d Fix Owen's typos (#11179) PaperMC/Paper@f82bea6 Add argument for FinePosition to brig API (#11094) PaperMC/Paper@694b120 Remove Entity tracker field PaperMC/Paper@f774787 Copy missed changes to chunk system from Folia PaperMC/Paper@50bdfc3 Null check tracker in Entity#resendPossiblyDesyncedEntityData PaperMC/Paper@3234b20 Do not allow chunk unloading outside of the regular tick loop PaperMC/Paper@0246a9d Add mob bucket items to item id to entity map in DataConverter PaperMC/Paper@438863c Shutdown L4J cordially if the server stops before it's even started (#11172) PaperMC/Paper@100d75a Don't entirely die just because a plugin jar was bad PaperMC/Paper@227544c Move TickThread changes from Moonrise patch to MCUtils PaperMC/Paper@67d414a Allow plugin aliases to override vanilla commands (#11186) PaperMC/Paper@58c7ea3 Preserve command node when re-registering modern commands through old API (#11184) PaperMC/Paper@0a1be9a Make loadChunksForMoveAsync use new chunk system load calls PaperMC/Paper@df3b654 ConcurrentUtil: Fix concurrent long map resize chain pull function PaperMC/Paper@5a5c3a4 Remove chunk unload trace debug PaperMC/Paper@7e44684 Fix wrong assumption about locale being null in the login phase (#11204) PaperMC/Paper@042f15f [ci skip] chore: fix incorrect commit hash in PR builds (#11198) PaperMC/Paper@4e6a2a1 Check for block type in SculkSensorBlock#canActivate
54 lines
2.7 KiB
Diff
54 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
|
Date: Thu, 30 Nov 2023 15:54:49 +0000
|
|
Subject: [PATCH] Reduce entity tracker player updates
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index b2c99286e89f7f04aaa6efed245d344f15aa35fb..925809750c80a74d80255f6b611c486915530b34 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -927,7 +927,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
if (tracker == null) {
|
|
continue;
|
|
}
|
|
+ // Sakura start - reduce entity tracker player updates
|
|
+ if (tracker.shouldUpdatePlayers()) {
|
|
((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerTrackedEntity)tracker).moonrise$tick(nearbyPlayers.getChunk(entity.chunkPosition()));
|
|
+ }
|
|
+ // Sakura end - reduce entity tracker player updates
|
|
tracker.serverEntity.sendChanges();
|
|
}
|
|
|
|
@@ -1179,12 +1183,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
}
|
|
// Paper end - optimise entity tracker
|
|
+ // Sakura start - reduce entity tracker player updates
|
|
+ private final int playerUpdateInterval;
|
|
+ private Vec3 entityPosition;
|
|
+
|
|
+ public final boolean shouldUpdatePlayers() {
|
|
+ // We have to always update players otherwise they can turn invisible on teleports (why?)
|
|
+ if (this.entity instanceof net.minecraft.world.entity.player.Player || this.entity.tickCount % this.playerUpdateInterval == 0) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ Vec3 lastPosition = this.entityPosition;
|
|
+ this.entityPosition = this.entity.position();
|
|
+
|
|
+ return this.entity.position().distanceToSqr(lastPosition) >= (double) this.range / 2.0;
|
|
+ }
|
|
+ // Sakura start - reduce entity tracker player updates
|
|
|
|
public TrackedEntity(final Entity entity, final int i, final int j, final boolean flag) {
|
|
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
|
|
this.entity = entity;
|
|
this.range = i;
|
|
this.lastSectionPos = SectionPos.of((EntityAccess) entity);
|
|
+ this.playerUpdateInterval = Math.min(j, 20); // Sakura - reduce entity tracker player updates
|
|
+ this.entityPosition = entity.position(); // Sakura - reduce entity tracker player updates
|
|
}
|
|
|
|
public boolean equals(Object object) {
|