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

import net.minecraft.world.entity.raid.Raid;
import net.minecraft.world.entity.ai.Brain;
import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.entity.Entity;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.entity.LivingEntity;

public class ResetRaidStatus extends Behavior<LivingEntity> {
    public ResetRaidStatus() {
        super(ImmutableMap.of());
    }
    
    @Override
    protected boolean checkExtraStartConditions(final ServerLevel xd, final LivingEntity akz) {
        return xd.random.nextInt(20) == 0;
    }
    
    @Override
    protected void start(final ServerLevel xd, final LivingEntity akz, final long long3) {
        final Brain<?> alp6 = akz.getBrain();
        final Raid azn7 = xd.getRaidAt(new BlockPos(akz));
        if (azn7 == null || azn7.isStopped() || azn7.isLoss()) {
            alp6.setDefaultActivity(Activity.IDLE);
            alp6.updateActivity(xd.getDayTime(), xd.getGameTime());
        }
    }
}
