Blue Power

Blue Power

4M Downloads

BlueElectricCable onBlockPlacedBy neighbor pos values possible wrong

zaped212 opened this issue ยท 3 comments

commented

What were you doing when the issue happened?

While investigating behavior when blocks are added, I noticed BlueElectricCable's onBlockPlacedBy function was calculating odd values for the neighbor pos.

When placing a block at 0 : 56 : 0 I see neighbors being calculated at:
0 : 55 : -1
1 : 55 : 0
0 : 55 : 1
-1 : 55 : 0
0 : 56 : 0
0 : 54 : 0

It seems to be calculating neighbor position values for the block underneath it. causing it to call "neighborChanged" on itself.

What did you expect to happen?

I expected to see the neighborChanged function called on each of the 6 neighbors of the placed block.

It may just be a missunderstanding on my part it just seems odd that it would update itself.

What happened instead

Full Log and Crashlog on pastebin/gist

Forge and Minecraft version

Minecraft 1.15.2

Bluepower version and build number

Tips of master branch.

commented

Changing the way this works anyhow, just ironing out a few bugs in the multipart.

commented

As these are intended to be used as a multipart is quite complex, there are quite a few areas I am checking for a connection, so obviously each side of the block itself then each downward diagonal from the block itself, and each side of the block itself if it is a multipart.

test

Has been a while since I've looked into so I could have had some flawed logic in there somewhere.

commented

Yeah I can see where multipart can be very complex.
The part that seems very weird / wrong is that it triggers a "neighbor changed" on itself.

Ahh I wonder if it "must" call it on its own block pos to update any of the other multiparts that share the same position.