I need it so that everytime a specific mob spawns (ex. valarian_conquest:valarian_villager) I need to be replaced with another mob (in this instance mca:male_villager) heres my same code (doesnt work)
entity.onSpawned(event => {
const entity = event.getEntity();
const level = event.getLevel();
// Check if the spawned entity is a zombie
if (entity.getType().equals('valarian_conquest:valarian_villager')) {
// Cancel the original zombie's spawn
event.cancel();
// Spawn a skeleton at the same location
level.addEntity('mca:male_villager', entity.getX(), entity.getY(), entity.getZ());
console.log('did it work?????');
}
});