Clarify server player's watching position (#2199)

* Clarify server player's watching position

Fixes #2178

Signed-off-by: liach <liach@users.noreply.github.com>

* Update poor names

Signed-off-by: liach <liach@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: YanisBft <doublecraft.official@gmail.com>

Co-authored-by: liach <liach@users.noreply.github.com>
Co-authored-by: YanisBft <doublecraft.official@gmail.com>
This commit is contained in:
liach 2021-03-31 04:40:35 +07:00 committed by GitHub
parent de339b3ad3
commit f2b3e55464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 13 deletions

View File

@ -24,7 +24,13 @@ CLASS net/minecraft/class_3222 net/minecraft/server/network/ServerPlayerEntity
FIELD field_13987 networkHandler Lnet/minecraft/class_3244;
FIELD field_13988 removedEntities Lit/unimi/dsi/fastutil/ints/IntList;
FIELD field_13989 notInAnyWorld Z
FIELD field_13990 cameraPosition Lnet/minecraft/class_4076;
FIELD field_13990 watchedSection Lnet/minecraft/class_4076;
COMMENT A chunk section position indicating where the player's client is currently
COMMENT watching chunks from. Used referentially for the game to update the chunks
COMMENT watched by this player.
COMMENT
COMMENT @see #getWatchedSection()
COMMENT @see #setWatchedSection(ChunkSectionPos)
FIELD field_13992 levitationStartPos Lnet/minecraft/class_243;
FIELD field_13993 clientChatVisibility Lnet/minecraft/class_1659;
FIELD field_13994 enteredNetherPos Lnet/minecraft/class_243;
@ -86,7 +92,15 @@ CLASS net/minecraft/class_3222 net/minecraft/server/network/ServerPlayerEntity
METHOD method_14228 setExperiencePoints (I)V
METHOD method_14230 isPvpEnabled ()Z
METHOD method_14231 onDisconnect ()V
METHOD method_14232 getCameraPosition ()Lnet/minecraft/class_4076;
METHOD method_14232 getWatchedSection ()Lnet/minecraft/class_4076;
COMMENT Returns the chunk section position the player's client is currently watching
COMMENT from. This may differ from the chunk section the player is currently in.
COMMENT
COMMENT <p>This is only for chunk loading (watching) purpose. This is updated together
COMMENT with entity tracking, but they are separate mechanisms.
COMMENT
COMMENT @see #watchedSection
COMMENT @see #setWatchedSection(ChunkSectionPos)
METHOD method_14234 updateLastActionTime ()V
METHOD method_14235 onSpawn (Lnet/minecraft/class_1703;)V
METHOD method_14236 getAdvancementTracker ()Lnet/minecraft/class_2985;
@ -125,8 +139,14 @@ CLASS net/minecraft/class_3222 net/minecraft/server/network/ServerPlayerEntity
ARG 1 url
ARG 2 hash
ARG 3 required
METHOD method_17668 setCameraPosition (Lnet/minecraft/class_4076;)V
ARG 1 cameraPosition
METHOD method_17668 setWatchedSection (Lnet/minecraft/class_4076;)V
COMMENT Sets the chunk section position the player's client is currently watching
COMMENT from. This is usually called when the player moves to a new chunk section.
COMMENT
COMMENT @see #watchedSection
COMMENT @see #getWatchedSection()
ARG 1 section
COMMENT the updated section position
METHOD method_18783 worldChanged (Lnet/minecraft/class_3218;)V
ARG 1 origin
METHOD method_26280 getSpawnPointPosition ()Lnet/minecraft/class_2338;

View File

@ -27,7 +27,12 @@ CLASS net/minecraft/class_3215 net/minecraft/server/world/ServerChunkManager
METHOD method_12127 tick (Ljava/util/function/BooleanSupplier;)V
ARG 1 shouldKeepTicking
METHOD method_12129 getChunkGenerator ()Lnet/minecraft/class_2794;
METHOD method_14096 updateCameraPosition (Lnet/minecraft/class_3222;)V
METHOD method_14096 updatePosition (Lnet/minecraft/class_3222;)V
COMMENT Updates the chunk section position of the {@code player}. This can either be a
COMMENT result of the player's movement or its camera entity's movement.
COMMENT
COMMENT <p>This updates the section position player's client is currently watching and
COMMENT the player's position in its entity tracker.
ARG 1 player
METHOD method_14128 markForUpdate (Lnet/minecraft/class_2338;)V
ARG 1 pos

View File

