another way of doing that is by adding this to the entity code:
// POISON CODE
public boolean attackEntityAsMob(Entity entityIn) {
if (super.attackEntityAsMob(entityIn)) {
if (entityIn instanceof LivingEntity) {
int i = 0;
if (this.world.getDifficulty() == Difficulty.NORMAL) {
i = 7;
} else if (this.world.getDifficulty() == Difficulty.HARD) {
i = 15;
}
if (i > 0) {
((LivingEntity)entityIn).addPotionEffect(new EffectInstance(Effects.POISON, i * 20, 0));
}
}
return true;
} else {
return false;
}
}
// POISON CODE END
Use procedures and source/target entity with entity type check for this.
Then apply potion using procedure block for this.
I suggest you check our tutorials collection playlist on our YouTube channel which contains many examples and tutorials that can help you get started with MCreator: https://www.youtube.com/playlist?list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei
another way of doing that is by adding this to the entity code:
i = duration of poison (in RL seconds)