Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Merge pull request #1284 from creeper123123321/master
Force resend center chunk on respawn
Dieser Commit ist enthalten in:
Commit
2bd266cd69
@ -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() {
|
||||||
|
@ -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) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren