Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

This is log error:

Caused by: com.google.gson.JsonParseException: Error loading registry data: No key feature in MapLike[{"type":"epictrees:epic_trees_codec","replace":false,"entries":[{"biomes":["minecraft:plains","minecraft:meadow"],"feature":"epictrees:weep_tree"},{"biomes":"minecraft:beach","feature":"epictrees:beach_palm"}],"forge:registry_name":"forge:biome_modifier"}]; No key biomes in MapLike[{"type":"epictrees:epic_trees_codec","replace":false,"entries":[{"biomes":["minecraft:plains","minecraft:meadow"],"feature":"epictrees:weep_tree"},{"biomes":"minecraft:beach","feature":"epictrees:beach_palm"}],"forge:registry_name":"forge:biome_modifier"}]

 

This is my file located at data/epictrees/forge/biome_modifier/epic_trees_codec.json

{
  "type":"epictrees:epic_trees_codec",
  "replace":false,
  "entries": [
    {
      "biomes":["minecraft:plains","minecraft:meadow"],
      "feature":"epictrees:weep_tree"
    },
    {
      "biomes":"minecraft:beach",
      "feature":"epictrees:beach_palm"
    }
  ],"forge:registry_name":"epictrees:epic_trees_codec"
}

And I get the same error with this code:

{
  "type":"epictrees:epic_trees_codec",
  "replace":false,
  "entries": [
    {
      "biomes":["minecraft:plains","minecraft:meadow"],
      "feature":"epictrees:weep_tree"
    },
    {
      "biomes":"minecraft:beach",
      "feature":"epictrees:beach_palm"
    }
  ],"forge:registry_name":"forge:biome_modifier"
}

My main class:

  static DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID);

    public static final RegistryObject<Codec<EpicTreesBiomeModifier>> EPIC_TREES_CODEC = BIOME_MODIFIER_SERIALIZERS.register("epic_trees_codec", () ->
            RecordCodecBuilder.create(builder -> builder.group(
                    // declare fields
                    Biome.LIST_CODEC.fieldOf("biomes").forGetter(EpicTreesBiomeModifier::biomes),
                    PlacedFeature.CODEC.fieldOf("feature").forGetter(EpicTreesBiomeModifier::feature)
                    // declare constructor
            ).apply(builder, EpicTreesBiomeModifier::new)));

    public EpicTrees()
    {
        final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

        // Register the Deferred Register to the mod event bus so blocks get registered
        BLOCKS.register(modEventBus);
        // Register the Deferred Register to the mod event bus so items get registered
        ITEMS.register(modEventBus);
        BLOCK_ENTITIES.register(modEventBus);
        ModFeatures.register(modEventBus);
        BIOME_MODIFIER_SERIALIZERS.register(modEventBus);


        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);

        //ModEntities.ENTITIES.register(modEventBus);
        //MinecraftForge.EVENT_BUS.register(WanderingArboristSpawner.class);


        //modEventBus.addListener(this::clientSetup);
        // Register the commonSetup method for modloading
        modEventBus.addListener(this::commonSetup);

    }
public record EpicTreesBiomeModifier(HolderSet<Biome> biomes, Holder<PlacedFeature> feature) implements BiomeModifier
{
    @Override
    public void modify(Holder<Biome> biome, Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) {
        if (phase == Phase.ADD && biomes.contains(biome))
        {
            // add things to biomes
            builder.getGenerationSettings().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, feature);
        }
    }

    @NotNull
    public Codec<? extends BiomeModifier> codec()
    {
        // This must return a registered Codec, see Biome Modifier Serializers below.
        return EpicTrees.EPIC_TREES_CODEC.get();
    }

}

And I have printed out the names of the Deferred Register objects to confirm the feature names are specified correctly and each feature, configured feature and the placed feature versions are registered with the same name.

You don't need to write your write your own biome modifier for this.

https://github.com/MinecraftForge/MinecraftForge/blob/b0caea8e204a7f026646396558d6d58a02bff9d6/src/main/java/net/minecraftforge/common/world/ForgeBiomeModifiers.java#L31

You put your "entries" in different files. Example from the testsuite:

https://github.com/MinecraftForge/MinecraftForge/blob/1.19.x/src/generated_test/resources/data/biome_modifiers_test/forge/biome_modifier/add_basalt.json

 

If you want to get yours to work with that json format, then you will need to change your codec and BiomeModifier implementation so it knows what you mean by "entries"s.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.