How to create rare plants?

Started by Walbaby on Mon, 01/14/2019 - 12:46

Topic category: Help with modding (Java Edition)

Last seen on 12:13, 2. Dec 2019
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to create rare plants?
Mon, 01/14/2019 - 12:46

Hello everyone. I have problems with the spawning rates of my plants/flowers. I hope anyone had the same problem and found a solution.

I made a mod that has some flowers and other plants in it. The plants itself work fine, but i want some of them to not spawn in groups of 5-7 every 20 blocks. 

So i changed to code. In this code down here are the original settings:

 

    public void generateSurface(World world, java.util.Random randomGenerator, int chunkX, int chunkZ) {
        for (int i = 0; i < 1; i++) {
            int l6 = chunkX + randomGenerator.nextInt(16 + 8);
            int i11 = randomGenerator.nextInt(128);
            int l14 = chunkZ + randomGenerator.nextInt(16 + 8);
            (new WorldGenFlowers(((BlockFlower) mcreator_starBloom.block), BlockFlower.EnumFlowerType.DANDELION)).generate(world, randomGenerator,
                    new BlockPos(l6, i11, l14));
        }
    }

I changed the numbers 16; 8   to   32; 16  but nothing happened.

After some experimenting, i used the numbers 480; 240 and the plants are insignificantly rarer (spawn every 30 or 40 blocks). Instead it takes around !10 minutes! to spawn them in a new world, even if the world is already loaded and you can play on it. 

Is there another way to make them rarer? And what does the .nextInt(128) mean?

Last seen on 17:11, 25. Oct 2020
Joined Nov 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If you don't know code don't…
Tue, 01/15/2019 - 19:17

If you don't know code don't try to edit it. A chunk is a 16x16 area by the way