Class NPCRegistryShopkeepers
java.lang.Object
com.pixelmonmod.pixelmon.entities.npcs.registry.NPCRegistryShopkeepers
-
Field Summary
Modifier and TypeFieldDescriptionstatic HashMap<String,
BaseShopItem> Map from item names to shop item prices. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets an NPC shopkeeper from its internal ID.Retrieves the base shop item by name.Retrieves the desired shop item by name.getItem
(net.minecraft.world.item.ItemStack itemStack) Retrieves the base shop item by ItemStack.getJsonName
(String npcIndex) Retrieves the json name for the indexed shopkeeper.Gets the next shopkeeper from a current index.Randomly selects a group of shopkeeper data.getRandom
(EnumShopKeeperType type) Randomly selects a group of shopkeeper data.getRandomSpawning
(String biomeID) Gets a random spawn shopkeeper for a biome.String[]
Gets biomes where spawn shopkeepers can spawn in.getTranslatedChat
(String langCode, String npcIndex, int index) Retrieves the translated version of the indexed shopkeeper chat.getTranslatedData
(String langCode, String id) Retrieves shopkeeper NPC data for a specific shopkeeper type.getTranslatedName
(String langCode, String npcIndex, int nameIndex) Retrieves the translated version of the indexed shopkeeper name.boolean
Checks if there are any spawn shopkeepers registered.void
registerShopItems
(com.google.gson.JsonElement element) Registers shop data from shopItems.json.
-
Field Details
-
shopItems
Map from item names to shop item prices.
-
-
Constructor Details
-
NPCRegistryShopkeepers
public NPCRegistryShopkeepers()
-
-
Method Details
-
registerShopItems
public void registerShopItems(com.google.gson.JsonElement element) Registers shop data from shopItems.json. -
getRandom
Randomly selects a group of shopkeeper data.- Returns:
- A randomly selected group of shopkeeper data.
-
getById
Gets an NPC shopkeeper from its internal ID.- Parameters:
id
- The ID of the NPC shopkeeper.- Returns:
- The base shopkeeper data.
-
getRandom
Randomly selects a group of shopkeeper data.- Parameters:
type
- The type of shopkeeper to get data for.- Returns:
- A randomly selected group of shopkeeper data.
-
getTranslatedData
Retrieves shopkeeper NPC data for a specific shopkeeper type.- Parameters:
langCode
- The lang code to translate strings with.id
- The type of shopkeeper NPC to get data for.- Returns:
- Shopkeeper NPC data for the specified shopkeeper NPC type.
-
getTranslatedChat
Retrieves the translated version of the indexed shopkeeper chat.- Parameters:
langCode
- The lang code to translate strings with.npcIndex
- The type of shopkeeper NPC to get data for.index
- The index of the chat entry.- Returns:
- Translated shopkeeper chat.
-
getJsonName
Retrieves the json name for the indexed shopkeeper.- Parameters:
npcIndex
- The type of shopkeeper NPC to get data for.- Returns:
- Json name for shopkeeper index.
-
getNext
Gets the next shopkeeper from a current index.- Parameters:
npcIndex
- The index of the current shopkeeper.- Returns:
- The next shopkeeper from the current one.
-
getItem
Retrieves the desired shop item by name.- Parameters:
npcIndex
- The type of shopkeeper NPC to get data for.itemID
- The id of the item.- Returns:
- ShopItem instance for that item.
-
getItem
Retrieves the base shop item by name.- Parameters:
name
- The name of the desired item.- Returns:
- BaseShopItem instance for that item.
-
getItem
Retrieves the base shop item by ItemStack.- Parameters:
itemStack
- The desired item.- Returns:
- BaseShopItem instance for that item.
-
getTranslatedName
Retrieves the translated version of the indexed shopkeeper name.- Parameters:
langCode
- The lang code to translate strings with.npcIndex
- The type of shopkeeper NPC to get data for.nameIndex
- The index of the name entry.- Returns:
- Translated shopkeeper name.
-
hasRoaming
public boolean hasRoaming()Checks if there are any spawn shopkeepers registered.- Returns:
- Whether there are any spawn shopkeepers registered.
-
getRandomSpawning
Gets a random spawn shopkeeper for a biome.- Parameters:
biomeID
- The ID of the biome to get a shopkeeper for.- Returns:
- A random spawn shopkeeper for the specified biome, or null if there aren't any.
-
getRoamingBiomes
Gets biomes where spawn shopkeepers can spawn in.- Returns:
- An array of biome IDs where spawn shopkeepers can spawn in.
-