Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencyResolutionManagement {
}
versionCatalogs {
create("libs") {
version("schem", "1.3.1")
version("schem", "2.0.0")
version("bom", "1.5.0")

library("bom.base", "net.onelitefeather", "mycelium-bom").versionRef("bom")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package net.theevilreaper.apis.api.util;

import net.hollowcube.schem.Rotation;
import net.hollowcube.schem.Schematic;
import net.hollowcube.schem.SchematicReader;
import net.hollowcube.schem.reader.SchematicReader;
import net.hollowcube.schem.util.Rotation;
import net.minestom.server.coordinate.Point;
import net.minestom.server.instance.Instance;
import net.theevilreaper.apis.api.generator.functional.SchematicPlacement;
import org.jetbrains.annotations.NotNull;

import java.nio.file.Files;
import java.nio.file.Path;

/**
Expand All @@ -30,7 +31,13 @@ private RoomSchematicPlacement() { }
* @throws NullPointerException if instance, position, or schematicPath is null.
*/
public static void placeRoom(@NotNull Instance instance, @NotNull Point position, @NotNull Path schematicPath) {
Schematic schematic = new SchematicReader().read(schematicPath);
schematic.apply(Rotation.NONE, (point, block) -> instance.setBlock(position.add(point), block));
byte[] schematicContent = null;
try {
schematicContent = Files.readAllBytes(schematicPath);
Schematic schematic = SchematicReader.detecting().read(schematicContent);
schematic.createBatch(Rotation.NONE).apply(instance, position, () -> {});
} catch (Exception exception) {
exception.printStackTrace();
}
}
}