Class ServerNPCRegistry
java.lang.Object
com.pixelmonmod.pixelmon.entities.npcs.registry.ServerNPCRegistry
Parses and stores NPC information from NPC JSON files.
-
Field Summary
Modifier and TypeFieldDescriptionstatic HashMap<String,
NPCRegistryData> Map from lang codes to NPC data.static String
The lang code for English language files.static final com.google.gson.Gson
static NPCRegistryShopkeepers
Data for shopkeepers.static NPCRegistryTrainers
Data for NPC Trainers.static NPCRegistryVillagers
Data for chatting NPCs. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
static void
decode
(net.minecraft.network.FriendlyByteBuf buffer) static void
decodeNPCs
(net.minecraft.network.FriendlyByteBuf buffer) static void
encode
(net.minecraft.network.FriendlyByteBuf buffer) static void
encodeNPCs
(net.minecraft.network.FriendlyByteBuf buffer, int current, int totalPackets) static void
extractFile
(String resourceName, File npcsDir, String filename) Extracts a file to another location.static NPCRegistryData
static ArrayList<GeneralNPCData>
Gets the English data for all chatting NPCs.static ArrayList<ShopkeeperData>
Gets the English data for all shopkeepers.static GymNPCData
getGymMember
(String id) Gets data for a Gym member by unique name id.static String
Gets a random name from a random NPC Trainer type.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).static String[]
getTranslatedGymMemberChat
(String langCode, String id, int index) Gets a specific translated set of dialogue for a specific type of Gym NPC.static GymNPCData
getTranslatedGymMemberData
(String langCode, String id) Retrieves Gym NPC data for a specific Gym NPC type.static String
getTranslatedGymMemberName
(String langCode, String id, int index) Gets a specific translated name for a specific type of Gym NPC.static void
readTrainerTypes
(com.google.gson.JsonElement element) static void
register
(com.google.gson.Gson gson, net.minecraft.resources.ResourceLocation rl, com.google.gson.JsonElement json)
-
Field Details
-
GSON
public static final com.google.gson.Gson GSON -
en_us
The lang code for English language files. -
data
Map from lang codes to NPC data. -
trainers
Data for NPC Trainers. -
villagers
Data for chatting NPCs. -
shopkeepers
Data for shopkeepers.
-
-
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
-
readTrainerTypes
public static void readTrainerTypes(com.google.gson.JsonElement element) -
getGymMember
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
Gets a random name from a random NPC Trainer type.- Returns:
- A random name from a random NPC Trainer type.
-
getTranslatedGymMemberData
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
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
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
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
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
Gets the English data for all chatting NPCs.- Returns:
- The English data for all chatting NPCs.
-
getEnglishShopkeepers
Gets the English data for all shopkeepers.- Returns:
- The English data for all shopkeepers.
-