Hi,
I'm trying to generate a bush object in 1.16.3 and I need some help with it.
This is my attempt:
public static void initBushes() {
Registry.register(WorldGenRegistries.field_243653_e, BlockInit.XP_BUSH.get().getRegistryName(),
Feature.FLOWER
.withConfiguration(init.XP_BUSH)
.withPlacement(Placement.field_242907_l
.configure(new TopSolidRangeConfig(5, 5, 128))
)
);
}
public static void setupBushes() {
for (Map.Entry<RegistryKey<Biome>, Biome> biome : WorldGenRegistries.field_243657_i.func_239659_c_()) {
if (!biome.getValue().getCategory().equals(Biome.Category.NETHER) && !biome.getValue().getCategory().equals(Biome.Category.THEEND)) {
addFeatureToBiome(biome.getValue(), GenerationStage.Decoration.VEGETAL_DECORATION,
WorldGenRegistries.field_243653_e.getOrDefault(BlockInit.XP_BUSH.get().getRegistryName()));
}
}
}
private static void addFeatureToBiome(Biome biome, GenerationStage.Decoration vegetalDecoration, ConfiguredFeature<?, ?> configuredFeature) {
List<List<Supplier<ConfiguredFeature<?, ?>>>> biomeFeatures = new ArrayList<>(biome.func_242440_e().func_242498_c());
while (biomeFeatures.size() <= vegetalDecoration.ordinal()) {
biomeFeatures.add(Lists.newArrayList());
}
List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(biomeFeatures.get(vegetalDecoration.ordinal()));
features.add(() -> configuredFeature);
biomeFeatures.set(vegetalDecoration.ordinal(), features);
ObfuscationReflectionHelper.setPrivateValue(BiomeGenerationSettings.class, biome.func_242440_e(), biomeFeatures,"field_242484_f");
}
I can't get it to work.
If you need more code here is my github: https://github.com/Timebreaker900/MetalBushesMod/tree/1.16.3
Thanks in advance!!!