Class ServerNPCRegistry

java.lang.Object
com.pixelmonmod.pixelmon.entities.npcs.registry.ServerNPCRegistry

public class ServerNPCRegistry extends Object
Parses and stores NPC information from NPC JSON files.
  • Field Details

  • Constructor Details

    • ServerNPCRegistry

      public ServerNPCRegistry()
  • Method Details

    • clear

      public static void clear()
    • register

      public static void register(com.google.gson.Gson gson, net.minecraft.resources.ResourceLocation rl, com.google.gson.JsonElement json)
    • encode

      public static void encode(net.minecraft.network.FriendlyByteBuf buffer)
    • encodeNPCs

      public static void encodeNPCs(net.minecraft.network.FriendlyByteBuf buffer, int current, int totalPackets)
    • decode

      public static void decode(net.minecraft.network.FriendlyByteBuf buffer)
    • decodeNPCs

      public static void decodeNPCs(net.minecraft.network.FriendlyByteBuf buffer)
    • getData

      public static NPCRegistryData getData(String locale)
    • readTrainerTypes

      public static void readTrainerTypes(com.google.gson.JsonElement element)
    • getGymMember

      public static GymNPCData getGymMember(String id)
      Gets data for a Gym member by unique name id.
      Parameters:
      id - The unique id of the gym member.
      Returns:
      GymNPCData for the requested id.
    • getRandomName

      public static String getRandomName()
      Gets a random name from a random NPC Trainer type.
      Returns:
      A random name from a random NPC Trainer type.
    • getTranslatedGymMemberData

      public static GymNPCData getTranslatedGymMemberData(String langCode, String id)
      Retrieves Gym NPC data for a specific Gym NPC type.
      Parameters:
      langCode - The lang code to translate strings with.
      id - The type of Gym NPC to get data for.
      Returns:
      Gym NPC data for the specified Gym NPC type.
    • getTranslatedGymMemberName

      public static String getTranslatedGymMemberName(String langCode, String id, int index)
      Gets a specific translated name for a specific type of Gym NPC.
      Parameters:
      langCode - The lang code to translate the name with.
      id - The type of Gym NPC to get a name for.
      index - The index of the name to get.
      Returns:
      The specified name for the Gym NPC.
    • getTranslatedGymMemberChat

      public static String[] getTranslatedGymMemberChat(String langCode, String id, int index)
      Gets a specific translated set of dialogue for a specific type of Gym NPC.
      Parameters:
      langCode - The lang code to translate the dialogue with.
      id - The type of Gym NPC to get dialogue for.
      index - The index of the set of dialogue to get.
      Returns:
      The specified dialogue for the Gym NPC.
    • extractFile

      public static void extractFile(String resourceName, File npcsDir, String filename)
      Extracts a file to another location.
      Parameters:
      resourceName - The name of the resource to extract from.
      npcsDir - The folder to extract to.
      filename - The name of the file put the extracted data in.
    • getTranslatedData

      public static ITrainerData getTranslatedData(String langCode, BaseTrainer baseTrainer, String id)
      Retrieves a specific NPC Trainer type's data (from both gym npcs and normal trainer data).
      Parameters:
      langCode - The lang code to translate strings with.
      baseTrainer - The Trainer type to get data from.
      id - The ID of the Trainer type.
      Returns:
      The specified NPC Trainer type's data.
    • getEnglishNPCs

      public static ArrayList<GeneralNPCData> getEnglishNPCs()
      Gets the English data for all chatting NPCs.
      Returns:
      The English data for all chatting NPCs.
    • getEnglishShopkeepers

      public static ArrayList<ShopkeeperData> getEnglishShopkeepers()
      Gets the English data for all shopkeepers.
      Returns:
      The English data for all shopkeepers.