Help with code for random number of items dropped from a block

Started by Super_m on

Topic category: Advanced modding

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with code for random number of items dropped from a block

I need code for random amount of items dropped from block when it's broken. I tried creating a procedure for that, but after many failed attempts I gave up.

I know there are quite a few forum topics answearing this question, but I think they are all outdated.

If anyone could give me tips or point me out to up-to-date guide I would very much appricate it.

Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try to use Repeat function…
Mon, 09/17/2018 - 15:14

Try to use Repeat function and put inside it Repeat Random 0,1 times
if not than make local variable that will be set to random and place in repeat function block that will take number from this variable

 

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
cool idea, only problem is…
Mon, 09/17/2018 - 15:21

cool idea, only problem is there is no way for me to give item to the player. Maybe there's a way I overlooked?

Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use Spawn Gem
Mon, 09/17/2018 - 16:43

Use Spawn Gem

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that for some reason works…
Mon, 09/17/2018 - 20:48

that for some reason works twice

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Probably make it so that the…
Wed, 09/19/2018 - 05:04

Probably make it so that the block itself doesn't break into anything (or breaks into air) in the block properties if you're also going to use the Spawn Gem event.

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You have to override…
Sun, 10/14/2018 - 15:21

You have to override quantityDropped, set you max and min amount of drops and use the rand function

Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My type of code (the way my…
Tue, 11/20/2018 - 21:52

My type of code (the way my mod's code was before the rewriting) somehow just spammed the player's inventory with diamonds for no reason, well unless the reason is moving a few blocks at all, that might be it, because that's exactly what it seems like to me in-game!