Comments (4)
Include the file /web-app/NBT.js
(you're also required to have /web-app/NBT.js.mem
in the same folder). NBT.js
was compiled from the C++-files in /nbt-utils/
(and zlib as dependency) using emscripten, so if you want to alter the behavior of NBT.js
, you'll have to edit the C++-files and recompile.
The most important methods exposed by NBT.js
are:
Module.Tag.serialize
and Module.Tag.serializeCompressed
(these transform Tag
s into binary data)
Module.Tag.deserialize
and Module.Tag.deserializeCompressed
(these load Tag
s from binary data)
For more information on the methods exposed by NBT.js
(especially instance methods of Tag
s) take a look at the emscripten bindings in /nbt-utils/main.cpp
.
If there's anything else you need, let me know and I'll help you.
from webnbt.
Thanks man. Do I also need to wait for the depencies like in the app.js? And embed your TagLibrary?
EDIT: I don't know which parameters are needed, I tried it with the following:
- data
- String: "compressed" or "uncompressed"
- Boolean: named?
I tried both deserialize methods and the best i achieved was a byte tag (tagType 1), but the result should be compound (tagType 10). What am I doing wrong?
from webnbt.
No problem. You'll probably have to wait for the dependencies as well, I haven't found a better way to accomplish this.
The parameters for deserialize
should be static Tag *deserialize(std::string input, bool withName = true, TagType::Enum type = TagType::Unknown);
(see here)
So basically
- String: data
- Boolean: named?
- Tag Type: set this to -1 and it'll read the type from the data provided.
You can take a look at how I call deserialize
within App.js
.
Hope this helps. 🐱
from webnbt.
Got it :) Thanks. And I've seen that I can iterate throu the Tag with this.
Also you need to have the NBT.js.mem-file in the same folder as the html not the js.
from webnbt.
Related Issues (20)
- Support Upload with button HOT 1
- Using new FileSystem API to save file without downloading HOT 1
- Can't put compound tag in a list tag HOT 1
- support for .mcc files?
- Support for .mclevel files
- How do I copy and paste some player data from one nbt file into level.dat???
- Drop file window
- not working on android HOT 1
- Lack of support using server level.dat files HOT 1
- Replit Support
- No 1.18 support
- Anvil region file support? HOT 1
- doesnt work with my bedrock level.dat
- Will the source codes be available as well ? HOT 1
- WebNBT doesn't open .mca files - NBT Explorer does
- Some level.dats Are Not Accepted
- Having Issues With level.dat HOT 1
- Broken encoding
- Can't open mca file HOT 1
- Just Wanted To Point Out, This Can No Longer Read NBT Data From 1.16.1 HOT 3
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 webnbt.