[Question] Cannot generate trees in overworld
See original GitHub issueSorry for disturbing. I’m trying to creating a mod with fabric and when to following the tutorial:trees, I met up with some problems.
I have the following code (most from the tutorial, based on the example mod project):
RichSaplingGenerator.java
public class RichSaplingGenerator extends SaplingGenerator {
public RichSaplingGenerator() {
}
@Nullable
@Override
protected ConfiguredFeature<TreeFeatureConfig, ?> getTreeFeature(Random random, boolean bees) {
return (ConfiguredFeature<TreeFeatureConfig, ?>) ExampleMod.TREE_RICH;
}
}
RichSaplingBlock.java
public class RichSaplingBlock extends SaplingBlock {
public RichSaplingBlock(SaplingGenerator generator, Settings settings) {
super(generator, settings);
}
}
ExampleMod.java
public class ExampleMod implements ModInitializer {
public static ConfiguredFeature<?, ?> TREE_RICH = null;
public static Block RICH_SAPLING = new RichSaplingBlock(
new RichSaplingGenerator(),
FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly());
@Override
public void onInitialize() {
Registry.register(Registry.BLOCK, new Identifier("modid", "rich_sapling"), RICH_SAPLING);
Registry.register(Registry.ITEM, new Identifier("modid", "rich_sapling"), new BlockItem(RICH_SAPLING, new Item.Settings().group(ItemGroup.MISC)));
TREE_RICH = Feature.TREE
// Configure the feature using the builder
.configure(new TreeFeatureConfig.Builder(
new SimpleBlockStateProvider(Blocks.NETHERITE_BLOCK.getDefaultState()), // Trunk block provider
new StraightTrunkPlacer(8, 3, 0), // places a straight trunk
new SimpleBlockStateProvider(Blocks.DIAMOND_BLOCK.getDefaultState()), // Foliage block provider
new SimpleBlockStateProvider(RICH_SAPLING.getDefaultState()), // Sapling provider; used to determine what blocks the tree can generate on
new BlobFoliagePlacer(ConstantIntProvider.create(5), ConstantIntProvider.create(0), 3), // places leaves as a blob (radius, offset from trunk, height)
new TwoLayersFeatureSize(1, 0, 1) // The width of the tree at different layers; used to see how tall the tree can be without clipping into blocks
).build());
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
RegistryKey<ConfiguredFeature<?, ?>> treeRich = RegistryKey.of(Registry.CONFIGURED_FEATURE_KEY, new Identifier("modid", "tree_rich"));
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, treeRich.getValue(), TREE_RICH);
// You should use the VEGETAL_DECORATION generation step for trees
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.VEGETAL_DECORATION, treeRich);
System.out.println("Hello Fabric world!");
}
}
I found the feature is working, ie. I can put saplings and they will grow, the problem is that the tree does not generate in the overworld, and there’re no exceptions reported.
Did I do something wrong?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Can you grow the new nether trees in the overworld? - Reddit
Yes, all you have to do is place the stem (if crimson mushroom, then crimson stem etc.) and then a fungus. You can...
Read more >[MC-125007] World fails to generate decorations on ... - Mojang
The bug. Some biome decorations such as snow , trees and structures sometimes fail to generate, producing very distinct 8 × 8 sections...
Read more >How To Grow NETHER TREES In Minecraft 1.16 - YouTube
Learn how to grow nether trees in Minecraft! You'll learn how to grow both Warped and Crimson trees in the Overworld and Nether....
Read more >Snapshot 2021.1 Custom trees do not generate, biomes in ...
I have tried each type of tree generation and they don't generate. Biomes in custom (overworld type at least) dimensions spawn in diagonal...
Read more >palm trees doesn't spawn in overworld when option for they ...
I'm seeing palm trees, unable to reproduce. ... don't seem to appear in any generated Beach biomes, but they do generate if you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Its not my code. It’s just the first thing I found in recent updates on curseforge that had the tree/trees idiom in a simple example. I didn’t look at the details. 😃
Here’s a simple example: https://github.com/CamoMano/Vanilla-Enhanced/blob/master/src/main/java/com/vanillaenhanced/world/Features.java Note the difference between the basic REDWOOD_TREE and the decorated REDWOOD_TREES that includes worldgen placement information.