Jump to content

[1.18] Need help getting custom bush to generate in the Nether!


Recommended Posts

Posted (edited)

Hi, I have a custom bush block that I made, and I am able to get it to generate normally in the overworld. I have since made another similar bush block, but I want this one to be able to gen only on soul soil in the soul sand valley biomes. Here is my code, I am not sure why it is not working, it isn't generating in the soul sand valley.

 




//In class BlockInit
public static final RegistryObject<BushBlock> SOULBERRY_BUSH = BLOCKS.register("soulberry_bush",
			() -> new CustomBush(PropertyInit.SOULBERRY_BUSH_PROPERTY));
//In Class PropertyInit
public class PropertyInit {

	private PropertyInit() {
	}

	public final static BlockBehaviour.Properties CUSTOM_BUSH_PROPERTY = BlockBehaviour.Properties
			.of(Material.PLANT, MaterialColor.COLOR_GREEN).randomTicks().noCollission().instabreak()
			.sound(SoundType.SWEET_BERRY_BUSH);
	public final static BlockBehaviour.Properties SOULBERRY_BUSH_PROPERTY = BlockBehaviour.Properties
			.of(Material.REPLACEABLE_FIREPROOF_PLANT, MaterialColor.NETHER).randomTicks().noCollission().instabreak()
			.sound(SoundType.SOUL_SAND);

}

//In class PlacedFeatureInit
public class PlacedFeatureInit {

	public static final PlacedFeature CUSTOM_BUSH_PLACED = PlacementUtils.register("custom_bush_placed",
			ConfigFeatureInit.BERRY_BUSH_CONFIG.placed());
	public static final PlacedFeature SOULBERRY_BUSH_PLACED = PlacementUtils.register("soulberry_bush_placed",
			ConfigFeatureInit.SOULBERRY_BUSH_CONFIG.placed());
}


//In class ConfigFeatureInit
public static final ConfiguredFeature<RandomPatchConfiguration, ?> SOULBERRY_BUSH_CONFIG = FeatureUtils
			.register("soulberry_bush_config", Feature.FLOWER.configured(new RandomPatchConfiguration(1, 20, 20, () -> {
				return Feature.SIMPLE_BLOCK
						.configured(new SimpleBlockConfiguration(BlockStateProvider.simple(
								BlockInit.SOULBERRY_BUSH.get().defaultBlockState().setValue(SoulBerryBush.AGE, 3))))
						.placed(InSquarePlacement.spread(), PlacementUtils.RANGE_BOTTOM_TO_MAX_TERRAIN_HEIGHT,
								RarityFilter.onAverageOnceEvery(1),
								BlockPredicateFilter.forPredicate(BlockPredicate.matchesBlocks(
										Arrays.asList(Blocks.SOUL_SAND, Blocks.SOUL_SOIL, Blocks.NETHERRACK))));
			})));
//In class Bush Generation:
public class BushGeneration {

	public static void generateBushes(final BiomeLoadingEvent event) {
		@SuppressWarnings("unused")
		ResourceKey<Biome> key = ResourceKey.create(Registry.BIOME_REGISTRY, event.getName());
		ResourceLocation biome = event.getName();
		List<Supplier<PlacedFeature>> base = event.getGeneration()
				.getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION);
		if (biome.toString().contains("plains")) {

			base.add(() -> PlacedFeatureInit.CUSTOM_BUSH_PLACED);
		} else if (biome.toString().contains("soul")) {
			base.add(() -> PlacedFeatureInit.SOULBERRY_BUSH_PLACED);
		}
	}
	public static void onBiomeLoad(BiomeLoadingEvent event) {
        generateBushes(event);
        }
}

 

Edited by OhWhoah

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.