Architectury API (UNUSED)

Architectury API (UNUSED)

9M Downloads

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

Craftjakob opened this issue ยท 1 comments

commented

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!

commented

I have the same issue on BiomeModification not working on NeoForge.
My alternative solution for it is to use Data-driven Biome Modification provided by neoforge it self.
Under the neoforge module, create a modifier definition at neoforge/src/main/resources/data/{modid}/neoforge/biome_modifier/{filename}.json, and you can do things like ore-generation, decorations, etc.
For details, you can check on neoforge doc https://docs.neoforged.net/docs/worldgen/biomemodifier/#built-in-biome-modifiers
Or my implementation: Dalarion/Croparia@53282b4#diff-5e3eb1300b806cd782219c8c7e01a0693e5fe6236e3a5051d4ccc81b82f5a8e9