Mobs that are immune to freezing and infested through datapacks will only be immune to infested.
To reproduce:
Enable the attached datapack, adding chickens to the
#immune_to_freezingand#immune_to_infestedentity type tags.Spawn a chicken
Splash the chicken with Freezing
Wait
Note that the chicken does not take freezing damage as expected
Code analysis:
LivingEntity.class
public boolean canBeAffected(MobEffectInstance newEffect) {
if (getType().is(EntityTypeTags.IMMUNE_TO_INFESTED)) {
return !newEffect.is(MobEffects.INFESTED);
} else if (getType().is(EntityTypeTags.FREEZE_IMMUNE_ENTITY_TYPES)) {
return !newEffect.is(MobEffects.FREEZING);
} else if (getType().is(EntityTypeTags.IMMUNE_TO_OOZING)) {
return !newEffect.is(MobEffects.OOZING);
} else if (getType().is(EntityTypeTags.IGNORES_POISON_AND_REGEN)) {
return !newEffect.is(MobEffects.REGENERATION) && !mobEffectInstance.is(MobEffects.POISON);
} else {
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.
Thank you for helping us improve Minecraft! We saved your files: