Search in sources :

Example 1 with ConfigNumberList

use of simplelibrary.config2.ConfigNumberList in project nc-reactor-generator by ThizThizzyDizzy.

the class NCPFExporter method saveReactor.

private static void saveReactor(Reactor reactor, FileOutputStream stream) {
    Config react = Config.newConfig();
    react.set("id", 1);
    ConfigNumberList size = new ConfigNumberList();
    size.add((byte) reactor.x);
    size.add((byte) reactor.y);
    size.add((byte) reactor.z);
    react.set("size", size);
    boolean compact = reactor.getEmptySpace() < .25;
    react.set("compact", compact);
    ConfigNumberList blocks = new ConfigNumberList();
    ConfigNumberList fuels = new ConfigNumberList();
    ConfigNumberList sources = new ConfigNumberList();
    ConfigNumberList irradiatorRecipes = new ConfigNumberList();
    for (int x = 0; x < reactor.x; x++) {
        for (int y = 0; y < reactor.x; y++) {
            for (int z = 0; z < reactor.x; z++) {
                ReactorPart part = reactor.parts[x][y][z];
                if (part instanceof FuelCell) {
                    sources.add((byte) ReactorPart.GROUP_CELLS.indexOf(part));
                    fuels.add((byte) (Fuel.fuels.indexOf(reactor.fuel[x][y][z]) * 4 + reactor.fuelType[x][y][z].ordinal()));
                    part = ReactorPart.FUEL_CELL;
                }
                if (part instanceof Irradiator) {
                    irradiatorRecipes.add((byte) 0);
                }
                if (!compact) {
                    blocks.add((byte) x);
                    blocks.add((byte) y);
                    blocks.add((byte) z);
                }
                blocks.add((byte) (ReactorPart.parts.indexOf(part) + 1));
            }
        }
    }
    react.set("blocks", blocks);
    react.set("fuels", fuels);
    react.set("sources", sources);
    react.set("irradiatorRecipes", irradiatorRecipes);
    react.save(stream);
}
Also used : Config(simplelibrary.config2.Config) ConfigNumberList(simplelibrary.config2.ConfigNumberList)

Example 2 with ConfigNumberList

use of simplelibrary.config2.ConfigNumberList in project nc-reactor-generator by ThizThizzyDizzy.

the class NCPFExporter method saveReactor.

private static void saveReactor(Reactor reactor, FileOutputStream stream) {
    Config react = Config.newConfig();
    react.set("id", 0);
    ConfigNumberList size = new ConfigNumberList();
    size.add((byte) reactor.x);
    size.add((byte) reactor.y);
    size.add((byte) reactor.z);
    react.set("size", size);
    boolean compact = reactor.getEmptySpace() < .25;
    react.set("compact", compact);
    react.set("fuel", Fuel.fuels.indexOf(reactor.fuel));
    ConfigNumberList blocks = new ConfigNumberList();
    for (int x = 0; x < reactor.x; x++) {
        for (int y = 0; y < reactor.x; y++) {
            for (int z = 0; z < reactor.x; z++) {
                if (!compact) {
                    blocks.add((byte) x);
                    blocks.add((byte) y);
                    blocks.add((byte) z);
                }
                blocks.add((byte) (ReactorPart.parts.indexOf(reactor.parts[x][y][z]) + 1));
            }
        }
    }
    react.set("blocks", blocks);
    react.save(stream);
}
Also used : Config(simplelibrary.config2.Config) ConfigNumberList(simplelibrary.config2.ConfigNumberList)

Aggregations

Config (simplelibrary.config2.Config)2 ConfigNumberList (simplelibrary.config2.ConfigNumberList)2