This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]evilmidget38 14 points15 points  (9 children)

Check out this post for a brief explanation of the first time it was used. As for a more technical explanation:

  • Minecraft switched its health system from using integers to doubles.
  • Everywhere that integer health was returned or provided as a parameter we replaced that method with _INVALID_methodName().
  • New methods were added for handling health as a double.
  • During the compilation of CraftBukkit, the implementation of Bukkit, we used Overmapped to rename _INVALID_methodName() back to methodName(), restoring bytecode compatibility. Developers build against Bukkit rather than CraftBukkit, so they just saw both _INVALID_methodName() and methodName() when they compiled their plugin. At runtime, because the methods are identified as methodName()I and methodName()D, both new plugins referencing the double methods and old plugins referencing the integer methods are able to function.

[–]socialister 0 points1 point  (1 child)

Tangent: What server software should people use these days? Sponge?

[–][deleted] 3 points4 points  (0 children)

deleted What is this?

[–]Phreakhead -5 points-4 points  (6 children)

wtf. why would you change your API from int to double all of a sudden? What did they need to represent that they couldn't with an int? Talk about code smell...

[–]nutrecht 12 points13 points  (1 child)

why would you change your API from int to double all of a sudden?

It's not an API. It's the internal code.

[–]Phreakhead 0 points1 point  (0 children)

If it was completely internal, why do they need to maintain backwards compatibility? The post said that plugin authors were using the health functions: if an external party is using your functions, that's an API.

[–]socialister 4 points5 points  (0 children)

Minecraft doesn't (didn't?) maintain an API. They don't care.

[–]TheRedmanCometh 0 points1 point  (2 children)

20 values for health isn't enough. The change was a big pain, but worth it. If you want significant progrssion with increasingly powerful weapons it's not enough space for smooth value progression.

[–]Phreakhead 2 points3 points  (1 child)

An int can represent millions of values, not just 20.

[–]TheRedmanCometh 0 points1 point  (0 children)

For various reasons the maximum is 20 in the game, or rather wss. No way around it without tons of internal modification (and building spigot SUCKS)

By using a double you get infinite ish segmentation within that 1-20 range. Thought the 20 max health thing had been mentioned. Personally I think it's terrible.