Dynamic Villager Trades

Dynamic Villager Trades

5.7k Downloads

Adding more structure maps to cartographer profession

Jawzper opened this issue ยท 5 comments

commented

Hello, I am trying to use data to add more explorer map types to the cartographer's profession table, for example to locate desert pyramids. I have looked at the cartographer table in my DVT generated datapack and if I understand correctly it is necessary to tag structures before they can be used for explorer maps (for the "feature_tag" field), so I have already gotten that done. And I think it's fine for me to leave "type" alone? But I am unclear on a few of the other, namely "key", "name_key", and "icon".

What are valid values here? Are there any other steps I will need to take to make this work?

Thanks for your time and efforts

commented

The keys from the generated datapack have a format but you don't have to use that for the trades you add, it's arbitrary text.

commented

key can be anything as long as it's unique, when used in conjunction with "cache": true it makes it so that the villager only searches for the structure once, and not every time the trades are refreshed.
type is the type of the trade so you obviously shouldn't touch it.
feature_tag is a tag as you've said, and more specifically a structure or feature tag located in xxx/tags/worldgen/structure/yyy.json.
name_key is the name of the map item, it must be a translation key that points to the language files.
icon is the name of the icon displayed on the map and must be one of these: player, frame, red_marker, blue_marker, target_x, target_point, player_off_map, player_off_limits, mansion, monument, banner_white, banner_orange, banner_magenta, banner_light_blue, banner_yellow, banner_lime, banner_pink, banner_gray, banner_light_gray, banner_cyan, banner_purple, banner_blue, banner_brown, banner_green, banner_red, banner_black, red_x, village_desert, village_plains, village_savanna, village_snowy, village_taiga, jungle_temple, swamp_hut

I am also wondering if it will cause issues to have multiple structures under a single feature tag, for example mineshaft and mineshaft_mesa? Is it necessary to make entirely separate tags & maps for these?

No idea, try it, this is not something the mod deals with, it just makes it available through JSON

commented

Great, I think I got it working. For example:

{
          "key": "apprentice_worldgen/structure",
          "cache": true,
          "offer": {
            "icon": "TARGET_POINT",
            "experience": 15,
            "price": 16,
            "feature_tag": "scarecrowtweaks:on_desert_explorer_maps",
            "name_key": "Desert Explorer Map",
            "type": "minecraft:sell_map"
          },
          "level": "apprentice",
          "attributes": {}
        }

In the example output, I saw lines like "key": "apprentice_worldgen/structure" and in my experimenting I just copied this, changed the trade level as necessary. You have said key can be anything as long as it's unique, does this format not have any specific meaning? I suppose this is the reason I sometimes see duplicate trades, so if not I'll change it to something else.

commented

I am also wondering if it will cause issues to have multiple structures under a single feature tag, for example mineshaft and mineshaft_mesa? Is it necessary to make entirely separate tags & maps for these?

commented

Okay great. Thanks for the help! This will make the End Remastered mod a lot more fun for me and the boys.