Skip to content

Commit ab7916c

Browse files
committed
Error when unsupported litematica
1 parent 23d34e0 commit ab7916c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common/src/main/kotlin/com/lambda/util/extension/Structures.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ private fun StructureTemplate.readSpongeV3OrException(
159159
fun StructureTemplate.readLitematicaOrException(
160160
lookup: RegistryEntryLookup<Block>,
161161
nbt: NbtCompound,
162+
): Throwable? = when (val ver = nbt.getInt("Version")) {
163+
1, 2, 3, 4 -> readLitematicaV4OrException(lookup, nbt)
164+
else -> IllegalStateException("Unsupported litematica version $ver")
165+
}
166+
167+
private fun StructureTemplate.readLitematicaV4OrException(
168+
lookup: RegistryEntryLookup<Block>,
169+
nbt: NbtCompound,
162170
): Throwable? {
163171
val version = nbt.getInt("MinecraftDataVersion")
164172

0 commit comments

Comments
 (0)