跳到主要内容

40树生成

代码

ModPlacedFeatures中:

public static final RegistryKey<PlacedFeature> CHESTNUT_PLACED_KEY = registerKey("chestnut_placed");


register(context, CHESTNUT_PLACED_KEY, configuredFeatureRegistryEntryLookup.getOrThrow(ModConfiguredFeatures.CHESTNUT_KEY),
VegetationPlacedFeatures.treeModifiersWithWouldSurvive(PlacedFeatures.createCountExtraModifier(2, 0.1f, 2),
ModBlocks.CHESTNUT_SAPLING));

ModTreeGeneration:

public class ModTreeGeneration {
public static void generateTrees() {
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.PLAINS, BiomeKeys.FOREST),
GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.CHESTNUT_PLACED_KEY);
}
}

ModWorldGeneration:

ModTreeGeneration.generateTrees();

效果

image-20240825212559058