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

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

Player NPC Lib via packets API for 1.17, 1.18, 1.19 & 1.20



✅ [API] PlayerNPC ✅ 2022.1 version
This is a BIG update to the API, please read carefully all the changes.

Before updating your plugin, check if all dependencies are updated with this version.


New features!
  • Introducing Text Opacity and Line Opacity, with this new feature you can modify the opacity of the text above NPC. Click to see an example. Line Opacity has more priority than Text Opacity, if Line Opacity is not setted, that line will have the Text Opacity. Notice that as a more Opacity, more entities will be send to the Player's client, so this may produce lag, and can produce lag to the Server also.
    • Added NPC.TextOpacity with (LOWEST, LOW, MEDIUM, HARD, HARDER, FULL)
    • Added npc.setTextOpacity(NPC.TextOpacity);
    • Added npc.getTextOpacity();
    • Added npc.resetTextOpacity();
    • Added npc.setLineOpacity(int, NPC.TextOpacity);
    • Added npc.getLineOpacity(int);
    • Added npc.resetLineOpacity(int);
    • Added /settextopacity (player) (id) (textopacity)
    • Added /setlineopacity (player) (id) (line) (lineopacity)
    • Any change will need npc.forceUpdateText();
  • Introducing Click Actions. This will allow you to set Click Actions for the NPC that are going to be called when a Player interacts with it. By cancelling NPCInteractEvent, this actions won't be executed.
    • Added npc.addRunPlayerCommandClickAction(NPCInteractEvent.ClickType, String);
    • Added npc.addRunConsoleCommandClickAction(NPCInteractEvent.ClickType, String);
    • Added npc.addMessageClickAction(NPCInteractEvent.ClickType, String);
    • Added npc.addCustomClickAction(NPCInteractEvent.ClickType, CustomClickAction);
    • Added npc.resetClickActions(); and npc.resetClickActions(NPCInteractEvent.ClickType);
  • Introducing NPCAttributes. This will allow you to create an abstract copy of some attributes of an NPC, and paste it on another NPC, even if it's not from the same Player. This is a great tool to create "global" NPC attributes. Also this tool allows you to set Default attributes for every NPC thats is created after setting this. Use NPCAttributes.setDefault.... or NPCAttributes.getDefault... or with an instance of an NPCAttributes (like npc.getNPCAttributes()), use npcAttributes.set... or npcAttributes.get... To apply changes, use npcAttributes.applyNPC(NPC); Variables that are supported by NPCAttributes:
    • NPCSkin
    • Text above NPC
    • NPC items
    • Collidable
    • Hide distance
    • Glowing
    • Glowing color
    • FollowLookType
    • Custom Tab List Name
    • Show on Tab List
    • Interact Cooldown
    • Line Spacing
    • Text Alignment
    • NPC Pose
  • Introducing Line Spacing. This will allow you to set the distance between the lines of the text above NPC. By default 0.27
    • Added npc.setLineSpacing(double);
    • Added npc.resetLineSpacing();
    • Added npc.getLineSpacing();
    • Added /npc setlinespacing (player) (id) (double/reset)
  • Introducing Text Alignment. This will allow you to adjust the NPC Hologram location, respect the NPC location throught a Vector. By default (0, 1.75, 0)
    • Added npc.setTextAlignment(Vector);
    • Added npc.resetTextAlignment();
    • Added npc.getTextAlignment();
    • Added /npc settextalignment (player) (id) (vector/reset)
  • Now you can set custom interact cooldown in milliseconds for each NPC. By default 200 milliseconds.
    • Added npc.setInteractCooldown(long);
    • Added npc.resetInteractCooldown();
    • Added npc.getInteractCooldown();
  • Added new methods to set items on NPC
    • Added npc.setHelmet(ItemStack);
    • Added npc.setChestplate(ItemStack);
    • Added npc.setLeggingsItemStack);
    • Added npc.setBoots(ItemStack);
    • Added npc.setItemInRightHand(ItemStack);
    • Added npc.setItemInLeftHand(ItemStack);
  • Now the /npc command is available throught Console
  • New NPC interact system, using PacketReader to read the ClickType. Now is 100% accurate.
Code changes (this may produce errors on old plugin dependencies)
  • NPCSlot enum is now called NPC.Slot
  • NPCPose enum is now called NPC.Pose
  • NPCLib.getInstance().setDefaultHideDistance(double) is now Deprecated, use instead NPCAttributes.setDefaultHideDistance(double)
  • NPCLib.getInstance().getDefaultHideDistance(double) is now Deprecated, use instead NPCAttributes.getDefaultHideDistance(double)

Bug fixes:

  • Fixed bug when automatic update look to player, and the player was in a different dimension as the NPC.
  • Fixed correctly NPC interact detection.
  • As this update is so big, is probably that bugs can appear. If you find any bug, please contact me.
  • Now when cancelling NPCInteractEvent, the Custom actions of the NPC will not be called.
  • Minor bug fixes
Happy new year 2022!
----------, Jan 1, 2022
Resource Information
Author:
----------
Total Downloads: 63,698
First Release: Jun 25, 2021
Last Update: Jun 15, 2023
Category: ---------------
All-Time Rating:
42 ratings
Find more info at sergiferry.github.io...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings