Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Actually fix lay for PosePlugin
Dieser Commit ist enthalten in:
Ursprung
18e5764b54
Commit
3f21261162
@ -77,12 +77,19 @@ public class PlayerEntity extends LivingEntity {
|
|||||||
* Saves the parrot currently on the player's right shoulder; otherwise null
|
* Saves the parrot currently on the player's right shoulder; otherwise null
|
||||||
*/
|
*/
|
||||||
private ParrotEntity rightParrot;
|
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) {
|
public PlayerEntity(GameProfile gameProfile, long entityId, long geyserId, Vector3f position, Vector3f motion, Vector3f rotation) {
|
||||||
super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation);
|
super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation);
|
||||||
|
|
||||||
profile = gameProfile;
|
profile = gameProfile;
|
||||||
uuid = gameProfile.getId();
|
uuid = gameProfile.getId();
|
||||||
|
spawningUUID = uuid;
|
||||||
username = gameProfile.getName();
|
username = gameProfile.getName();
|
||||||
effectCache = new EntityEffectCache();
|
effectCache = new EntityEffectCache();
|
||||||
if (geyserId == 1) valid = true;
|
if (geyserId == 1) valid = true;
|
||||||
@ -93,7 +100,7 @@ public class PlayerEntity extends LivingEntity {
|
|||||||
if (geyserId == 1) return;
|
if (geyserId == 1) return;
|
||||||
|
|
||||||
AddPlayerPacket addPlayerPacket = new AddPlayerPacket();
|
AddPlayerPacket addPlayerPacket = new AddPlayerPacket();
|
||||||
addPlayerPacket.setUuid(uuid);
|
addPlayerPacket.setUuid(spawningUUID);
|
||||||
addPlayerPacket.setUsername(username);
|
addPlayerPacket.setUsername(username);
|
||||||
addPlayerPacket.setRuntimeEntityId(geyserId);
|
addPlayerPacket.setRuntimeEntityId(geyserId);
|
||||||
addPlayerPacket.setUniqueEntityId(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.LanguageUtils;
|
||||||
import org.geysermc.connector.utils.SkinUtils;
|
import org.geysermc.connector.utils.SkinUtils;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Translator(packet = ServerSpawnPlayerPacket.class)
|
@Translator(packet = ServerSpawnPlayerPacket.class)
|
||||||
public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlayerPacket> {
|
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()));
|
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.entity.player.failed_list", packet.getUuid()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!entity.isValid() || entity.getEntityId() == -1) {
|
||||||
entity.setEntityId(packet.getEntityId());
|
// The player entity in the list isn't currently in use, so reuse it
|
||||||
entity.setPosition(position);
|
entity.setEntityId(packet.getEntityId());
|
||||||
entity.setRotation(rotation);
|
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);
|
session.getEntityCache().cacheEntity(entity);
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public class SkinUtils {
|
|||||||
if (session.getUpstream().isInitialized()) {
|
if (session.getUpstream().isInitialized()) {
|
||||||
PlayerListPacket.Entry updatedEntry = buildEntryManually(
|
PlayerListPacket.Entry updatedEntry = buildEntryManually(
|
||||||
session,
|
session,
|
||||||
entity.getUuid(),
|
entity.getSpawningUUID(), // Apply the skin to the uuid used to spawn the player
|
||||||
entity.getUsername(),
|
entity.getUsername(),
|
||||||
entity.getGeyserId(),
|
entity.getGeyserId(),
|
||||||
skin.getTextureUrl(),
|
skin.getTextureUrl(),
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren