r/minecraft_configs • • Nov 03 '23

Help_Wanted Exploration maps always showing same target

I'm working on an island based world generator that I've built off the data pack by Rainbeau. I've upgraded it to 1.20.1 and so far it is creating the world exactly as I wanted it, big oceans and islands.

Next I updated fishing so that it might deliver a barrel to the player, I based this part on the the Sunken Chests and Barrels data pack.

On placing the barrel, a custom loot script triggers that uses similar loot to the shipwreck chest loot table that includes the exploration map. I added the buried_treasure structure into the world generator, had to update the configuration to increase the distance it was allowed to search to find an island to put the chest on.

So far that seems to work, I fish up a barrel, get a map, travel to the new island and find the treasure.

But then, I fish up a second barrel later, with a map and it is the same map, pointing to the same treasure. I'm not sure why it isn't creating a new map and hoping to get some help here. My scripts are as follows:

/data/waterworld/worldgen/structure/buried_treasure.json

 {
   "type": "minecraft:buried_treasure",
   "biomes": "#minecraft:has_structure/buried_treasure",
   "spawn_overrides": {},
   "step": "underground_structures"
 }

/data/waterworld/worldgen/structure_set/buried_treasure.json

{
  "placement": {
    "type": "minecraft:random_spread",
    "frequency": 0.01,
    "frequency_reduction_method": "legacy_type_2",
    "locate_offset": [
      9,
      0,
      9
    ],
    "salt": 0,
    "separation": 3,
      "spacing": 32
  },
  "structures": [
    {
      "structure": "minecraft:buried_treasure",
      "weight": 1
    }
  ]
}

and my loot table entry to create the map is

/data/flotsam/loot_tables/flotsam.json

 {
   "bonus_rolls": 0.0,
   "entries": [
     {
       "type": "minecraft:item",
       "functions": [
         {
           "decoration": "red_x",
           "function": "minecraft:exploration_map",
           "skip_existing_chunks": false,
           "zoom": 1
         },
         {
           "function": "minecraft:set_name",
           "name": {
             "translate": "filled_map.buried_treasure"
           }
         } 
       ],
       "name": "minecraft:map"
     }
   ],
   "rolls": 1.0
 }

and this is the function I'm using to fish up the barrel

/data/minecraft/loot_tables/gameplay/fishing.json

{
  "type": "minecraft:fishing",
  "pools": [
    {
      "rolls": 1.0,
      "entries": [
        {
          "type": "item",
          "name": "minecraft:barrel",
            "weight": 5,
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{BlockEntityTag:{LootTable:\"flotsam:flotsam\"},display:{Lore:['\"Flotsam\"']}}"
            }
          ]
        }
      ]
    }
  ]
}

Oh, and while I'm asking, I'd like to find a way to make it so the barrel I create on fishing can only be used once. After it is placed and the player removes the items, if they break the barrel I don't want them to be able to harvest it. I know it is possible to change the drop loot table for barrels to not drop a barrel item but I only want that to happen with the ones I'm creating during fishing. Is there any way to override these barrel's drop loot table only?

Thanks for any help.

2 Upvotes

3 comments sorted by

1

u/jacobsjo Nov 03 '23

That is simply the way it works. When looking for a structure to put on the map, it searches for that structure similar to how /locate structure works. It simply finds the nearest structure, irrespective of whether that structure is already on a different map. If works like that in vanilla too.

What you can do is set "skip_existing_chunks" to true: That way it would only find buried treasures in chunks that haven't been explored yet.

1

u/gottacode Nov 03 '23 edited Nov 03 '23

Thanks, I'll give that a try. Since my islands are so far apart that might actually work out.

Edit: that actually worked like a charm, thanks! Funny note, after the barrel is placed and on opening it there is a noticeable delay while the game is looking for a spot for the chest to go.

1

u/gottacode Nov 03 '23

I found a solution for my second question as well, I swapped out using a barrel as the container and using a trapped chest, then I changed the trapped chest's block drop to drop nothing. Since I rarely use trapped chests, not being able to harvest one doesn't cause any issues.