Posted October 7, 20204 yr 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!!! Edited October 7, 20204 yr by Timebreaker900
October 8, 20204 yr First, Problematic Code 11. Second, no need to register the configured feature. Third, you need to defer execution of the configs Fourth, one try will fail about 99.9% of the time. Fifth, you don't need to register the configured feature. Sixth, try to avoid using someone else's source as a direct reference as it most likely has problems of its own. Instead, indirectly view the code and try to understand what it's attempting to do and apply the underlying logic in the correct method.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.