I am attempting to add a tree into the world. All the tree parts are rendering, and are usable, and I can place the sapling but the sapling will not grow either with bone meal or naturally, which is what the bug is.
So first I register all the parts of the Cherry Tree. Those are all working, including the sapling. Here is an example of the sapling and a log. The log is a modded FlammableRotatedPillarBlock that sets the object to flammable = true, sets flammability to 5, sets fire spread speed to 5, and tells it what to do when it's clicked on with an axe (aka stripping the log).
public static final RegistryObject<Block> CHERRY_LOG = register("cherry_log", () -> new ModFlammableRotatedPillarBlock(BlockBehaviour.Properties.copy(Blocks.OAK_LOG)
.requiresCorrectToolForDrops()), CreativeModeTab.TAB_BUILDING_BLOCKS);
public static final RegistryObject<Block> CHERRY_SAPLING = register("cherry_sapling", () -> new SaplingBlock(new CherryTreeGrower(), BlockBehaviour.Properties.copy(Blocks.OAK_SAPLING)),
CreativeModeTab.TAB_MISC);
In another file, I register the cherry tree, and give it the various things a tree needs to grow.
public class ModConfiguredFeatures {
public static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, HickoryGardenMod.MODID);
public static final RegistryObject<ConfiguredFeature<?, ?>> CHERRY =
CONFIGURED_FEATURES.register("cherry", () ->
new ConfiguredFeature<>(Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder(
BlockStateProvider.simple(BlockInit.CHERRY_LOG.get()),
new StraightTrunkPlacer(5, 6, 3),
BlockStateProvider.simple(BlockInit.CHERRY_LEAVES.get()),
new BlobFoliagePlacer(ConstantInt.of(2), ConstantInt.of(0), 4),
new TwoLayersFeatureSize(1, 0, 2)).build()));
}
Then, I created a CherryTreeGrower class that extends AbstractTreeGrower, using that CHERRY object.
public class CherryTreeGrower extends AbstractTreeGrower {
@Nullable
@Override
protected Holder<? extends ConfiguredFeature<?, ?>> getConfiguredFeature(RandomSource pRandom, boolean pLargeHive) {
return ModConfiguredFeatures.CHERRY.getHolder().get();
}
}
The Error I get is
java.lang.IllegalStateException: Trying to access unbound value 'ResourceKey[minecraft:worldgen/configured_feature / hickorygardenmod:cherry]' from registry Registry[ResourceKey[minecraft:root / minecraft:worldgen/configured_feature] (Stable)]
Other than the necessary json files and png files in the resources folder, I don't refer to the cherry tree components anywhere else. Thoughts?