Mojira Archive
MC-178723

Fishing rod bobbers don't activate a target if shot on the very edge

The Bug

Fishing rod bobbers usually activate targets, but if the bobber is shot on the very edge of the target, no signal is output.

Steps to Reproduce

  • Align yourself at the center of a block and summon both a redstone lamp and target block.
    /execute align xyz run tp @s ~0.5 ~ ~0.5
    /setblock ~ ~ ~3 minecraft:target
    /setblock ~ ~1 ~3 minecraft:redstone_lamp
    
  • Obtain a fishing rod and angle yourself perfectly.
    /tp @s ~ ~ ~ -12 21
    
  • Throw the fishing bobber.
  • Take note as to whether or not fishing bobbers activate target blocks when making contact with their very edges.

Observed Behavior

Fishing bobbers don't activate target blocks when making contact with their very edges.

Expected Behavior

Fishing bobbers would activate target blocks when making contact with their very edges.

Code Analysis

[Mod] Chandler, Using Yarn mappings, 22w11a

The problem here is that a raycast is created at the position of the fishing bobber at the method net.minecraft.entity.projectile.ProjectileUtil#getCollision(). This raycast is pointed in the direction of the bobber and is used to get the collision on the block. However, because the bobber is slightly larger than other projectiles, this raycast actually misses the block when the bobber hits the edge of the target block because the raycast starts at the center of the bobber. This is likely also the cause of MC-199197.