3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Merge pull request #1284 from creeper123123321/master

Force resend center chunk on respawn
Dieser Commit ist enthalten in:
Myles 2019-04-24 19:49:18 +01:00 committet von GitHub
Commit 2bd266cd69
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -209,7 +209,9 @@ public class WorldPackets {
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class); EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
int diffX = Math.abs(entityTracker.getChunkCenterX() - chunk.getX()); int diffX = Math.abs(entityTracker.getChunkCenterX() - chunk.getX());
int diffZ = Math.abs(entityTracker.getChunkCenterZ() - chunk.getZ()); 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 PacketWrapper fakePosLook = wrapper.create(0x40); // Set center chunk
fakePosLook.write(Type.VAR_INT, chunk.getX()); fakePosLook.write(Type.VAR_INT, chunk.getX());
fakePosLook.write(Type.VAR_INT, chunk.getZ()); fakePosLook.write(Type.VAR_INT, chunk.getZ());
@ -350,8 +352,8 @@ public class WorldPackets {
int dimensionId = wrapper.get(Type.INT, 0); int dimensionId = wrapper.get(Type.INT, 0);
clientWorld.setEnvironment(dimensionId); clientWorld.setEnvironment(dimensionId);
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class); EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
entityTracker.setChunkCenterX(0); // The client may reset the center chunk if dimension is changed
entityTracker.setChunkCenterZ(0); entityTracker.setForceSendCenterChunk(true);
} }
}); });
handler(new PacketHandler() { handler(new PacketHandler() {

Datei anzeigen

@ -9,7 +9,6 @@ import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_14Types; import us.myles.ViaVersion.api.entities.Entity1_14Types;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class EntityTracker extends StoredObject implements ExternalJoinGameListener { public class EntityTracker extends StoredObject implements ExternalJoinGameListener {
@ -20,6 +19,9 @@ public class EntityTracker extends StoredObject implements ExternalJoinGameListe
private int latestTradeWindowId; private int latestTradeWindowId;
@Getter @Getter
@Setter @Setter
private boolean forceSendCenterChunk = true;
@Getter
@Setter
private int chunkCenterX, chunkCenterZ; private int chunkCenterX, chunkCenterZ;
public EntityTracker(UserConnection user) { public EntityTracker(UserConnection user) {