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

Snow golems attack creepers

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • Minecraft 1.8, Minecraft 1.8.8, Minecraft 15w43a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.4, Minecraft 16w21a, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12 Pre-Release 2, Minecraft 1.12.2, Minecraft 18w16a, Minecraft 1.13, Minecraft 18w30b, Minecraft 1.13.2, Minecraft 18w43b, Minecraft 18w43c, Minecraft 18w44a, Minecraft 18w45a, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w08b, Minecraft 19w09a, 1.14.4, 19w34a, 19w44a, 1.15 Pre-release 1, 1.15.2, 20w12a, 20w13b, 20w15a, 20w17a, 20w19a, 20w20b, 20w21a, 20w22a, 1.16 Pre-release 3, 1.16 Pre-release 5, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 2, 20w46a, 20w48a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b, 21w11a, 21w17a, 21w20a, 1.17 Pre-release 1, 1.17 Pre-release 3, 1.17 Pre-release 4, 1.17 Pre-release 5, 1.17 Release Candidate 1, 1.17 Release Candidate 2, 1.17, 1.17.1 Pre-release 1, 1.17.1 Pre-release 2, 1.17.1 Pre-release 3, 1.17.1 Release Candidate 1, 1.17.1 Release Candidate 2, 1.17.1, 21w38a, 21w39a, 21w40a, 21w41a, 21w42a, 21w43a, 21w44a, 1.18 Pre-release 1, 1.18 Pre-release 7, 1.18, 1.18.1, 22w03a, 22w05a, 22w06a, 22w07a, 1.18.2 Release Candidate 1, 1.18.2, 22w12a, 22w14a, 22w17a, 22w18a, 1.19, 1.19.1, 1.19.2
    • None
    • None
    • Confirmed
    • Mob behaviour
    • Normal

    Description

      The Bug:

      Snow golems attack creepers.

      Steps to Reproduce:

      • Summon a snow golem and a creeper.
      • /summon minecraft:snow_golem ~ ~ ~
        /summon minecraft:creeper ~ ~ ~
      • Wait around ten seconds or so for the snow golem to notice the creeper.
      • Take note as to whether or not snow golems attack creepers.

      Observed Behavior:

      Snow golems attack creepers.

      Expected Behavior:

      Snow golems would not be able to attack creepers.

      Code Analysis:

      Code analysis by Avoma can be found below.

      The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.

      net.minecraft.world.entity.animal.SnowGolem.java
      public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackMob {
         ...
         public void performRangedAttack(LivingEntity $le, float $f) {
            Snowball snowball = new Snowball(this.level, this);
            double d0 = $le.getEyeY() - (double)1.1F;
            double d1 = $le.getX() - this.getX();
            double d2 = d0 - snowball.getY();
            double d3 = $le.getZ() - this.getZ();
            double d4 = Math.sqrt(d1 * d1 + d3 * d3) * (double)0.2F;
            snowball.shoot(d1, d2 + d4, d3, 1.6F, 12.0F);
            this.playSound(SoundEvents.SNOW_GOLEM_SHOOT, 1.0F, 0.4F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
            this.level.addFreshEntity(snowball);
         }
         ...

      If we look at the above class, we can see that no checks are carried out to see what hostile entity snow golems should and should not be able to attack. Because of this, they can perform ranged attacks on creepers, resulting in this issue occurring.

      Attachments

        1. 2014-11-02_16.18.37.png
          2014-11-02_16.18.37.png
          99 kB
        2. 2014-11-02_16.31.41.png
          2014-11-02_16.31.41.png
          225 kB
        3. 2014-11-02_16.32.48.png
          2014-11-02_16.32.48.png
          236 kB
        4. 2015-09-02_15.53.36.png
          2015-09-02_15.53.36.png
          453 kB
        5. MC-73964.mp4
          4.24 MB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Avoma Avoma
              Votes:
              51 Vote for this issue
              Watchers:
              22 Start watching this issue

              Dates

                Created:
                Updated:
                CHK: