Brickadia savefile reader/writer for Java
make all bricks in a save the default colorset's orange color
SaveData brickadiaCity = BRS.readSave("example_saves/BrickadiaCityQA.brs");
for (Brick brick : brickadiaCity.getBricks())
brick.setColor(ColorMode.ORANGE);
BRS.writeSave("example_saves/OrangeCity.brs", brickadiaCity);
add your own screenshot to a save
SaveData brickadiaCity = BRS.readSave("example_saves/BrickadiaCityQA.brs");
brickadiaCity.setScreenshot(ImageIO.read(new File("custom_screenshot.png")));
BRS.writeSave("example_saves/CustomScreenshot.brs", brickadiaCity);
create your own save from scratch
SaveData save = new SaveData();
save.setDescription("My very own save!");
save.setBrickAssets(List.of("PB_DefaultBrick"));
// Add a brick to the save
Brick b = new Brick();
b.setSize(new Vec3(5, 5, 6));
b.setPosition(new Vec3(0, 0, 6));
save.getBricks().add(b);
BRS.writeSave("brick.brs", save);
Replace Tag with most recent tag or commit hash in repo
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.brickadia-community</groupId>
<artifactId>brs-java</artifactId>
<version>Tag</version>
</dependency>
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.brickadia-community:brs-java:Tag'
}