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.server.level.ServerLevel;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.entity.LivingEntity;

public class SetRaidStatus extends Behavior<LivingEntity> {
    public SetRaidStatus() {
        super(ImmutableMap.of());
    }
    
    @Override
    protected boolean checkExtraStartConditions(final ServerLevel zd, final LivingEntity aoy) {
        return zd.random.nextInt(20) == 0;
    }
    
    @Override
    protected void start(final ServerLevel zd, final LivingEntity aoy, final long long3) {
        final Brain<?> apr6 = aoy.getBrain();
        final Raid bfh7 = zd.getRaidAt(aoy.blockPosition());
        if (bfh7 != null) {
            if (!bfh7.hasFirstWaveSpawned() || bfh7.isBetweenWaves()) {
                apr6.setDefaultActivity(Activity.PRE_RAID);
                apr6.setActiveActivityIfPossible(Activity.PRE_RAID);
            }
            else {
                apr6.setDefaultActivity(Activity.RAID);
                apr6.setActiveActivityIfPossible(Activity.RAID);
            }
        }
    }
}
