Skip to content

Commit

Permalink
fix: bypass staging when adding player
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Oct 28, 2024
1 parent 4f57352 commit bee4c78
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ public static void init() {
private final ObjectLinkedOpenHashSet<StagedTracker> stagingTrackers = new ObjectLinkedOpenHashSet<>();

private void addEntityTrackerAreaMap(ServerChunkLoadingManager.EntityTracker tracker) {
if (((IThreadedAnvilChunkStorageEntityTracker) tracker).getEntity() instanceof ServerPlayerEntity player) {
this.addPlayer(player);
}

// update is done lazily on next tickEntityMovement
final ChunkPos pos = getEntityChunkPos(((IThreadedAnvilChunkStorageEntityTracker) tracker).getEntity());
this.areaMap.add(
Expand All @@ -88,6 +84,9 @@ private void addEntityTrackerAreaMap(ServerChunkLoadingManager.EntityTracker tra
}

public void addEntityTracker(ServerChunkLoadingManager.EntityTracker tracker) {
if (((IThreadedAnvilChunkStorageEntityTracker) tracker).getEntity() instanceof ServerPlayerEntity player) {
this.addPlayer(player);
}
if (Config.OPTIMIZED_ENTITY_TRACKING_USE_STAGING_AREA) {
stagingTrackers.addAndMoveToLast(new StagedTracker(tracker, ticks.get()));
for (ServerPlayerEntity player : this.playerTrackers.keySet()) {
Expand Down Expand Up @@ -202,7 +201,7 @@ private void tickStaging(ServerChunkLoadingManager.TicketManager ticketManager)
StagedTracker stagingTracker = iterator.next();
if (currentTicks - stagingTracker.tickAdded() >= STAGING_TRACKER_LIFETIME) {
iterator.remove();
// System.out.println(String.format("Migrating staging tracker %s", ((IThreadedAnvilChunkStorageEntityTracker) stagingTracker.tracker()).getEntity()));
// System.out.println(String.format("Migrating staging tracker %s", ((IThreadedAnvilChunkStorageEntityTracker) stagingTracker.tracker()).getEntity().getUuidAsString()));
addEntityTrackerAreaMap(stagingTracker.tracker());
} else {
break;
Expand Down

0 comments on commit bee4c78

Please sign in to comment.