Jump to content

cant find StructurePool using Code


Just_EmSee

Recommended Posts

Version: 1.20.6
Forge: 50.0.26

current code:

public static Holder<StructureTemplatePool> getTemplatePoolHolder(final ServerLevel level, final ResourceLocation resourceLocation) {
        if (level==null) {
            return null;
        }

        RegistryAccess registryaccess = level.registryAccess();

        Registry<StructureTemplatePool> registry = registryaccess.registryOrThrow(Registries.TEMPLATE_POOL);

        Logger logger = TheDungeon.LOGGER;

        logger.info("searcing for {} in {}", resourceLocation, registry);

        //Holder<StructureTemplatePool> holder = registry.getHolder(resourceLocation).orElse(null);

        StructureTemplatePool pool = registry.get(resourceLocation);
        Holder<StructureTemplatePool> holder = null;
        if (pool!=null) holder = Holder.direct(pool);
        return holder;
    }

unfortunately it seems like either i am getting the Registry wrong or the ResourceKey

this is the resource location it is trying to find: new ResourceLocation(TheDungeon.MOD_ID, "goblin_caves/spawns")

where the file is located resources > data > the_dungeon > worldgen > template_pool > goblin_caves > spawns.json

it does generate randomly when i create a structureSet

Link to comment
Share on other sites

ok so I figured out that what i was doing here worked

i apparently did not supply a starting jigsaw to the generate method, although now i get this error
No starting jigsaw the_dungeon:goblin_caves/spawns found in start pool the_dungeon:goblin_caves/spawns

this is the json file

{
  "name": "the_dungeon:goblin_caves/spawns",
  "fallback": "minecraft:empty",
  "elements": [
    {
      "weight": 1,
      "element": {
        "location": "the_dungeon:goblin_caves/spawns/stone_cave_spawn",
        "processors": "minecraft:empty",
        "projection": "rigid",
        "element_type": "minecraft:single_pool_element"
      }
    }
  ]
}

 

Edited by Just_EmSee
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.