Strange division in MCreator

Started by kamik1979 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Strange division in MCreator

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?

Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So how I can do what I want?
Tue, 11/17/2020 - 17:15

So how I can do what I want?

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
He literally said divide by…
Tue, 11/17/2020 - 18:02

He literally said divide by 16000.0

Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, sorry i don't saw this 0…
Wed, 11/18/2020 - 09:49

Oh, sorry i don't saw this 0 in the end.

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Klemen's solution does not…
Sat, 11/30/2024 - 06:19

Klemen's solution does not work for me.

 

I am attempting to divide the value of a gamerule by 100 to determine a percentage. With Klemen's solution, I should just have to change the number to 100.0, but if I try to add the .0 to the end of the number, it reverts to 100. It does not allow me to put 100.0. I also tried 16000.0 from the specific example above and that didn't work either.

 

How do I solve this in 2024.3?

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've managed to find a…
Sat, 11/30/2024 - 07:00

I've managed to find a temporary solution by locking the procedure's code and changing the value in the code, but I need a long-term solution that isn't going to require me to lock the procedure.