MathHelper
About
This is my first plugin, but I have a small background with modding the singleplayer environment. And, along with this being my first server mod, it is my first post on Bukkit Dev, so there may be some graphical errors on this page, and some incomplete things.
Uses/Commands
The usage is simple: Use it to add, subtract, multiply, and divide from in-game. You may use it just because your too lazy (you are a gamer) to go get a calculator, or you don't want to go out of full screen to get a built in calculator up, or you just want to use this. The commands are even simpler:
- /a <number> <number> - The first and second number are added together. - Permission: MathHelper.add
- /s <number> <number> - The second number is subtracted from the first number. BUG: When making the first number larger, the result will not appear negative! This is do to the fact that MathHelper in singleplayer code is not used to display numbers in-game, but in the code. - Permission: MathHelper.sub
- /m <number> <number> - The numbers are multiplied. - Permission: MathHelper.multi
- /d <number> <number> - The first number is divided into the number of parts the second number is. BUG: When making the first number smaller, it will not display as a decimal, but 0. Sorry, I will work on this. - Permission: MathHelper.div That is all the commands.
Support
Supporting me is very simple. I do not take donations, but I do encourage you to tell people about this plugin, and help me get more ideas into it.
@Jnorr44 I have read somewhere that in Java, not ints, nor Doubles, nor Floats can use decimals. It is mostly because of the bits converting to binary before going back to plain numbers. The system approximates it with 0, or, if you do /a 0.5 6 it would turn up 6. Though, I have set up negative numbers using doubles, so thanks for telling me about Doubles. I actually didn't think they would be able to do negatives. Uploading this patch tomorrow.
@wacossusca34 Measuring one block from another? Not sure how you mean, there. But thank you. I am also looking for some suggestion on other plugins I could do.
I guess this could proove useful while doing large edits in minecraft where you have to calculate a few numbers, but you would use the plugin so infrequently that it's not even worth installing.
However, on the positive side, you could implement a ruler function - measuring one block from another. It would be much harder than programming basic math functions, but it would make this plugin much more useful, especially when doing larger builds.
Nice job!
@Jnorr44
Ah! That makes more sense! So I use MathHelper.a(int + int) How would I make them doubles, as it says something along the lines of MathHelper.a(Integer.valueOf(args[0]) + Integer.valueOf(args[1])); I'm guessing I put it as Double.valueOf()? If that exists. Also, I'm guessing Doubles can have negatives, too?
For the division bug, make sure when they are putting in the numbers, you get them as a double, because integers cannot have decimals.