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

Mobs cannot be immune to oozing and infested at the same time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.5 Pre-Release 2, 1.20.5 Pre-Release 3, 1.20.5 Pre-Release 4, 1.20.5 Release Candidate 1, 1.20.5 Release Candidate 2, 1.20.5, 1.20.6, 24w18a, 24w19b, 24w21b, 1.21 Pre-Release 1, 1.21 Pre-Release 2, 1.21 Pre-Release 4, 1.21, 24w33a, 1.21.1 Release Candidate 1, 1.21.1, 24w37a, 24w38a, 24w39a, 1.21.2 Pre-Release 2, 1.21.2 Pre-Release 3, 1.21.2 Release Candidate 1, 1.21.2 Release Candidate 2, 1.21.2, 1.21.3, 24w46a, 1.21.4 Pre-Release 2, 1.21.4 Pre-Release 3, 1.21.4
    • None
    • Confirmed
    • Data Packs
    • Normal
    • 1222733
    • Expansion B

      Mobs that are immune to oozing and infested through datapacks will only be immune to infested.

      To reproduce:

      1. Enable the attached datapack, adding chickens to the #immune_to_oozing and #immune_to_infested entity type tags.
      2. Spawn a chicken
      3. Splash the chicken with Oozing
      4. Kill the chicken
      5. Note that slimes spawn even though chickens are immune to Oozing through the datapack

      Code analysis:

      LivingEntity.class
      
      public boolean canBeAffected(MobEffectInstance mobEffectInstance) {
          if (getType().is(EntityTypeTags.IMMUNE_TO_INFESTED)) {
              return !mobEffectInstance.is(MobEffects.INFESTED);
          }
          if (getType().is(EntityTypeTags.IMMUNE_TO_OOZING)) {
              return !mobEffectInstance.is(MobEffects.OOZING);
          }
          if (getType().is(EntityTypeTags.IGNORES_POISON_AND_REGEN)) {
              return !mobEffectInstance.is(MobEffects.REGENERATION) && !mobEffectInstance.is(MobEffects.POISON);
          }
          return true;
      } 

      If the entity is in the #immune_to_infested tag, the code only checks if the applied status effect is infested, and does not check whether the entity is also immune to other effects.

            Unassigned Unassigned
            Tis_awesomeness Tis_awesomeness
            Votes:
            9 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: