Class NPCEntityManager

java.lang.Object
com.jackdaw.chatwithnpc.npc.NPCEntityManager

public class NPCEntityManager extends Object
This class is used to manage the NPC entities.
  • Field Details

  • Constructor Details

    • NPCEntityManager

      public NPCEntityManager()
  • Method Details

    • isRegistered

      public static boolean isRegistered(UUID uuid)
      Check if an NPC is registered
      Parameters:
      uuid - The UUID of the NPC
      Returns:
      True if the NPC is registered, false otherwise
    • getNPCEntity

      @Nullable public static @Nullable NPCEntity getNPCEntity(UUID uuid)
      Get an NPC entity by its UUID.
      Parameters:
      uuid - The UUID of the NPC entity
      Returns:
      The NPC entity
    • getNPCEntity

      @Nullable public static @Nullable NPCEntity getNPCEntity(net.minecraft.entity.player.PlayerEntity player)
      Get the closest NPC around a player. This will register all NPCs within the range of the player.
      Parameters:
      player - The player to check
      Returns:
      The closest NPC to the player
    • getNPCEntities

      public static List<NPCEntity> getNPCEntities(net.minecraft.entity.player.PlayerEntity player)
      Get all NPCs within a certain range of a player. If the NPC is not registered, register it.
      Parameters:
      player - The player to check
      Returns:
      A list of NPCs within the range of the player
    • getEntitiesInRange

      private static List<net.minecraft.entity.Entity> getEntitiesInRange(@NotNull @NotNull net.minecraft.entity.player.PlayerEntity player, double range)
    • registerNPCEntity

      public static void registerNPCEntity(@NotNull @NotNull net.minecraft.entity.Entity entity, boolean isOP)
      Initialize an NPC entity if the NPC is not conversing.
      Parameters:
      entity - The NPC entity to initialize
    • removeNPCEntity

      public static void removeNPCEntity(UUID uuid)
      Remove an NPC entity from the map.
      Parameters:
      uuid - The UUID of the NPC entity to remove
    • endOutOfTimeNPCEntity

      public static void endOutOfTimeNPCEntity()
      End the out of time NPC entities.
    • endAllNPCEntity

      public static void endAllNPCEntity()
      End all NPC entities.