mojira.dev
MC-300859

the center of the blocks the copper golem is standing on is not compared with the center of the chests

Background:

The center of the block a golem is standing is what is used in the function BlockPos.distToCenterSqr in the TransportItemsBetweenContainers.getTargetBlockPosition to compare against (blockPos.getX(), blockPos.getY(), blockPos.getZ()), however (blockPos.getX(), blockPos.getY() and blockPos.getZ()) is not the center of the block but rather the edge. This leads to unexpected, directional behaviour of copper golems. The correct snippet would be:

.min(Comparator.comparing(transportItemTarget -> transportItemTarget.pos.distToCenterSqr(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5)));

Reproduce:

spawn a golem into the structure block file that I shared here. Then, rotate the structure by 180 degree and repeat.

What happens:
The golem doesn’t pick the chest right below it, but rather the one after.

Expected result:
the golem picks the closest chest

Attachments

Comments 1

I forget to mention what happens after the rotation: everything works as expected, namely the copper golem chooses to open the closest chest.

GuiTaek

(Unassigned)

Unconfirmed

(Unassigned)

25w32a

Retrieved