The bug
Allays do not check the dimension of the liked note block. If multiple dimensions have note blocks at the same coordinates, allays will deliver items to any of these.
Steps to Reproduce
Place note blocks in multiple dimensions at the same coordinates
Spawn an allay
Have it hold an item
(Optionally) run
/data modify entity @e[type=minecraft:allay,limit=1] Brain.memories.minecraft:liked_noteblock_cooldown_ticks.value set value 100000to increase cooldown for easier testingPlay the note block in one dimension
Teleport the allay to the other dimension e.g. via nether portals
Drop items and have the allay pick it up
Check whether the allay drops the items at the note block or the player
Expected Result
The allay will bring the item to the player, because the allay is linked to the note block in a different dimension.
Actual Result
The allay will drop the item at the note block.
Code Analysis
Code analysis by @unknown can be found in this comment.
Can Confirm
Code Analysis: (MojMap - 22w14a)
So this is actually quite funny. The Allay is using a GlobalPos for the position of the Noteblock, a global pos holds both a dimension & a blockpos. Although in the code, the allay never checks the dimension.
net/minecraft/world/entity/animal/allay/AllayAi.java
To fix this is pretty easy, pass the globalPos into `shouldDepositItemsAtLikedNoteblock`
Possible Fix:
net/minecraft/world/entity/animal/allay/AllayAi.java
Here we just make sure that the allay is in the same dimension as the noteblock