Search in sources :

Example 1 with MergedBiomesPackage

use of me.superckl.api.biometweaker.script.pack.MergedBiomesPackage in project BiomeTweaker by superckl.

the class AllButPackParameterWrapper method parseArgs.

@Override
public Pair<AllButBiomesPackage[], String[]> parseArgs(final ScriptHandler handler, final String... args) throws Exception {
    final List<BiomePackage> parsed = new ArrayList<>();
    String[] toReturn = new String[0];
    for (int i = 0; i < args.length; i++) {
        final BiomePackage obj = BTParameterTypes.BASIC_BIOMES_PACKAGE.tryParse(args[i], handler);
        if (obj == null) {
            toReturn = new String[args.length - i];
            System.arraycopy(args, i, toReturn, 0, toReturn.length);
            break;
        }
        parsed.add(obj);
    }
    return Pair.of(new AllButBiomesPackage[] { new AllButBiomesPackage(new MergedBiomesPackage(parsed.toArray(new BiomePackage[parsed.size()]))) }, toReturn);
}
Also used : AllButBiomesPackage(me.superckl.api.biometweaker.script.pack.AllButBiomesPackage) ArrayList(java.util.ArrayList) MergedBiomesPackage(me.superckl.api.biometweaker.script.pack.MergedBiomesPackage) BiomePackage(me.superckl.api.biometweaker.script.pack.BiomePackage)

Example 2 with MergedBiomesPackage

use of me.superckl.api.biometweaker.script.pack.MergedBiomesPackage in project BiomeTweaker by superckl.

the class SubtractPackParameterWrapper method parseArgs.

@Override
public Pair<SubtractBiomesPackage[], String[]> parseArgs(final ScriptHandler handler, final String... args) throws Exception {
    if (args.length < 2)
        throw new IllegalArgumentException("Must have at least two biome object arguments for subtract operation!");
    final List<BiomePackage> parsed = new ArrayList<>();
    final BiomePackage main = BTParameterTypes.BASIC_BIOMES_PACKAGE.tryParse(args[0], handler);
    if (main == null)
        throw new IllegalArgumentException("Must have at least two biome object arguments for subtract operation!");
    String[] toReturn = new String[0];
    for (int i = 1; i < args.length; i++) {
        final BiomePackage obj = BTParameterTypes.BASIC_BIOMES_PACKAGE.tryParse(args[i], handler);
        if (obj == null) {
            toReturn = new String[args.length - i];
            System.arraycopy(args, i, toReturn, 0, toReturn.length);
            break;
        }
        parsed.add(obj);
    }
    return Pair.of(new SubtractBiomesPackage[] { new SubtractBiomesPackage(main, new MergedBiomesPackage(parsed.toArray(new BiomePackage[parsed.size()]))) }, toReturn);
}
Also used : SubtractBiomesPackage(me.superckl.api.biometweaker.script.pack.SubtractBiomesPackage) ArrayList(java.util.ArrayList) MergedBiomesPackage(me.superckl.api.biometweaker.script.pack.MergedBiomesPackage) BiomePackage(me.superckl.api.biometweaker.script.pack.BiomePackage)

Aggregations

ArrayList (java.util.ArrayList)2 BiomePackage (me.superckl.api.biometweaker.script.pack.BiomePackage)2 MergedBiomesPackage (me.superckl.api.biometweaker.script.pack.MergedBiomesPackage)2 AllButBiomesPackage (me.superckl.api.biometweaker.script.pack.AllButBiomesPackage)1 SubtractBiomesPackage (me.superckl.api.biometweaker.script.pack.SubtractBiomesPackage)1