3
0
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:
creeper123123321 2019-04-24 15:35:21 -03:00
Ursprung e297d825e3
Commit 0380d80138
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
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);
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() {

Datei anzeigen

@ -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) {