skyecodes / IBE-Editor

A simple GUI mod to edit an item, a block or an entity in your current world.
https://www.curseforge.com/minecraft/mc-mods/ibe-editor
MIT License
39 stars 13 forks source link

SNBT format breaks strings #62

Closed tryashtar closed 1 year ago

tryashtar commented 1 year ago

Hello, thanks for the great mod!

I noticed that when I click the "format text" button in the SNBT view, strings with spaces in them get changed to not have spaces anymore. And strings that contain characters like { get formatted, inserting whitespace and newlines. And this even persists after saving, which can break stuff.

How to reproduce

I guess this is the code that handles formatting? I think vanilla has a builtin SNBT formatter that's a bit more robust (looks like yarn calls it net.minecraft.nbt.visitor.NbtTextFormatter), that might help make things a bit easier, if you don't mind the roundabout process of parsing to NBT and back.

skyecodes commented 1 year ago

Thank you for the report. I don't even know why I didn't think that it was going to break spaces in strings.

Thanks for telling me about the vanilla formatter btw, I didn't know it existed. I'll see if I can use it instead.

skyecodes commented 1 year ago

Fixed in version 2.2.1