Link Search Menu Expand Document

Face Entity Mask

The face entity mask is used to lock the direction the player or NPC is facing to a specific entity.


Table of contents

Supported variables

Below is a breakdown of the different variables that the server defines:

  • The entity index of the entity we want to face. For NPCs you have to write their entity index, but for players you have to write their entity index plus 32,768.

Use Cases

The mask is primarily used to make the player face NPCs from the moment they initiate their walk towards them. Once the player reaches the NPC and interacts with it, the NPC will face the player back.

Client Code

Below is the refactored version of the client code behind the face direction mask.

All the buffer methods shown below can have different transformations applied on them, depending on the revision of the client. For the purposes of the demonstration, all transformations have been excluded.

faceEntityIndex = buffer.readUnsignedShort();
if (faceEntityIndex == 65535) {
	faceEntityIndex = -1;
}
entity.faceEntityIndex = faceEntityIndex;

Media

Below is a simple gif of a player and a NPC using the face entity mask, locking onto one another.

face entity example