mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Don't sync player list state within entity cache
This commit is contained in:
parent
31013abc42
commit
a87ee9368b
2 changed files with 8 additions and 7 deletions
|
|
@ -32,7 +32,6 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
|
|
||||||
import org.geysermc.geyser.entity.type.Entity;
|
import org.geysermc.geyser.entity.type.Entity;
|
||||||
import org.geysermc.geyser.entity.type.Tickable;
|
import org.geysermc.geyser.entity.type.Tickable;
|
||||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||||
|
|
@ -143,12 +142,6 @@ public class EntityCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAllPlayerEntities() {
|
public void removeAllPlayerEntities() {
|
||||||
PlayerListPacket playerListPacket = new PlayerListPacket();
|
|
||||||
playerListPacket.setAction(PlayerListPacket.Action.REMOVE);
|
|
||||||
for (PlayerEntity otherEntity : playerEntities.values()) {
|
|
||||||
playerListPacket.getEntries().add(new PlayerListPacket.Entry(otherEntity.getTabListUuid()));
|
|
||||||
}
|
|
||||||
session.sendUpstreamPacket(playerListPacket);
|
|
||||||
playerEntities.clear();
|
playerEntities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.translator.protocol.java;
|
package org.geysermc.geyser.translator.protocol.java;
|
||||||
|
|
||||||
|
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
|
||||||
|
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
|
|
@ -36,6 +38,12 @@ public class JavaFinishConfigurationPacketTranslator extends PacketTranslator<Cl
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundFinishConfigurationPacket packet) {
|
public void translate(GeyserSession session, ClientboundFinishConfigurationPacket packet) {
|
||||||
// Clear the player list, as on Java the player list is cleared after transitioning from config to play phase
|
// Clear the player list, as on Java the player list is cleared after transitioning from config to play phase
|
||||||
|
PlayerListPacket playerListPacket = new PlayerListPacket();
|
||||||
|
playerListPacket.setAction(PlayerListPacket.Action.REMOVE);
|
||||||
|
for (PlayerEntity otherEntity : session.getEntityCache().getAllPlayerEntities()) {
|
||||||
|
playerListPacket.getEntries().add(new PlayerListPacket.Entry(otherEntity.getTabListUuid()));
|
||||||
|
}
|
||||||
|
session.sendUpstreamPacket(playerListPacket);
|
||||||
session.getEntityCache().removeAllPlayerEntities();
|
session.getEntityCache().removeAllPlayerEntities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue