Home›Java›Mods›✅ [API] Player NPC ✅ [1.17 - 1.20.1]
✅ [API] Player NPC ✅  [1.17 - 1.20.1]
ModsJava

✅ [API] Player NPC ✅ [1.17 - 1.20.1]

Java mod listed for Minecraft 1.17–1.20. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
playernpc.png
asasd.png ​

PlayerNPC is a simple NPC API for Spigot, that allows you to create your own NPC per player.
This plugin was developed by SergiFerry
​

randomtpcommands.png

/npclib - Let you customize the NPCLib.
Permission: playernpc.command


/npcglobal - Let you customize the Global NPCs.
Permission: playernpc.command

/npcpersonal - Let you customize the Personal NPCs.

Permission: playernpc.command
​
npcsccommands.gif

randomtpapi.png

Spoiler: Plugins using PlayerNPC API
If you want to show your plugin here, contact me throught twitter @SergiFerry

All JavaDocs are available at:
https://sergiferry.github.io/PlayerNPC/

Put the PlayerNPC.jar on your server's /plugins and add the jar to the llibary of your Java Project.


Maven:​
Code (Text):
<repository>
    <id>ranull-repo-external</id>
    <url>https://repo.ranull.com/maven/external/</url>
</repository>

<dependency>
    <groupId>dev.sergiferry</groupId>
    <artifactId>playernpc</artifactId>
    <version>2023.4</version>
    <scope>provided</scope>
</dependency>

​
​
First of all, register your Plugin to the NPCLib
Code (Java):
NPCLib. getInstance ( ). registerPlugin (plugin ) ;
Step 1, generate the NPC instance
Code (Java):
NPC. Global npc = NPCLib. getInstance ( ). generateGlobalNPC (plugin, id, location ) ;
//or
NPC. Personal npc = NPCLib. getInstance ( ). generatePersonalNPC (player, plugin, id, location ) ;
Step 2, modify the NPC attributes
Code (Java):
npc. setSkin (texture, signature ) ; //Use https://mineskin.org/
npc. setItem (NPC. Slot, ItemStack ) ;
npc. setText ( String... ) ;
npc. setGlowing ( boolean, ChatColor ) ;
npc. setCollidable ( boolean ) ;
npc. setGazeTrackingType (NPC. GazeTrackingType ) ;
npc. setCustomTabListName ( String, boolean ) ;
npc. setHideDistance ( double ) ;
npc. setShowOnTabList ( boolean ) ;
npc. setInteractCooldown ( long ) ;
npc. setLineSpacing ( double ) ;
npc. setTextOpacity (NPC. Hologram. Opacity ) ;
npc. setTextAlignment ( Vector ) ;
npc. setPose (NPC. Pose ) ;

npc. addCustomClickAction (NPC. Interact. ClickType, CustomAction ) ;
Step 3, if you are using Personal NPCs, you need to create and show it to the player.
Code (Java):
npc. create ( ) ;
npc. show ( ) ;

You can listen for player interact with the NPC, but it's better to use ClickActions
Code (Java):
@EventHandler
public void onNPCInteract (NPC. Events. Interact event ) {
    Player player = event. getPlayer ( ) ;
    NPC npc = event. getNPC ( ) ;
    NPC. Interact. ClickType clickType = event. getClickType ( ) ;
}
You can hide it temporally or destroy it permanent.
Code (Java):
npc. hide ( ) ;
npc. destroy ( ) ;
You can change the NPC skin, even when if it's created and shown.
Code (Java):
npc. setSkin (NPC. Skin ) ;
npc. forceUpdate ( ) ;
You can change where the NPC looks at
Code (Java):
npc. lookAt (location ) ;
npc. update ( ) ;
You can change the NPC location
Code (Java):
npc. teleport (location ) ;
You can change the Text above the NPC
Code (Java):
npc. setText ( String... ) ;
npc. setLineOpacity ( Integer, NPC. Hologram. Opacity ) ;
npc. updateText ( ) ; //if the text have the same amount of lines
npc. forceUpdateText ( ) ; //if the text have different amount of lines
npc. setHideText ( boolean ) ; //you can also hide the text and then show it later
Remember that some changes at the NPC instance will not have effect on the player client until you update the npc.
Code (Java):
npc. update ( ) ;
npc. forceUpdate ( ) ;
​
​
randomtpstats.png
​
[​IMG]

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

✅ [API] Player NPC ✅ [1.17 - 1.20.1] is a free Minecraft Java mod. Compatible with Minecraft 1.17, 1.18, 1.19, 1.20. Downloaded 65,414 times (via Spigot). Download it and open it directly in the game.

Explore more