Creating a Random Number of items.

Started by FoggyRoad on

Topic category: Help with modding (Java Edition)

Last seen on 21:10, 6. Apr 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Creating a Random Number of items.

I'm trying to make a Blue Berry Bush and I want it to drop a random amount of Berry's but everything I looked up doesn't explain it, Or I'm just a little dumb lol.

Last seen on 17:02, 24. Jan 2021
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use the math "random(0,1)"…
Thu, 04/02/2020 - 19:24

Use the math "random(0,1)" to give you a random number between 0,1. Use X 10 to make it 1-10, X5 = 1-5 etc.

So you use that with spawn gem (maybe repeat a loop the random number of times) to drop the items

So to drop 5 berries:

Repeat Random(0,1)*5

Spawn gem "Berry"

 

Last seen on 15:16, 24. Dec 2022
Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
where is spawn gem ?  
Mon, 05/11/2020 - 19:28

where is spawn gem ?