Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Force resend center chunk on respawn
Dieser Commit ist enthalten in:
Ursprung
e297d825e3
Commit
0380d80138
@ -209,7 +209,9 @@ public class WorldPackets {
|
||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
int diffX = Math.abs(entityTracker.getChunkCenterX() - chunk.getX());
|
||||
int diffZ = Math.abs(entityTracker.getChunkCenterZ() - chunk.getZ());
|
||||
if (diffX >= SERVERSIDE_VIEW_DISTANCE || diffZ >= SERVERSIDE_VIEW_DISTANCE) {
|
||||
if (entityTracker.isForceSendCenterChunk()
|
||||
|| diffX >= SERVERSIDE_VIEW_DISTANCE
|
||||
|| diffZ >= SERVERSIDE_VIEW_DISTANCE) {
|
||||
PacketWrapper fakePosLook = wrapper.create(0x40); // Set center chunk
|
||||
fakePosLook.write(Type.VAR_INT, chunk.getX());
|
||||
fakePosLook.write(Type.VAR_INT, chunk.getZ());
|
||||
@ -350,8 +352,8 @@ public class WorldPackets {
|
||||
int dimensionId = wrapper.get(Type.INT, 0);
|
||||
clientWorld.setEnvironment(dimensionId);
|
||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
entityTracker.setChunkCenterX(0);
|
||||
entityTracker.setChunkCenterZ(0);
|
||||
// The client may reset the center chunk if dimension is changed
|
||||
entityTracker.setForceSendCenterChunk(true);
|
||||
}
|
||||
});
|
||||
handler(new PacketHandler() {
|
||||
|
@ -9,7 +9,6 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class EntityTracker extends StoredObject implements ExternalJoinGameListener {
|
||||
@ -20,6 +19,9 @@ public class EntityTracker extends StoredObject implements ExternalJoinGameListe
|
||||
private int latestTradeWindowId;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean forceSendCenterChunk = true;
|
||||
@Getter
|
||||
@Setter
|
||||
private int chunkCenterX, chunkCenterZ;
|
||||
|
||||
public EntityTracker(UserConnection user) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren