Jump to content

[Solved] [1.16.4] Can't get custom plants to generate


vassdeniss

Recommended Posts

Am i doing something wrong?

@Mod.EventBusSubscriber
public class DecorationGeneration {
    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public static void generateBushes(BiomeLoadingEvent event) {
        BiomeGenerationSettingsBuilder generation = event.getGeneration();

        BlockClusterFeatureConfig MINT_BUSH_CONFIG = (new BlockClusterFeatureConfig.Builder(
                    new SimpleBlockStateProvider(
                            RegistryHandler.MINT_BUSH_BLOCK.get().getDefaultState().with(MintBush.AGE, 3)
                    ), SimpleBlockPlacer.PLACER
                )
        ).tries(64).whitelist(ImmutableSet.of(
                Blocks.GRASS_BLOCK.getDefaultState().getBlock()
        )).func_227317_b_().build();

        ConfiguredFeature<?, ?> MINT_BUSH = Feature.RANDOM_PATCH.withConfiguration(MINT_BUSH_CONFIG);
        ConfiguredFeature<?, ?> MINT_BUSH_DECORATED = MINT_BUSH.withPlacement(Features.Placements.PATCH_PLACEMENT).chance(24);

        if (event.getCategory().equals(Biome.Category.PLAINS)) {
            generation.withFeature(
                    GenerationStage.Decoration.VEGETAL_DECORATION, MINT_BUSH_DECORATED
            );
        }
    }
}

 

Edited by vassdeniss
Link to comment
Share on other sites

first of all you can't create the ConfiguredFeature inside the event because you need to register them
second, take a look at the vanilla Features class how to create ConfiguredFeature,
then copy the vanilla registry and do this for your ConfiguredFeature inside FMLCommonSetupEvent

Link to comment
Share on other sites

23 minutes ago, Luis_ST said:

first of all you can't create the ConfiguredFeature inside the event because you need to register them
second, take a look at the vanilla Features class how to create ConfiguredFeature,
then copy the vanilla registry and do this for your ConfiguredFeature inside FMLCommonSetupEvent

private void setup(final FMLCommonSetupEvent event) {
        DecorationGeneration.registerBushes();
}
@Mod.EventBusSubscriber
public class DecorationGeneration {
    private static final ArrayList<ConfiguredFeature<?, ?>> overworldDeco = new ArrayList<ConfiguredFeature<?, ?>>();

    public static void registerBushes() {
        overworldDeco.add(register("mint", Feature.RANDOM_PATCH.withConfiguration(new BlockClusterFeatureConfig
                .Builder(new SimpleBlockStateProvider(RegistryHandler.MINT_BUSH_BLOCK.get().getDefaultState().with(MintBush.AGE, 3)),
                SimpleBlockPlacer.PLACER).tries(64).whitelist(ImmutableSet.of(Blocks.GRASS_BLOCK.getBlock()))
                .func_227317_b_().build()
        )).withPlacement(Features.Placements.PATCH_PLACEMENT).chance(24));
    }

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public static void gen(BiomeLoadingEvent event) {
        BiomeGenerationSettingsBuilder generation = event.getGeneration();
        for (ConfiguredFeature<?, ?> bush : overworldDeco){
            if (bush != null) generation.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, bush);
        }
    }

    private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String name, ConfiguredFeature<FC, ?> configuredFeature) {
        return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, MakoRuMod.MOD_ID + ":" + name, configuredFeature);
    }
}

I did something like this. I believe im getting closer but still it doesn't work?

Link to comment
Share on other sites

the ConfiguredFeature works i copied your code and i found the feature, but it's very rare, rare than the pumpkin feature

	private void setup(final FMLCommonSetupEvent event) {
		MINT = register("mint", Feature.RANDOM_PATCH.configured((new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(Blocks.BARREL.defaultBlockState()), SimpleBlockPlacer.INSTANCE))
				.tries(64).noProjection().whitelist(Sets.newHashSet(Blocks.GRASS_BLOCK)).build()).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE).chance(24));
	}
	
	private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String name, ConfiguredFeature<FC, ?> configuredFeature) {
		return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation("examplemod", name), configuredFeature);
	}
	
	public static ConfiguredFeature<?, ?> MINT;
	
	@SubscribeEvent(priority = EventPriority.HIGH)
	public static void name(BiomeLoadingEvent event) {
		if (MINT != null) {
			event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, MINT);
		}
	}

and (I had to scale down the picture because it was too big)
2021-08-15_11_45_51.png.0d346f45de56cb2f11c284dbc7491365.png

Link to comment
Share on other sites

Just now, Luis_ST said:

the ConfiguredFeature works i copied your code and i found the feature, but it's very rare, rare than the pumpkin feature


	private void setup(final FMLCommonSetupEvent event) {
		MINT = register("mint", Feature.RANDOM_PATCH.configured((new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(Blocks.BARREL.defaultBlockState()), SimpleBlockPlacer.INSTANCE))
				.tries(64).noProjection().whitelist(Sets.newHashSet(Blocks.GRASS_BLOCK)).build()).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE).chance(24));
	}
	
	private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String name, ConfiguredFeature<FC, ?> configuredFeature) {
		return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation("examplemod", name), configuredFeature);
	}
	
	public static ConfiguredFeature<?, ?> MINT;
	
	@SubscribeEvent(priority = EventPriority.HIGH)
	public static void name(BiomeLoadingEvent event) {
		if (MINT != null) {
			event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, MINT);
		}
	}

and (I had to scale down the picture because it was too big)
2021-08-15_11_45_51.png.0d346f45de56cb2f11c284dbc7491365.png

