#BlameMojang

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Someone Else 37

Forum Addict
Feb 10, 2013
1,876
1,440
168
Reika posted a few more bits of Mojang code derpiness a while back. Here's one:
Speaking of dumb code, an example from vMC in the Block class:

Code:
public void dropBlockAsItem(World world, int x, int y, int z, int fortune) {
dropBlockAsItemWithChance(world, x, y, z, fortune, 1);
}

public void dropBlockAsItemWithChance(World world, int x, int y, int z, int fortune, float chance) {
dropBlockAsItem_do(world, x, y, z, fortune, chance);
}

private void dropBlockAsItem_do(World world, int x, int y, int z, int fortune, float chance) {
dropBlockAsItem_do_do(world, x, y, z, fortune, chance);
}

private void dropBlockAsItem_do_do(World world, int x, int y, int z, int fortune, float chance) {
<actual drop code>
}
 

RavynousHunter

New Member
Jul 29, 2019
2,784
-3
1
That probably comes from the decompiler.
I think he was referring to how this is hardcoded into the pickaxe class.

That is also horrifying. Though, I thought proper if's and ternaries compiled differently into Java bytecode...hm.
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
It's so mangled I don't want to bother trying to figure out what it means. >.>
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
Reika posted a few more bits of Mojang code derpiness a while back. Here's one:
Do not forget these. :p

Code:
public boolean equals(Object o)
{
return false;
}

Code:
switch(p_384788_2)
{
case 0:
<do stuff>
break;
case 1:
<do stuff>
break;
default:
throw new IllegalArgumentException("IN YOU FACE!");
}

Code:
try
{
<url loading code>
}
catch (MalFormedURLException ex)
{
throw new Error("TODO: Sanely handle URL Exception :D");
}
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
Oh, and who could forget the time I was asked to make a custom anvil, and found that most of the active anvil code is in the Container/GUI classes, and that it was hardcoded to the vanilla anvil block? :D
 

gold49

New Member
Jul 29, 2019
415
0
0
Oh, and who could forget the time I was asked to make a custom anvil, and found that most of the active anvil code is in the Container/GUI classes, and that it was hardcoded to the vanilla anvil block? :D

That's...just...huh?! :confused:
 

Celestialphoenix

Too Much Free Time
Nov 9, 2012
3,741
3,204
333
Tartarus.. I mean at work. Same thing really.
CoolPhoenix Team!
This is a thing now?
New icon needed.
upload_2015-5-2_23-49-54.png
 
  • Like
Reactions: gold49

PODonnell

New Member
Jul 29, 2019
876
0
0
My lawn mower won't start.........Thanks MOJANG....

Wait that's not what this thread is about?
*wanders off looking for his old train set*
 

OnyxDarkKnight

New Member
Jul 29, 2019
33
0
1
Oh, and who could forget the time I was asked to make a custom anvil, and found that most of the active anvil code is in the Container/GUI classes, and that it was hardcoded to the vanilla anvil block? :D
It's one of the many weird things about Minecraft. If I'm correct, the same thing applies to enchanting. All the code logic is in the Container/GUI classes.
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
Both Java and the JVM have issues, but they're still decent. However, once MS fully releases the cross-platform .NET runtime, I'm switching. :p
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Both Java and the JVM have issues, but they're still decent. However, once MS fully releases the cross-platform .NET runtime, I'm switching. :p
Same m8, same. C# is much better than Java, even if I'm not particular to their style of coding