Comments (4)
Just tried, works with 0.9.2-SNAPSHOT
What I tried (and therefore validated):
parsing multiple different level.dat
files using the above mentioned model classes, then extracting [root]/Data/LevelName
.
Thanks!
from knbt.
Awesome!! 0.9.2 should be published soon with the fix :)
from knbt.
Thanks for reporting this! I'll take a look at what's going on...
Reproduction:
import kotlinx.serialization.*
import net.benwoodworth.knbt.*
@NbtRoot(name = "")
@Serializable
data class LevelRoot(
@SerialName("Data")
val data: LevelData
)
@SerialName("Data")
@Serializable
data class LevelData(
@SerialName("LevelName")
val levelName: String
)
fun main() {
val nbt = Nbt {
variant = NbtVariant.Java
compression = NbtCompression.Gzip
ignoreUnknownKeys = true
}
val levelTag = buildNbtCompound("") {
putNbtCompound("Data") {
put("LevelName", "test")
putNbtList<Nothing>("ScheduledEvents") {}
}
}
nbt.decodeFromNbtTag<LevelRoot>(levelTag) // error
}
from knbt.
Could you give 0.9.2-SNAPSHOT a try?
You'll need to add the maven snapshot repo:
https://s01.oss.sonatype.org/content/repositories/snapshots/
from knbt.
Related Issues (20)
- Serialize unsigned arrays as NbtArrays
- Test fails on mingwX64 HOT 2
- Support `Char` serialization
- Add `NbtTransformingSerializer`
- Add extension methods/properties to Kotlin types for creating Nbt versions of a type.
- Consistency issues with equality in list-like `NbtTag` types
- Re-design root class name NbtCompound-nesting functionality HOT 22
- Refactor `NbtEncoder`/`NbtDecoder` implementations
- Simplify `NbtEncoder`/`NbtDecoder` interfaces
- Strict binary equality for `NbtFloat` and `NbtDouble`
- Investigate `NaN` and infinity values for SNBT HOT 1
- Back `Nbt*Array`s with `List`s, and encode arrays as `NbtList` by default, and require `@NbtArray`
- Change package to com.benwoodworth.knbt :) HOT 1
- Support Java protocol version 764+ with nameless tags HOT 6
- Extra bytes are read when decoding Nbt from stream HOT 4
- Allow the encoding/decoding of end tags at root HOT 2
- Rename `Nbt` to `BinaryNbt`, and `NbtFormat` to `Nbt`, and add `Nbt` companion object for `NbtTag` serialization
- Expose `NbtTagType` in the public API
- Ensure that Java NBT uses "Modified UTF-8"
- Check that SNBT on JS reads/writes floats/doubles correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knbt.