Npcs
Namespace Mc.Scripting · Kind class (sealed)
public sealed class NpcsCreates NPCs for this plugin and listens to the clicks on them. Everything made here is removed when the plugin unloads.
Methods
Section titled “Methods”| Member | Description |
|---|---|
Create |
Creates an NPC that everybody sees. |
Subscription OnInteract(Action<NpcInteraction> handler) |
Calls handler when a player clicks an NPC of this plugin’s server (any NPC: check NpcInteraction.Npc). |
Create
Section titled “Create”public Npc Create(World world, Vec3d position, string name, NpcSkin? skin = null, bool showInTab = false, float yaw = 0f, float pitch = 0f)Creates an NPC that everybody sees.
Parameters
| Name | Type | Description |
|---|---|---|
world |
World |
The world. |
position |
Vec3d |
Where it stands. |
name |
string |
The profile name (1..16 letters, digits or underscores). |
skin |
NpcSkin? = null |
The skin; null for the default one. |
showInTab |
bool = false |
Whether it is in the tab list (unlisted by default). |
yaw |
float = 0f |
The horizontal look, degrees. |
pitch |
float = 0f |
The vertical look, degrees. |
Returns Npc: The NPC.
Throws
System.ArgumentException: The name is not a valid profile name.System.InvalidOperationException: The engine refused the NPC (the world, or the server’s visual limit).
OnInteract
Section titled “OnInteract”public Subscription OnInteract(Action<NpcInteraction> handler)Calls handler when a player clicks an NPC of this plugin’s server (any NPC: check NpcInteraction.Npc).
Parameters
| Name | Type | Description |
|---|---|---|
handler |
Action<NpcInteraction> |
The handler. |
Returns Subscription: The subscription (removed when the plugin unloads).
See also
Section titled “See also”Npc · NpcInteraction · NpcSkin · Subscription · Vec3d · World