New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Platform Random, use Level Random wherever applicable #7685
Conversation
@@ -359,7 +358,8 @@ public boolean addHitEffects(BlockState state, Level level, HitResult target, | |||
CableBusRenderState renderState = cb.getRenderState(); | |||
|
|||
// Spawn a particle for one of the particle textures | |||
TextureAtlasSprite texture = Platform.pickRandom(cableBusModel.getParticleTextures(renderState)); | |||
var textures = cableBusModel.getParticleTextures(renderState); | |||
var texture = textures.get(level.getRandom().nextInt(textures.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably keep a util-method in Platform, but make it take the random source.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might work, though I figured it was probably worth just stripping that away altogether since the only place that method was used is in this class.
@@ -246,7 +246,7 @@ public void breakCluster() { | |||
} | |||
|
|||
for (var entry : inv.list) { | |||
var position = places.get(Platform.getRandomInt() % places.size()); | |||
var position = places.get(Math.abs(level.getRandom().nextInt()) % places.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably also a place for randomly chosing an element (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd be right. That method could probably be brought back, then.
Closes #7684.