how do i make it common? The .chance?

Link to comment
Share on other sites

        MINT = register("mint",
                Feature.RANDOM_PATCH.withConfiguration(
                        new BlockClusterFeatureConfig.Builder(
                                new SimpleBlockStateProvider(
                                        RegistryHandler.MINT_BUSH_BLOCK.get().getDefaultState().with(MintBush.AGE, 3)),
                                SimpleBlockPlacer.PLACER)
                                .tries(64).func_227317_b_()
                                .whitelist(Sets.newHashSet(Blocks.GRASS_BLOCK)).build())
                        .withPlacement(Features.Placements.PATCH_PLACEMENT).chance(80)
        );

Still not seeing it :/

Everything seems correct i don't get it

Link to comment
Share on other sites

2 minutes ago, Luis_ST said:

show all relevant classes (Events)

@Mod.EventBusSubscriber
public class DecorationGeneration {
    public static ConfiguredFeature<?, ?> MINT;

    public static void registerBushes() {
        MINT = register("mint",
                Feature.RANDOM_PATCH.withConfiguration(
                        new BlockClusterFeatureConfig.Builder(
                                new SimpleBlockStateProvider(
                                        RegistryHandler.MINT_BUSH_BLOCK.get().getDefaultState().with(MintBush.AGE, 3)),
                                SimpleBlockPlacer.PLACER)
                                .tries(64).func_227317_b_()
                                .whitelist(Sets.newHashSet(Blocks.GRASS_BLOCK)).build())
                        .withPlacement(Features.Placements.PATCH_PLACEMENT).chance(80)
        );
    }

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public static void gen(BiomeLoadingEvent event) {
        if (MINT != null) {
            event.getGeneration().withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, MINT);
        }
    }

    private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String name, ConfiguredFeature<FC, ?> configuredFeature) {
        return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation("makoru", name), configuredFeature);
    }
}

DecoGeneration

 

    private void setup(final FMLCommonSetupEvent event) {
        OreGeneration.registerOres();
        DecorationGeneration.registerBushes();
        DeferredWorkQueue.runLater(() -> {
            GlobalEntityTypeAttributes.put(RegistryHandler.NIMBAT.get(), NimbatEntity.setCustomAttributes().create());
        });
    }

Main Class

Link to comment
Share on other sites

Still no. Jesus i have no idea

heres my registry line

public static final RegistryObject<Block> MINT_BUSH_BLOCK = BLOCKS.register("mint_bush_block", MintBush::new);

 

and the mint bush class itself

public class MintBush extends SweetBerryBushBlock {
    public MintBush() {
        super(Block.Properties.create(Material.PLANTS)
                .hardnessAndResistance(0, 0)
                .doesNotBlockMovement()
                .tickRandomly()
                .sound(SoundType.PLANT)
        );
    }

    @Override
    public ItemStack getItem(IBlockReader worldIn, BlockPos pos, BlockState state) {
        return new ItemStack(RegistryHandler.MINT.get());
    }

    @Override
    public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
        int i = state.get(AGE);
        boolean flag = i == 3;

        if (!flag && player.getHeldItem(handIn).getItem() == Items.BONE_MEAL) {
            return ActionResultType.PASS;
        } else if (i > 1) {
            int j = 1 + worldIn.rand.nextInt(2);
            spawnAsEntity(worldIn, pos, new ItemStack(RegistryHandler.MINT.get(), j + (flag ? 1 : 0)));
            worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_SWEET_BERRIES_PICK_FROM_BUSH,
                    SoundCategory.BLOCKS, 1, 0.8f + worldIn.rand.nextFloat() * 0.4f
            );
            worldIn.setBlockState(pos, state.with(AGE, 1), 2);
            return ActionResultType.SUCCESS;
        } else {
            return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
        }
    }

    @Override
    public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
        super.onEntityCollision(state, worldIn, pos, entityIn);
    }
}

maybe its something there but I doubt it

Edited by vassdeniss
Fixed mistake
Link to comment
Share on other sites

  • vassdeniss changed the title to [Solved] [1.16.4] Can't get custom plants to generate

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ratuasia77 adalah bocoran slot rekomendasi gacor dari Ratuasia77 yang bisa anda temukan di SLOT Ratuasia77. Situs SLOT Ratuasia77 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ratuasia77 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ratuasia77 merupakan SLOT Ratuasia77 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ratuasia77. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ratuasia77 hari ini yang telah disediakan SLOT Ratuasia77. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ratuasia77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ratuasia77 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ratuasia77 di link SLOT Ratuasia77.
    • 20 SLOT DEMO GRATIS PRAGMATIC PLAY x500 RUPIAH ANTI LAG & 20 DEMO SLOT MAHJONG WAYS PG SOFT GRATIS ANTI RUNGKAD KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • BOCORAN POLA SLOT GACOR MAHJONG WAYS MAXWIN x500 PETIR MERAH HARI INI HINGGA MALAM INI KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • Museumbola merupakan wadah judi online terkhusus untuk sbobet atau judi bola. Dengan daftar dan deposit menggunakan BANK BCA, Anda berkesempatan mendapatkan prediksi jitu pertandingan secara update setiap hari yang bisa anda jadikan acuan untuk bermain judi bola. Hanya dengan 10 ribu rupiah dan anda bermain Mix Parlay menggunakan prediksi yang telah di sediakan oleh kami, anda akan memenangkan jutaan rupiah. Yuk segera klik DAFTAR sekarang juga.
    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
  • Topics

×
×
  • Create New...

Important Information

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