iRath96 / webNBT

An HTML5 NBT-editor based on emscripten
232 stars 40 forks source link

Copy & paste as SNBT #22

Open Vftdan opened 2 years ago

Vftdan commented 2 years ago

Implement copying & pasting of subtrees as text, that should be valid SNBT (the syntax used in command blocks, but I have not tested).

Current limitations

Closes https://github.com/iRath96/webNBT/issues/5, https://github.com/iRath96/webNBT/issues/15

iRath96 commented 2 years ago

There seems to be a problem with copying doubles. They are exported in hexadecimal notation, which they are not supposed to be afaik.

iRath96 commented 2 years ago

The error message when pasting something of incorrect type is confusing. It says "Parse error at position 0" even though the pasted content is syntactically correct. Perhaps it should say something along the lines of, e.g., "Cannot paste content of type 'Double' into property of type 'Long'".

In the future, it would be cool to automatically cast at some of the types (in particular among the numerical types). But for now we can live without this :-)