architectury / architectury-api

An intermediary api aimed at easing development of multiplatform mods.
https://discord.architectury.dev/
GNU Lesser General Public License v3.0
315 stars 56 forks source link

World Generation via BiomeModifications on NeoForge does not work and another thing #480

Open Craftjakob opened 7 months ago

Craftjakob commented 7 months ago

I tried many times in different versions to set up the World Generation for ores, etc., in Fabric and Forge it works, but not in NeoForge.

Example code, that I use, which works in Fabric and Forge:

BiomeModifications.addProperties((biomeContext, mutable) -> {
            if (biomeContext.hasTag(BiomeTags.IS_END)) {
                mutable.getGenerationProperties().addFeature(
                        GenerationStep.Decoration.UNDERGROUND_DECORATION,
                        ResourceKey.create(Registries.PLACED_FEATURE,
                                new ResourceLocation(EXAMPLE.MOD_ID "example_placed"))
                );
            }
});

And a question: there is another addFeture methode, where you need to but a PlacedFeature inside a Holder, but how can I use that? In Forge's dategen you never need a Holder with a PlacedFeature. Only that for BiomeModifers:

private static Direct<PlacedFeature> feature(BootstapContext<BiomeModifier> context, ResourceKey<PlacedFeature> placedFeature) {
      return HolderSet.direct(context.lookup(Registries.PLACED_FEATURE).getOrThrow(placedFeature));
}

Another thing, that is annoying is a feature in the CreativeTabRegistry. Here you need to give a CreativeModeTab, but If you want to use it like that: 'CreativeModeTabs.COMBAT', it does not work. I get around the problem by using this: 'CreativeModeTabs.allTabs().get(7)'

CreativeTabRegistry.modifyBuiltin(CreativeModeTabs.allTabs().get(10), (flags, output, canUseGameMasterBlocks) -> {
            output.acceptAfter(Items.NETHERITE_INGOT, EXAMPLE_MOD_ITEM);
});

In Forge, you can use 'CreativeModeTabs.COMBAT':

private void addCreative(BuildCreativeModeTabContentsEvent event) {
        if (event.getTabKey() == CreativeModeTabs.COMBAT) {
                      event.getEntries().putAfter(new ItemStack(Items.NETHERITE_INGOT), new ItemStack(EXAMPLE_MOD_ITEM), TabVisibility.PARENT_AND_SEARCH_TABS);
        }
}

Hopefully you can implement or fix this, that would be very great!