Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-47699

Blazes are able to see a player through blocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 14w06b, Minecraft 14w20b, Minecraft 14w21b, Minecraft 14w27b, Minecraft 14w28a, Minecraft 14w29b, Minecraft 14w31a, Minecraft 14w32d, Minecraft 1.8, Minecraft 1.8.4, Minecraft 15w50a, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w05a, Minecraft 18w06a, Minecraft 18w08b, Minecraft 18w11a, Minecraft 18w14a, Minecraft 18w14b, Minecraft 18w16a, Minecraft 18w21a, Minecraft 18w22c, Minecraft 1.13-pre2, Minecraft 1.13, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w50a, Minecraft 19w09a, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 5, Minecraft 1.14, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3 Pre-Release 2
    • None
    • Confirmed
    • Survival
    • Mob behaviour
    • Important

      The bug

      When the player attacks a blaze, nearby blazes behind solid walls will turn hostile and shoot at the player as if the wall wasn't there. Those blazes also continue to attack when the player has switched to Creative mode, whereas all blazes that initially had line-of-sight to the player will stop attacking.

      Code analysis

      The following analysis is based on a decompiled version of Minecraft using MCP 9.40pre-1 with MC 1.12.2 mappings (guide by Pokechu22 here)

      As per net.minecraft.entity.monster.EntityBlaze.initEntityAI(), a blaze's entityCallsForHelp boolean in the net.minecraft.entity.ai.EntityAIHurtByTarget class is always set to true, which means that it will alert other blaze entities within its followRange as soon as it gets attacked. The method which is called when a blaze wants to alert their fellow blazes is net.minecraft.entity.ai.EntityAIHurtByTarget.alertOthers().

      This method, however, does not check if there are any blocks in between the attacking entity and the alerted blaze. So, I quickly made a hacky for-loop to check if there are any blocks other than air in between the entities' coordinates. Albeit I absolutely do not recommend to use this code as it is wacky as hell and does not consider all blocks within the view of the alerted blaze, it does a decent job in showing what the issue is – so I'll post it here anyway if anyone wants to test this.

            Excited Maria Lemón
            Sonicwave [Mod] Sonicwave
            Votes:
            137 Vote for this issue
            Watchers:
            42 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: