[SPIGOT-7837] Datapack banner patterns on items cause client disconnect Created: 18/Jul/24  Updated: 25/Dec/24  Resolved: 27/Jul/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jared Mulder Assignee: Doc
Resolution: Fixed Votes: 0
Labels: DataPacks, NBT

Attachments: Text File latest.log     Zip Archive rhinePack.zip    
Version: CraftBukkit version 4267-Spigot-5bbef5a-403accd (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

I am using a datapack on my server that adds a custom banner pattern. When I create a banner using the custom pattern via the /setblock or /data  command it functions correctly, but if I use pick block button (or /give command) to get the banner in item form, I am disconnected from the server with an exception message "Failed to decode packet 'serverbound/minecraft:set_creative_mode_slot''". In the server log the disconnect is indicated to have been caused by an IllegalArgumentException originating from the block.banner.CraftPatternType.minecraftToBukkit method.

 

It appears that the server is failing to convert the minecraft banner pattern into the Bukkit form. I have not had issues with other custom Datapack objects, like custom dimensions and custom enchantments, so I am not sure why this is causing an error.



 Comments   
Comment by Jared Mulder [ 22/Jul/24 ]

Custom banner patterns are now working correctly on this build. Thank you!

Comment by Doc [ 20/Jul/24 ]

PR Created for support custom patterns.

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/1045/overview

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1451

You can test using BuildTools command:

--rev 1.21 --pr bukkit:1045 --pr craftbukkit:1541
Comment by Jared Mulder [ 20/Jul/24 ]

I have disabled all plugins for the server and the error is still occurring.

If I attempt to create the banner pattern in a loom, the pattern shows up correctly in the options, but if I click it I am disconnected due to a packet encoding error "clientbound/minecraft:container_set_slot", and an IllegalArgumentException appears in the same location.

If I place a banner with commands, no errors appear in the server log and the banner renders correctly. However if I attempt to break the banner (in survival or creative), an error appears in the server log "Failed to handle packet net.minecraft.network.protocol.game.PacketPlayInBlockDig@5aff90c4, suppressing error", caused by the same IllegalArgumentException. The block does appear to break, though nothing will drop if broken in survival, however any world manipulation or unloading and reloading the chunk will cause it to reappear (Though no patterns show up on it).

Breaking the block that the banner is attached to will cause a disconnect and a server error "Error sending packet clientbound/minecraft:set_entity_data". This error prevents me from reconnecting to the server at all as long as those chunks are loaded, forcing me to manually remove the item from the chunk using an NBT editor.

So it does seem like any interaction with the custom banner pattern outside of the block form throws an exception, and in many cases also causes a client disconnect. The only way to use the banner pattern without any errors occurring is to create it using the setblock or data command, and remove it by setting the banner block to air with commands. Any player interaction with the banner risks a disconnect and fails to do anything to the banner block.

Comment by Doc [ 20/Jul/24 ]

The issue is how the server try parse the custom pattern to a enum then the unexpected error throw the issue...

Can just use minecraft commands for the banner not? any plugin? mostly because this issue throw for every place in teory where need handle the pattern like give a custom item.

Generated at Tue Jan 07 15:47:03 UTC 2025 using Jira 10.3.1#10030001-sha1:7c16d34d98ce5cdd7a13118a6e1535e014ad7025.