The parenthesis make it valid. The right operand of > evaluates, then it's rand > that_value. Without the parenthesis, it wouldn't be valid since Java doesn't support chained comparisons afaik.
I'm referring to how C# and some other languages do it.
Essentially you use a syntax like public String Name { get; set; }. Under the covers there is magic being done that is akin to writing a getName and setName function, but you can call the property by the property name and it automatically resolves into the getter.
Then if you need special logic for the getter or setter, you can override them with the get/set keywords and implement your logic.
Massively reduces the amount of boilerplate code bloat you see in Java.
Uh, I think it's trying to determine if the player is walking faster than a threshold, and if so, check if a random number (from 0 to 1) is more than something based on how fast they're moving. The purpose of the mod was to emulate this but as a mod rather than with (at the time) command blocks.
23
u/TheUnlocked Aug 18 '21
In plain text:
75
u/lemarkk Aug 18 '21 edited Aug 19 '21
Doesn't even look like valid Java wtf
edit: I see the parens now
13
u/SupercraftD Aug 18 '21
what is this trying to do?
35
u/Sevigor Aug 18 '21
I’ve seen/wrote ternary expressions way worse than that. Lol.
Only thing that makes this bad IMO is that it’s pretty redundant and could be refactored down
3
u/nexxai Aug 18 '21
what the FUCK
2
u/CrazedPatel Aug 18 '21
I think the worst part of Minecraft modding is the Java 6 compliance
1
u/EquivalentOne9996 Aug 19 '21
SLAP is all you need here my friend
1
u/ososalsosal Aug 19 '21
Ternaries inside if conditions is something that not even I would do.
1
u/EthanRDM Aug 19 '21
This comment might be irrelevant, but aren't some attributes not respecting the encapsulation principle ?
1
u/throwaway19572957195 Aug 19 '21
What mod is this? that was back when all i did was play modded minecraft.