crashdemons / DisplayItem-Spigot

rewrite of DisplayItem for use in Spigot 1.13+ (uses BungeeChat components)
5 stars 0 forks source link

1.18 Support #20

Closed iZeusi closed 2 years ago

iZeusi commented 2 years ago

Hi,

Whenever an item is attempted to be displayed in 1.18 Spigot, this error occurs:

https://pastebin.com/mnwrDXe5

I have the latest update, but I do not think it is 1.18 compatible. I'd have asked in a Discord / forum but can't seem to find one for this proj.

Cheers

crashdemons commented 2 years ago

In order to set the hoverable item in chat, the item has to be "serialized" properly. In previous versions, spigot would deobfuscate the "save" method for ItemStacks (Minecraft code) which serializes it.

However, they recently announced they wouldn't be deobfuscating these methods anymore - this means even if I happen to figure out whether b is the right for 1.18, it will be immediately broken on any minor version change because the name will change...

crashdemons commented 2 years ago

Try pre-release v2.9.7 which attempts to use the 1.18-specific name if save isn't present. I'm 99% sure that this will break on the next version update though.

https://github.com/crashdemons/DisplayItem-Spigot/releases/tag/v2.9.7


Technical notes:

According to the deobfuscation map for 1.18: https://launcher.mojang.com/v1/objects/a8fe854e35a69df7289d3f03fc0821f6363f2238/server.txt 261:267:net.minecraft.nbt.CompoundTag save(net.minecraft.nbt.CompoundTag) -> b So in 1.18, 'save' becomes 'b' (unless it is deobfuscated by some spigot fork).

iZeusi commented 2 years ago

Hi Crash,

Ty for getting back to me so quickly. I've given the version a whirl and everything works as intended - perfect. I understand that this will more than likely break in the following versions to come, but I appreciate you making this for the time-being. Great work buddy.

Cheers!