Why is the "Random [0, 1)" block so inconsistent?

Started by DJSlimeball on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why is the "Random [0, 1)" block so inconsistent?

I'm using the random block to make a percent chance of your boots being damaged and you getting an item, the trigger is "on player tick update". When I do this; it constantly fluctuates the durability of the boots and how many items I have in my inventory, why is this?

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
on player tick update is per…
Sat, 04/01/2023 - 17:55

on player tick update is per tick. 1 tick is roughly 0.05s, or 20 ticks are roughly 1s. Random [0,1] picks a number between 0 and 1, so you probably want something like:

if (random[0,1] < 0.05) {
 deal 1 damage to item
}

I cannot tell you why its spawning itmes in your inventory without seeing your code

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it's supposed to give me…
Sat, 04/01/2023 - 19:21

it's supposed to give me items too, that's intentional, and my code isn't any different than that, but the amount of both damage to the item, and items it's giving me (which are intentionally being given to me) are constantly fluctuating