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@691d452 Fix bundled spark permission check (#11355) PaperMC/Paper@012c527 Update Velocity natives (#11347) PaperMC/Paper@953e6e9 Fire BlockExpEvent on grindstone use (#11346) PaperMC/Paper@10f5879 Change condition check order of entity tracking Y (#11348) PaperMC/Paper@805a974 Improve console completion with brig suggestions (#9251) PaperMC/Paper@e0021b1 Fix allowSpiderWorldBorderClimbing world config (#11321) PaperMC/Paper@3db4758 Check dead flag in isAlive() (#11330) PaperMC/Paper@21f125f Revert velocity natives to 3.1.2 (#11368) PaperMC/Paper@0e82527 Fix NPE while trying to respawn an already disconnected player (#11353) PaperMC/Paper@5d91bef Fix shulkerbox loot table replenish (#11366) PaperMC/Paper@a8e6a93 Deprecate for removal all OldEnum-related methods (#11371) PaperMC/Paper@925c3b9 Add FeatureFlag API (#8952) PaperMC/Paper@426f992 Enchantment is data-driven, so not FeatureDependant (#11377) PaperMC/Paper@1ba1be7 Update Velocity natives again PaperMC/Paper@7632de5 Tag Lifecycle Events (#10993) PaperMC/Paper@b09eaf2 Add Item serialization as json api (#11235) PaperMC/Paper@971a7a5 Add Decorated Pot Cracked API (#11365) PaperMC/Paper@61fe23c deprecate isEnabledByFeature in Item/BlockType PaperMC/Paper@e945cfe Fix PaperServerListPingEvent#getPlayerSample not being populated or used (#11387) PaperMC/Paper@4ff58c4 Update spark PaperMC/Paper@d1a72ea Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11405) PaperMC/Paper@0a53f1d Set default drop behavior for player deaths (#11380) PaperMC/Paper@951e7dd Fix TrialSpawner forgetting assigned mob when placed by player (#11381) PaperMC/Paper@13a2395 Fix enable-player-collisions playing sounds when set to false (#11390) PaperMC/Paper@1348e44 Prevent NPE when serializing unresolved profile (#11407) PaperMC/Paper@2aaf436 Validate slot in PlayerInventory#setSlot (#11399) PaperMC/Paper@5c82955 Only mark decorations dirty if a removal actually occurs (#11413) PaperMC/Paper@c5a1066 Remove wall-time / unused skip tick protection (#11412)
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 e80e1d7ac52ef6f81dab85916f8107bc3e9339c6..47e1bec18c9bed6028b63ed6a1bcc66bcd4df238 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -928,7 +928,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();
|
|
}
|
|
|
|
@@ -1205,12 +1209,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
return true;
|
|
}
|
|
// Sakura end - visibility api and command
|
|
+ // 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) {
|