Topic category: Help with modding (Java Edition)
I have coal generator procedure and I want to create progress bar. The max cpacity of generator is 16000. So I want to change range from 0 to 16000 to from 0 to 20. So I am doing this: <energy> / 16000 * 20 = <progress>.
In calculator it's working, but not in MCreator. I have this block in my procedure: https://imgur.com/a/aO8jptH. But it don't work. I always get zero in "progress" tag and it changes to 20 only if block is fully charged. I created logs in console and i know that "get energy" block gives me true value. So MCreator thinks that eg. 1000 / 16000 * 20 = 0. This result is obviously incorrect becouse true result is 1,25. I am rounding it so it's should be 1. I'm doing something wrong or MCreator's division/multiplication is strange or broken?
Divide by 16000.0, or it will be rounded to int, which is rounded to 0.
This is how Java divides numbers.
So how I can do what I want?
He literally said divide by 16000.0
Oh, sorry i don't saw this 0 in the end.