mojira.dev
MC-270793

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

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.

Attachments

Comments 0

No comments.

Tis_awesomeness

(Unassigned)

1222733

Confirmed

Expansion B

Normal

Data Packs

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.21.4 Pre-Release 3, 1.21.4, 25w03a, 25w05a, 25w33a

Retrieved