NBTEditor

NBTEditor

238k Downloads

1.13 support and NBT changes.

mibby opened this issue · 21 comments

commented

Spigot 1.13 pre-release builds have been released and 1.13 is stated to come out on Wednesday. Might want to prepare for 1.13 breaking changes? :)
https://www.spigotmc.org/threads/bukkit-craftbukkit-spigot-bungeecord-1-13-pre7-development-builds.328883/

commented
commented

Thanks for the heads up. Many things have changed with 1.13, I'll definitely do multiple development builds and start adding basic support as soon as possible, might take a while for a official release.

commented

Based on some quick testing done on my part (nothing too extensive), it would seem that the main issue with using NBTeditor on 1.13 is that the reflection classes are broken, but a decent amount of the rest of the plugin is still fully functional, despite a number of API changes.
Of course, that could change with the actual release of spigot for 1.13.
More specifically, the NBTUtils reflection seems to be broken, as referenced by this error message from the latest Spigot 1.13 build:
[NBTEditor] Error preparing reflection objects java.lang.RuntimeException: Error while preparing NBT wrapper classes. at com.goncalomb.bukkit.mylib.reflect.NBTBase.prepareReflection(NBTBase.java:52) ~[nbteditor-3.0.1.jar:?] at com.goncalomb.bukkit.nbteditor.NBTEditor.onEnable(NBTEditor.java:72) [nbteditor-3.0.1.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:339) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at org.bukkit.craftbukkit.v1_13_R1.CraftServer.enablePlugin(CraftServer.java:424) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at org.bukkit.craftbukkit.v1_13_R1.CraftServer.enablePlugins(CraftServer.java:338) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at net.minecraft.server.v1_13_R1.MinecraftServer.m(MinecraftServer.java:523) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at net.minecraft.server.v1_13_R1.MinecraftServer.g_(MinecraftServer.java:485) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at net.minecraft.server.v1_13_R1.MinecraftServer.a(MinecraftServer.java:384) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at net.minecraft.server.v1_13_R1.DedicatedServer.init(DedicatedServer.java:288) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at net.minecraft.server.v1_13_R1.MinecraftServer.run(MinecraftServer.java:647) [spigot-1.13-pre7.jar:git-Spigot-83d9d09-15036eb] at java.lang.Thread.run(Unknown Source) [?:?] Caused by: java.lang.NoSuchMethodException: net.minecraft.server.v1_13_R1.ItemStack.<init>(net.minecraft.server.v1_13_R1.NBTTagCompound) at java.lang.Class.getConstructor0(Unknown Source) ~[?:?] at java.lang.Class.getConstructor(Unknown Source) ~[?:?] at com.goncalomb.bukkit.mylib.reflect.NBTUtils.prepareReflection(NBTUtils.java:66) ~[?:?] at com.goncalomb.bukkit.mylib.reflect.NBTBase.prepareReflection(NBTBase.java:50) ~[?:?] ... 12 more [22:42:38]

