package net.minecraft.world.entity.ai.behavior;

import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.npc.VillagerData;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.server.level.ServerLevel;
import java.util.Map;
import net.minecraft.core.GlobalPos;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.entity.ai.memory.MemoryStatus;
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.npc.Villager;

public class ResetProfession extends Behavior<Villager> {
    public ResetProfession() {
        super(ImmutableMap.<MemoryModuleType<GlobalPos>, MemoryStatus>of(MemoryModuleType.JOB_SITE, MemoryStatus.VALUE_ABSENT));
    }
    
    @Override
    protected boolean checkExtraStartConditions(final ServerLevel xd, final Villager axw) {
        final VillagerData axx4 = axw.getVillagerData();
        return axx4.getProfession() != VillagerProfession.NONE && axx4.getProfession() != VillagerProfession.NITWIT && axw.getVillagerXp() == 0 && axx4.getLevel() <= 1;
    }
    
    @Override
    protected void start(final ServerLevel xd, final Villager axw, final long long3) {
        axw.setVillagerData(axw.getVillagerData().setProfession(VillagerProfession.NONE));
        axw.refreshBrain(xd);
    }
}
