Comments (5)
Some static (companion object) methods for the NBTReader would also be nice e.g.
NBTReader.parseString(nbtString)
Possibly add a better way to read compound tags, instead of having to construct a new reader and then read and perform an unchecked cast.
A better way could be returning a generic like <T extends NBT>
so that implicit casting could be used.
from hephaistos.
Just a passerby from the Minestom Discord. It might be worth sealing these NBT classes. It's still a preview feature, but if you're thinking about managing instances to that extent, it's not a stretch to suggest managing classes too.
from hephaistos.
Expose the backing map of an NBTCompound and the backing list of an NBTList in some way, whether this be an immutable copy, or just the actual map itself.
Make NBTEnd an object, since it only needs one instance and doesn't ever need to be copied.
Done in 088ebf6
Add a new method for getting every type from a compound with a default value, and these methods should never return null. For example, getString("my_key", "my_default") would look for a string in the map with the key "my_key", or else it would return "my_default" if no such value was found.
Already present in v2: getOrDefault
Just a passerby from the Minestom Discord. It might be worth sealing these NBT classes. It's still a preview feature, but if you're thinking about managing instances to that extent, it's not a stretch to suggest managing classes too.
Kotlin already has sealed classes, but Hephaistos cannot use it because mutable versions of tag (in v2) inherit both from MutableNBT and ImmutableNBT (two interfaces). Kotlin (like JVM-based languages) does not allow multiple superclasses, so sealing the base MutableNBT and ImmutableNBT is sadly not possible with the current state of the library.
We'll see if/when the proposal is accepted inside Java, maybe Kotlin will add sealed interfaces too.
from hephaistos.
As of Kotlin 1.5, Kotlin now has sealed interfaces FYI.
And sealed class/interface support has been extended, so now any members declared in the same package can participate in the heirachy, rather than just in the same class
from hephaistos.
I was not aware about sealed interfaces in Kotlin 1.5, I'll have to see if it can apply.
from hephaistos.
Related Issues (20)
- Proposal: kotlinx.serialization module HOT 1
- Proposal: Highlighting
- Allow clients of SNBTParser to see how much was read HOT 1
- Issues when using a player head with custom skin HOT 2
- Error when loading SNBT with \u unicode HOT 3
- Cannot load entities from world HOT 26
- Proposal: getValue inside NBT HOT 1
- Create a new NBTParser class for snbt & path lookup
- MCA ChunkSection biomes processed incorrectly HOT 3
- AnvilException in ChunkColumn#getEntities() HOT 2
- divided by zero exception
- Specify compression processor HOT 2
- Chunk file at [0, 23] is missing level data in minecraft logs when loading a modifed world HOT 1
- Big floating point variables cannot be parsed HOT 1
- Write & Read for netty buffers HOT 1
- Error when reading mca version 1.12.2 HOT 1
- Bug: ChunkReader.getYRange() includes empty chunk sections HOT 1
- Missing field named 'sections' (or of wrong type)
- 1.20.6 moves entities out of chunk files
- Error When Reading a Region File HOT 2
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 hephaistos.