(also, I'd be more than happy to test stuff out since I use your plugin all the time)

commented

Yes, reflection is broken. But there are some other things too, material names have changed. Materials like MONSTER_EGG referred to all spawn eggs how there's a material for each egg, COW_SPAWN_EGG, PIG_SPAWN_EGG etc. I need to fix these before even being able to build against the new API.

Testing is always welcome, especially if you have saved BoSs from 1.12, making sure that they work on 1.13 is important. I'll try to release a basic development build tomorrow to start identifying other issues.

commented

I probably have somewhere in the neighborhood of a thousand BoSs saved from 1.12 that I can use to test if they work on 1.13.

commented

https://jenkins.androkai.net/job/NBTEditor/26/ "works" on 1.13-pre7

Things I know are broken:

  • /* tocommand doesn't work (new command format).
  • /nbti var doesn't work (some exception).
  • Empty BoSs don't work (can't click on entities).
  • BoS entities that don't work/not added yet: MINECART_COMMAND, SHULKER_BULLET, EXPERIENCE_ORB, TRIDENT, DOLPHIN, WEATHER, LIGHTNING, PHANTOM, ENDER_SIGNAL, TROPICAL_FISH, EVOKER, FIREWORK, IRON_GOLEM, SNOWMAN, TIPPED_ARROW, ILLUSIONER, UNKNOWN, SALMON, VINDICATOR, PAINTING, PLAYER, ITEM_FRAME, LEASH_HITCH, COD, COMPLEX_PART, ENDER_CRYSTAL, PUFFERFISH, FISHING_HOOK, THROWN_EXP_BOTTLE, TURTLE, LINGERING_POTION, EVOKER_FANGS, DROWNED.

Any testing is welcome, please report any other issues...

commented

Results of testing on the latest jar build (in addition to above issues):
Just some quick testing reveals that variables from BoSs don't seem to actually apply when the monster is spawned directly or through a spawner.
/nbti info and /nbti mod both seem broken
/nbttile doesn't seem to work either

/nbtenchant seems to work great, as well as /itemstorage, /nbtspawner and /nbtpotion 😄

commented

I got it "working" but many things are broken, BoSs simply don't work, they show * Invalid book tag * instead of the pages. I can't even spawn a written book from the console /give @p written_book{title:"poop",author:"boop",pages:["p1","p2","p3"]}. It's a nightmare!

commented

That's fairly annoying, considering how much relies on books. The only method for editing books via. Bukkit/Spigot right now seems to directly edit the BookMeta, which is a bit of a pain to work with.
1.13 changed so much of the technical backend of Minecraft, updating everything is going to be a pain.
Edit: I'm not at a computer to test this right now, but I seem to remember seeing something about this in a changelog for 1.13 at some point. Try this command: /give @p written_book{"title":"poop","author":"boop","pages":["p1","p2","p3"]}
@goncalomb

commented

The BoSs use BookMeta, it doesn’t appear to work. Apparently is a bug:

https://hub.spigotmc.org/jira/browse/SPIGOT-4049
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/595ec6472690de62195d62b7dd3b5cb7e4118b32

It doesn't appear to be properly fixed. I'm building another server jar with the latest code.

commented

Interesting, as I wrote a quick bit of code, and BookMeta seemed to work just fine.

commented

It works now, I was using a "old" jar file from yesterday. Everything is on track.

commented

Yes, the JSON is intentional, but I shouldn't crash if it's malformed. I'm reporting it...
https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-4100

New build: https://jenkins.androkai.net/job/NBTEditor/27/

Current bugs:

  • /nbti var Name crashes the client on Spigot (needs JSON conversion).
  • /nbtt var Name not working (also uses JSON???).
  • Empty BoSs still broken.
  • Missing new entities from 1.13.

BoSs variables are working on my end! Confirm?

commented

Okay, additional bug I noticed:
The name variable for BoSs seems to not work, preventing the monster from spawning.

commented

@14ercooper Thanks for the info.

I think I found another spigot bug, /give @p minecraft:melon{"display":{"Name":"test name"}} will crash your player and "corrupt" the player data. Apparently on 1.13 display names use JSON, /give @p minecraft:melon{"display":{"Name":"{\"text\":\"test name\"}"}} works. The first command only crashes with the Spigot jar, with the CraftBukkit it only shows a exception on the console.

Can you test this? It's affecting /nbti var Name. I don't see this issue reported on Spigot...

commented

Okay, so the crashing/corrupting part is a Spigot/CraftBukkit bug (I can reproduce it), however using JSON for display names does actually appear to be intentional, as the first command simply doesn't work in vanilla 1.13 to add a name.

commented

Okay, some more testing and it seems like health isn't working in the BoSs, maybe it isn't setting MaxHealth (I noticed that isn't a variable)?

commented

Yes, you need to set the MaxHealth attribute with /bos attr if you want to increase Health.

The latest version should fix all the Name variable issues and also add fish entities.

Thank for the testing, but you don't need to test every single variable, it's not really worth it. If you have some old BoSs with entities with custom names and passengers, try them, I already tested some and they work on my side.

commented

Well, I'm just using the plugin like I would have on 1.12 and seeing what breaks right now. (You might want to add some form of note in the plugin about maxhealth being in a different place, since that seems kinda easy to miss when setting health.)
Testing out a few dozen BoSs from 1.12 they all seem to be working properly on my end, including names and passengers.

commented

Interesting, maybe the Name variable on entities also uses JSON. I'll look into it.

EDIT: Confirmed, all name variables (entity, tiles and items) use JSON. I'll add some checks to ensure valid JSON and also try to keep the old format (using &a, &b etc.).

commented

Basic support for 1.13 is now complete. I think all issues are fixed. But some things still need to be migrated, block variables should not have the 'data' value (every single item has a distinct name on 1.13), and some entities may have different variables.

I'll wait for a more stable version of Spigot before posting a final release. Meanwhile please continue reporting any issues found. Thanks.