Jump to content

Recommended Posts

Posted

I created and registered several placed features through code (not json based)

Now I need to add them to vanilla biomes, for this I created biome tags for the biomes the features are supposed to generate in.

 

the biome tag is created at:

/data/example_mod/tags/worldgen/biome/has_feature/large_mushroom.json

the biome tag is referenced in my code like this:

public static final TagKey<Biome> HAS_FEATURE_LARGE_MUSHROOM = getTagKey("has_feature/large_mushroom");
/* more tags created similar */

private static TagKey<Biome> getTagKey(String id) {
     return TagKey.create(Registry.BIOME_REGISTRY, new ResourceLocation("example_mod", id));
}

my BiomeLoadingEvent (registered to the forge eventbus)

public static void onBiomeLoad(final BiomeLoadingEvent event) {
    Biome biome = ForgeRegistries.BIOMES.getValue(event.getName());
    boolean isCorrectBiome = ForgeRegistries.BIOMES.tags().getTag(HAS_FEATURE_LARGE_MUSHROOM).contains(biome); //always false
}

 

It looks like the biome tags are not filled/validated when the BiomeLoadingEvent is fired?

but using the command `/locatebiome #example_mod:has_feature/large_mushroom` works without problems

 

Am I missing something, or is there another way of adding my features to biomes without hardcoding them?

 

Posted

The main issue is that `BiomeLoadingEvent` intercepts the biome before it is loaded, so it wouldn't be in the registry. Additionally, I believe that the event is loaded before tags are populated, so you wouldn't be able to write anything anyways. In my opinion, I would just update to 1.19 with biome modifiers and use those since they have no issues supporting tags.

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.