3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Actually fix lay for PosePlugin

Dieser Commit ist enthalten in:
David Choo 2020-11-07 19:44:55 -05:00
Ursprung 18e5764b54
Commit 3f21261162
3 geänderte Dateien mit 22 neuen und 6 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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(),