@ -91,7 +91,11 @@ CLASS net/minecraft/class_3898 net/minecraft/server/world/ThreadedAnvilChunkStor
METHOD method_18704 getSquaredDistance (Lnet/minecraft/class_1923;Lnet/minecraft/class_1297;)D
ARG 0 pos
ARG 1 entity
METHOD method_18713 updateCameraPosition (Lnet/minecraft/class_3222;)V
METHOD method_18713 updatePosition (Lnet/minecraft/class_3222;)V
COMMENT Updates the chunk section position of the {@code player}. This updates the player
COMMENT position for both entity tracking and chunk loading (watching) logic.
COMMENT
COMMENT @see ServerChunkManager#updatePosition(ServerPlayerEntity)
ARG 1 player
METHOD method_18714 handlePlayerAddedOrRemoved (Lnet/minecraft/class_3222;Z)V
ARG 1 player
@ -107,11 +111,17 @@ CLASS net/minecraft/class_3898 net/minecraft/server/world/ThreadedAnvilChunkStor
METHOD method_18719 getChebyshevDistance (Lnet/minecraft/class_1923;Lnet/minecraft/class_3222;Z)I
ARG 0 pos
ARG 1 player
ARG 2 useCameraPosition
ARG 2 useWatchedPosition
METHOD method_18722 doesNotGenerateChunks (Lnet/minecraft/class_3222;)Z
ARG 1 player
METHOD method_18724 isTooFarFromPlayersToSpawnMobs (Lnet/minecraft/class_1923;)Z
METHOD method_18727 tickPlayerMovement ()V
METHOD method_18727 tickEntityMovement ()V
COMMENT Ticks and updates the tracked status of each tracker.
COMMENT
COMMENT <p>This first checks if entities have changed chunk sections, and updates
COMMENT tracking status of those entities to all players. It then checks if any player
COMMENT has changed chunk sections, and updates all entities tracking status to those
COMMENT players. This ensures all possible updates are accounted for.
METHOD method_19488 getPointOfInterestStorage ()Lnet/minecraft/class_4153;
METHOD method_20441 releaseLightTicket (Lnet/minecraft/class_1923;)V
ARG 1 pos
@ -125,22 +135,40 @@ CLASS net/minecraft/class_3898 net/minecraft/server/world/ThreadedAnvilChunkStor
ARG 2 requiredStatus
METHOD method_20619 loadChunk (Lnet/minecraft/class_1923;)Ljava/util/concurrent/CompletableFuture;
ARG 1 pos
METHOD method_20726 updateWatchedSection (Lnet/minecraft/class_3222;)Lnet/minecraft/class_4076;
COMMENT Updates the watched chunk section position for the {@code player}, and sends a
COMMENT render distance update packet to the client.
ARG 1 player
METHOD method_21619 dump (Ljava/io/Writer;)V
METHOD method_21676 getFutureStatus (Ljava/util/concurrent/CompletableFuture;)Ljava/lang/String;
METHOD method_23272 getChunkLoadingDebugInfo (Lnet/minecraft/class_1923;)Ljava/lang/String;
CLASS class_3208 EntityTracker
COMMENT An entity tracker governs which players' clients can see an entity. Each
COMMENT tracker corresponds to one entity in a server world and is mapped from the
COMMENT entity's network ID.
COMMENT
COMMENT @see ThreadedAnvilChunkStorage#entityTrackers
FIELD field_18246 entry Lnet/minecraft/class_3231;
FIELD field_18247 entity Lnet/minecraft/class_1297;
FIELD field_18248 maxDistance I
FIELD field_18249 lastCameraPosition Lnet/minecraft/class_4076;
FIELD field_18249 trackedSection Lnet/minecraft/class_4076;
COMMENT The chunk section position of the tracked entity, may be outdated as an entity
COMMENT ticks. This is used by {@link ThreadedAnvilChunkStorage#tickEntityMovement()
COMMENT tickEntityMovement()} to bypass unnecessary status updates before calling
COMMENT {@link #updateTrackedStatus(ServerPlayerEntity) updateTrackedStatus()}.
FIELD field_18250 listeners Ljava/util/Set;
METHOD <init> (Lnet/minecraft/class_3898;Lnet/minecraft/class_1297;IIZ)V
ARG 2 maxDistance
ARG 3 tickInterval
ARG 2 entity
ARG 3 maxDistance
ARG 4 tickInterval
ARG 5 alwaysUpdateVelocity
METHOD equals (Ljava/lang/Object;)Z
ARG 1 o
METHOD method_18728 stopTracking ()V
METHOD method_18729 updateCameraPosition (Ljava/util/List;)V
METHOD method_18729 updateTrackedStatus (Ljava/util/List;)V
COMMENT Updates the tracked status of this tracker's entity for the given players.
COMMENT
COMMENT @see updateTrackedStatus(ServerPlayerEntity)
ARG 1 players
METHOD method_18730 sendToOtherNearbyPlayers (Lnet/minecraft/class_2596;)V
ARG 1 packet
@ -148,7 +176,13 @@ CLASS net/minecraft/class_3898 net/minecraft/server/world/ThreadedAnvilChunkStor
ARG 1 player
METHOD method_18734 sendToNearbyPlayers (Lnet/minecraft/class_2596;)V
ARG 1 packet
METHOD method_18736 updateCameraPosition (Lnet/minecraft/class_3222;)V
METHOD method_18736 updateTrackedStatus (Lnet/minecraft/class_3222;)V
COMMENT Updates the tracked status of this tracker's entity for the {@code player}.
COMMENT
COMMENT <p>If this tracker should be listened by the player, the player's tracking
COMMENT listener is added if it is not in the listeners; if this tracker should not be
COMMENT listened by the player, the player's tracking listener is removed if it is in
COMMENT the listeners.
ARG 1 player
METHOD method_22844 getMaxTrackDistance ()I
METHOD method_27906 adjustTrackingDistance (I)I