Skip to content

Commit

Permalink
feat: add api method to rotate a npc
Browse files Browse the repository at this point in the history
  • Loading branch information
derklaro committed Aug 18, 2024
1 parent 7a245cd commit 688a40c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/src/main/java/com/github/juliarn/npclib/api/Npc.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public interface Npc<W, P, I, E> extends NpcFlaggedObject {

@NotNull Npc<W, P, I, E> stopTrackingPlayer(@NotNull P player);

@NotNull NpcSpecificOutboundPacket<W, P, I, E> rotate(float yaw, float pitch);

@NotNull NpcSpecificOutboundPacket<W, P, I, E> lookAt(@NotNull Position position);

@NotNull NpcSpecificOutboundPacket<W, P, I, E> playAnimation(@NotNull EntityAnimation animation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ public boolean tracksPlayer(@NotNull P player) {
return this;
}

@Override
public @NotNull NpcSpecificOutboundPacket<W, P, I, E> rotate(float yaw, float pitch) {
return this.platform.packetFactory().createRotationPacket(yaw, pitch).toSpecific(this);
}

@Override
public @NotNull NpcSpecificOutboundPacket<W, P, I, E> lookAt(@NotNull Position position) {
double diffX = position.x() - this.pos.x();
Expand Down

0 comments on commit 688a40c

Please sign in to comment.