Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 0a0b0c4

Browse files
committed
RegionFile now throws AnvilException properly
Easier to use NBTCompoundLike hierarchy (can get fields from MutableNBTCompound) Easier Java interop
1 parent c7f1b49 commit 0a0b0c4

File tree

13 files changed

+24
-14
lines changed

13 files changed

+24
-14
lines changed

antlr/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55

66
dependencies {
77
// https://mvnrepository.com/artifact/org.antlr/antlr4-runtime
8-
implementation("org.antlr:antlr4-runtime:4.8-1")
8+
api("org.antlr:antlr4-runtime:4.8-1")
99
}
1010

1111
publishing {

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ allprojects {
1414
apply(plugin = "org.jetbrains.dokka")
1515

1616
group = "io.github.jglrxavpok.hephaistos"
17-
version = "2.0.3"
17+
version = "2.1.1"
1818

1919
repositories {
2020
mavenCentral()

common/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ plugins {
77

88
dependencies {
99
implementation(project(":antlr"))
10-
11-
// https://mvnrepository.com/artifact/org.antlr/antlr4-runtime
12-
implementation("org.antlr:antlr4-runtime:4.8-1")
1310
}
1411

1512
configurations {

common/src/main/kotlin/org/jglrxavpok/hephaistos/mca/RegionFile.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class RegionFile @Throws(AnvilException::class, IOException::class) @JvmOverload
4545

4646
val logicalHeight = maxY - minY +1
4747

48-
@JvmOverloads constructor(file: RandomAccessFile, regionX: Int, regionZ: Int, minY: Int = 0, maxY: Int = 255):
48+
@Throws(AnvilException::class, IOException::class) @JvmOverloads constructor(file: RandomAccessFile, regionX: Int, regionZ: Int, minY: Int = 0, maxY: Int = 255):
4949
this(RandomAccessFileSource(file), regionX, regionZ, minY, maxY)
5050

5151
init {

common/src/main/kotlin/org/jglrxavpok/hephaistos/nbt/NBTByte.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class NBTByte constructor(value: Byte) : NBTNumber<Byte>(value) {
3030
return NBTByte(source.readByte())
3131
}
3232

33-
@JvmStatic
33+
@JvmField
3434
val ONE = NBTByte(1)
3535

36-
@JvmStatic
36+
@JvmField
3737
val ZERO = NBTByte(0)
3838
}
3939
}

common/src/main/kotlin/org/jglrxavpok/hephaistos/nbt/NBTByteArray.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class NBTByteArray constructor(val value: ImmutableByteArray) : NBT, Iterable<By
4444

4545
companion object : NBTReaderCompanion<NBTByteArray> {
4646

47+
@JvmField
4748
val EMPTY = NBTByteArray(ImmutableByteArray.EMPTY)
4849

4950
override fun readContents(source: DataInputStream): NBTByteArray {

common/src/main/kotlin/org/jglrxavpok/hephaistos/nbt/NBTCompound.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.jglrxavpok.hephaistos.nbt.mutable.MutableNBTCompound
55
import java.io.DataInputStream
66
import java.io.DataOutputStream
77

8-
class NBTCompound @JvmOverloads constructor(val tags: Map<String, NBT> = mapOf()): NBT, NBTCompoundGetters, Map<String, NBT> by tags, NBTCompoundLike {
8+
class NBTCompound @JvmOverloads constructor(val tags: Map<String, NBT> = mapOf()): NBT, Map<String, NBT> by tags, NBTCompoundLike {
99

1010
override val ID = NBTType.TAG_Compound
1111

@@ -71,7 +71,7 @@ class NBTCompound @JvmOverloads constructor(val tags: Map<String, NBT> = mapOf()
7171
@Contract(pure = true)
7272
internal fun entry(key: String, value: NBT) = CompoundEntry(key, value)
7373

74-
@JvmStatic
74+
@JvmField
7575
val EMPTY = NBTCompound()
7676
}
7777

common/src/main/kotlin/org/jglrxavpok/hephaistos/nbt/NBTCompoundLike.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package org.jglrxavpok.hephaistos.nbt
22

33
import org.jetbrains.annotations.Contract
44

5-
interface NBTCompoundLike {
5+
interface NBTCompoundLike: NBTCompoundGetters {
66

77
/**
88
* Creates a NBTCompound. This will be immutable and copied,

common/src/main/kotlin/org/jglrxavpok/hephaistos/nbt/NBTIntArray.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ class NBTIntArray constructor(val value: ImmutableIntArray) : NBT, Iterable<Int>
4343
override fun iterator() = value.iterator()
4444

4545
companion object : NBTReaderCompanion<NBTIntArray> {
46+
47+
@JvmField
48+
val EMPTY = NBTIntArray()
49+
4650
override fun readContents(source: DataInputStream): NBTIntArray {
4751
val length = source.readInt()
4852
val value = ImmutableIntArray(length) { source.readInt() }

common/src/main/kotlin/org/jglrxavpok/hephaistos/nbt/NBTLongArray.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class NBTLongArray constructor(val value: ImmutableLongArray) : NBT, Iterable<Lo
4242
override fun iterator() = value.iterator()
4343

4444
companion object : NBTReaderCompanion<NBTLongArray> {
45+
@JvmField
46+
val EMPTY = NBTLongArray()
47+
4548
override fun readContents(source: DataInputStream): NBTLongArray {
4649
val length = source.readInt()
4750
val value = ImmutableLongArray(length) { source.readLong() }

0 commit comments

Comments
 (0)