PneumaticCraft: Repressurized

PneumaticCraft: Repressurized

43M Downloads

Coordinate Operator deviding problems (maybe iam just stupid)

gamelnderGamler opened this issue ยท 5 comments

commented

For feature requests, just erase this template and clearly describe the feature you'd like to see

Minecraft Version

1.12.2

Mod Version

1.12.2-0.9.1-317

Describe your problem, including steps to reproduce it

Hi,

the description of the coordinate operation piece out of the ingame wiki mod tells me qote:"Multiplies the pieces connected to the right. Divides the result by the pieces on the left".

So i made this Programm:
1
(https://pastebin.com/8Sw3D6T9)

As far as i understand, i multiply the 10 height with 1 so it should still be 10. After that i devide it by 2. so the variable "height1" should be 5?
So if i add the 5 height to the 86 height it should be at 91 height?

But i get this result: (iam using a programmable controller filled with stones to execute the programms)

2

(The drone places to blocks. One at height 96 and one at height 95)

The controller placed the block at height 96 first, after that it placed the block at 95 aswell. i guess after the "second loop".

After i changed my programm to this:
3
(https://pastebin.com/YhC7FJmf)
(i devide by 1:2:1 now not by 0:2:0)

i get this result:
4
(The drone placed a block at height 91 and a block at height 90)

again it placed the block at the height 91 first. after that it also placed a block at height 90.

So this time it was more or less the right height after the first loop. but 1 block to much.

I dont know if i do something wrong or something is not working correct.
So iam sorry if i did something wrong again :/

Any other comments?

(if you do this:
5

you get also kinda strange results)

I also have a question to this. If i divide a coordinate and i get a 2.4 and i use this as a coordinate to place things, will the controller round this down to 2?

commented

I'll have to do some testing on this and get back to you. I haven't played too much with the coord arithmetic operators other than basic addition so it's possible there are problems...

Update: quick check of the source verifies that division will not work if any of the X/Y/Z coords are 0. So dividing by (0,2,0) will do nothing at all, but dividing by (1,2,1) is OK. https://github.com/TeamPneumatic/pnc-repressurized/blob/master/src/main/java/me/desht/pneumaticcraft/common/progwidgets/ProgWidgetCoordinateOperator.java#L106

Regarding the "one block too much" problem, what exactly is in the Area piece connected to the Right-Click piece? Also,for placing blocks, I'd recommend using the Place Block piece rather than the Right-Click piece (Right-Click can have some unexpected effects if you use to place blocks).

Finally, all coordinates are treated as integers, so any division uses integer arithmetic, e.g. 91/2 = 45.

commented

Wow, yeah i normaly use the "place block piece", but i was to much into testing, that i didnt even realize that iam using the wrong piece...
Only for enderIO conduits you have to use the "right click piece".
Iam really sorry. I figured out that i have to divide by 1,2,1 but i got so confused by the second block...
But it all makes sense with the "right click piece".
Sorry for wasting your time and thanks for the help!

commented

No problem :)

commented

Actually, going to leave this open; I'll add an error in the programmer GUI if any divide by 0 attempt is made (i.e. coordinate with a 0 found on the left of a mul/div operator piece).

commented

Fixed in 0.9.3 release.