#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
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>
}
 
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.
 
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");
}
 
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
 
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:
 
CoolPhoenix Team!
This is a thing now?
New icon needed.
upload_2015-5-2_23-49-54.png
 
  • Like
Reactions: gold49
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*
 
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.
 
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
 
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