mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Actually fix lay for PosePlugin
This commit is contained in:
parent
18e5764b54
commit
3f21261162
3 changed files with 22 additions and 6 deletions
|
@ -77,12 +77,19 @@ public class PlayerEntity extends LivingEntity {
|
|||
* Saves the parrot currently on the player's right shoulder; otherwise null
|
||||
*/
|
||||
private ParrotEntity rightParrot;
|
||||
/**
|
||||
* UUID to use instead when spawning the player
|
||||
* Bedrock expects uuids to be actually unique for each player entity
|
||||
* Spawning another player entity with the same uuid will replace the old entity
|
||||
*/
|
||||
private UUID spawningUUID;
|
||||
|
||||
public PlayerEntity(GameProfile gameProfile, long entityId, long geyserId, Vector3f position, Vector3f motion, Vector3f rotation) {
|
||||
super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation);
|
||||
|
||||
profile = gameProfile;
|
||||
uuid = gameProfile.getId();
|
||||
spawningUUID = uuid;
|
||||
username = gameProfile.getName();
|
||||
effectCache = new EntityEffectCache();
|
||||
if (geyserId == 1) valid = true;
|
||||
|
@ -93,7 +100,7 @@ public class PlayerEntity extends LivingEntity {
|
|||
if (geyserId == 1) return;
|
||||
|
||||
AddPlayerPacket addPlayerPacket = new AddPlayerPacket();
|
||||
addPlayerPacket.setUuid(uuid);
|
||||
addPlayerPacket.setUuid(spawningUUID);
|
||||
addPlayerPacket.setUsername(username);
|
||||
addPlayerPacket.setRuntimeEntityId(geyserId);
|
||||
addPlayerPacket.setUniqueEntityId(geyserId);
|
||||
|
|
|
@ -35,6 +35,8 @@ import org.geysermc.connector.network.translators.Translator;
|
|||
import org.geysermc.connector.utils.LanguageUtils;
|
||||
import org.geysermc.connector.utils.SkinUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Translator(packet = ServerSpawnPlayerPacket.class)
|
||||
public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlayerPacket> {
|
||||
|
||||
|
@ -53,10 +55,17 @@ public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlaye
|
|||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.entity.player.failed_list", packet.getUuid()));
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setEntityId(packet.getEntityId());
|
||||
entity.setPosition(position);
|
||||
entity.setRotation(rotation);
|
||||
if (!entity.isValid() || entity.getEntityId() == -1) {
|
||||
// The player entity in the list isn't currently in use, so reuse it
|
||||
entity.setEntityId(packet.getEntityId());
|
||||
entity.setPosition(position);
|
||||
entity.setRotation(rotation);
|
||||
} else {
|
||||
// Create a new duplicate of the player
|
||||
entity = new PlayerEntity(entity.getProfile(), packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), position, Vector3f.ZERO, rotation);
|
||||
entity.setPlayerList(false);
|
||||
entity.setSpawningUUID(UUID.randomUUID());
|
||||
}
|
||||
}
|
||||
session.getEntityCache().cacheEntity(entity);
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public class SkinUtils {
|
|||
if (session.getUpstream().isInitialized()) {
|
||||
PlayerListPacket.Entry updatedEntry = buildEntryManually(
|
||||
session,
|
||||
entity.getUuid(),
|
||||
entity.getSpawningUUID(), // Apply the skin to the uuid used to spawn the player
|
||||
entity.getUsername(),
|
||||
entity.getGeyserId(),
|
||||
skin.getTextureUrl(),
|
||||
|
|
Loading…
Reference in a new issue