Skip to content

Commit

Permalink
Fix POV player spawning
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Jan 28, 2025
1 parent bce93f8 commit 06ea005
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions server/src/main/java/com/soulfiremc/server/plugins/POVServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,32 @@ private static void syncBotAndUser(BotConnection botConnection, Session clientSe
}

for (var entity : dataManager.entityTrackerState().getEntities()) {
if (entity instanceof ExperienceOrbEntity experienceOrbEntity) {
clientSession.send(
new ClientboundAddExperienceOrbPacket(
entity.entityId(),
entity.x(),
entity.y(),
entity.z(),
experienceOrbEntity.expValue()));
} else if (entity instanceof Entity rawEntity && rawEntity.entityId() != dataManager.localPlayer().entityId()) {
clientSession.send(
new ClientboundAddEntityPacket(
entity.entityId(),
entity.uuid(),
EntityType.from(entity.entityType().id()),
rawEntity.data(),
entity.x(),
entity.y(),
entity.z(),
entity.yRot(),
entity.headYRot(),
entity.xRot(),
entity.deltaMovement().getX(),
entity.deltaMovement().getY(),
entity.deltaMovement().getZ()));
}

if (entity instanceof Player player) {
clientSession.send(
new ClientboundEntityEventPacket(
Expand Down Expand Up @@ -519,30 +545,6 @@ private static void syncBotAndUser(BotConnection botConnection, Session clientSe
player.getHealth(),
player.getFoodData().getFoodLevel(),
player.getFoodData().getSaturationLevel()));
} else if (entity instanceof ExperienceOrbEntity experienceOrbEntity) {
clientSession.send(
new ClientboundAddExperienceOrbPacket(
entity.entityId(),
entity.x(),
entity.y(),
entity.z(),
experienceOrbEntity.expValue()));
} else if (entity instanceof Entity rawEntity) {
clientSession.send(
new ClientboundAddEntityPacket(
entity.entityId(),
entity.uuid(),
EntityType.from(entity.entityType().id()),
rawEntity.data(),
entity.x(),
entity.y(),
entity.z(),
entity.yRot(),
entity.headYRot(),
entity.xRot(),
entity.deltaMovement().getX(),
entity.deltaMovement().getY(),
entity.deltaMovement().getZ()));
}

for (var effect : entity.effectState().effects().entrySet()) {
Expand Down

0 comments on commit 06ea005

Please sign in to comment.