Skip to content

Commit 9a73325

Browse files
committed
fix: fix simulateLookAt #278
1 parent 17eb3a1 commit 9a73325

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lse/api/helper/SimulatedPlayerHelper.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#include "SimulatedPlayerHelper.h"
22

3-
#include "mc/deps/ecs/gamerefs_entity/EntityContext.h"
43
#include "mc/entity/components_json_legacy/NavigationComponent.h"
54
#include "mc/server/sim/LookAtIntent.h"
65
#include "mc/server/sim/MoveInDirectionIntent.h"
76
#include "mc/server/sim/MoveToPositionIntent.h"
8-
#include "mc/server/sim/MovementIntent.h"
97
#include "mc/server/sim/NavigateToEntityIntent.h"
108
#include "mc/server/sim/NavigateToPositionsIntent.h"
11-
#include "mc/server/sim/VoidMoveIntent.h"
129
#include "mc/server/sim/sim.h"
1310
#include "mc/world/actor/ai/navigation/PathNavigation.h"
1411
#include "mc/world/actor/provider/MobMovement.h"
@@ -33,7 +30,8 @@ bool SimulatedPlayerHelper::simulateRespawn(SimulatedPlayer& player) {
3330
}
3431

3532
void SimulatedPlayerHelper::simulateLookAt(SimulatedPlayer& player, Actor& actor, sim::LookDuration lookType) {
36-
sim::lookAt(player, actor.getEntityContext(), lookType);
33+
auto intent = sim::lookAt(player, actor.getEntityContext(), lookType);
34+
memcpy((void*)&player.mLookAtIntent, &intent, sizeof(sim::LookAtIntent));
3735
}
3836

3937
void SimulatedPlayerHelper::simulateLookAt(
@@ -42,15 +40,17 @@ void SimulatedPlayerHelper::simulateLookAt(
4240
sim::LookDuration lookType
4341
) {
4442
glm::vec3 vec3;
45-
vec3.x = (float)blockPos.x + 0.5f;
46-
vec3.y = (float)blockPos.y + 0.5f;
47-
vec3.z = (float)blockPos.z + 0.5f;
48-
sim::lookAt(player, vec3, lookType);
43+
vec3.x = (float)blockPos.x + 0.5f;
44+
vec3.y = (float)blockPos.y + 0.5f;
45+
vec3.z = (float)blockPos.z + 0.5f;
46+
auto intent = sim::lookAt(player, vec3, lookType);
47+
memcpy((void*)&player.mLookAtIntent, &intent, sizeof(sim::LookAtIntent));
4948
}
5049

5150
void SimulatedPlayerHelper::simulateLookAt(SimulatedPlayer& player, Vec3 const& pos, sim::LookDuration lookType) {
5251
glm::vec3 vec3(pos.x, pos.y, pos.z);
53-
sim::lookAt(player, vec3, lookType);
52+
auto intent = sim::lookAt(player, vec3, lookType);
53+
memcpy((void*)&player.mLookAtIntent, &intent, sizeof(sim::LookAtIntent));
5454
}
5555

5656
bool SimulatedPlayerHelper::simulateUseItem(SimulatedPlayer& player, ItemStack& item) {

0 commit comments

Comments
 (0)