package jas.spawner.legacy.spawner.creature.handler.parsing.keys;

import jas.common.JASLog;
import jas.spawner.legacy.spawner.creature.handler.parsing.ParsingHelper;
import jas.spawner.legacy.spawner.creature.handler.parsing.TypeValuePair;
import jas.spawner.legacy.spawner.creature.handler.parsing.settings.OptionalSettings.Operand;

import java.util.ArrayList;
import java.util.HashMap;

import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;

public class KeyParserMaxSpawnRange extends KeyParserBase {

    public KeyParserMaxSpawnRange(Key key) {
        super(key, false, KeyType.VALUE);
    }

    @Override
    public boolean parseChainable(String parseable, ArrayList<TypeValuePair> parsedChainable,
            ArrayList<Operand> operandvalue) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean parseValue(String parseable, HashMap<String, Object> valueCache) {
        String[] pieces = parseable.split(",");
        if (pieces.length == 2) {
            valueCache.put(Key.maxSpawnRange.key,
                    ParsingHelper.parseFilteredInteger(pieces[1], 128, Key.maxSpawnRange.key));
            return true;
        } else {
            JASLog.log().severe("Error Parsing Needs EntityCap parameter. Invalid Argument Length.");
            return false;
        }
    }

    @Override
    public boolean isValidLocation(World world, EntityLiving entity, int xCoord, int yCoord, int zCoord,
            TypeValuePair typeValuePair, HashMap<String, Object> valueCache) {
        throw new UnsupportedOperationException();
    }
}