Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Custom banners patterns cause several bugs and crashes. (MC 1.20.5/1.20.6)

Open david85258 opened this issue 1 year ago • 1 comments

Stack trace

Forcing a timings report (Waiting 5 minutes cause the same result): https://paste.gg/p/anonymous/8fe00967c3d24d70b17da9c80831912a

Modify a BannerMeta of a Banner with a custom pattern: https://paste.gg/p/anonymous/bca4815e992041d698dbfcf0e5173bfb

Changing the slot of the banner with a custom pattern: https://paste.gg/p/anonymous/c2bdb4fa3a984863ac2750af121287f7

Plugin and Datapack List

Server Plugins (1): Bukkit Plugins:

  • Test

There are 4 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)], [file/many-more-banners-v0.2.2.zip (world)]

Actions to reproduce (if known)

In All

Add a data pack that's add custom patterns (like this)

Timings

Give a banner with a custom pattern (from the data pack "/give @s minecraft:black_banner[minecraft:banner_patterns=[{pattern:'mmb:anchor',color:'red'}]]") Place the banner and wait to timings collect the data. (Can be forced cause using "/timings report") Video: https://youtu.be/DP30mUcqIzs?si=dt4w9vNn1aZT3Qxr

BannerMeta

Create a plugin that's modify the BannerMeta of a banner and modify the data of a banner with a custom pattern.

ItemMeta itemMeta = p.getInventory().getItemInMainHand().getItemMeta();
if (itemMeta instanceof BannerMeta bannerMeta){
    bannerMeta.addPattern(new Pattern(DyeColor.RED, PatternType.CREEPER));
    ItemStack item = p.getInventory().getItemInMainHand();
    item.setItemMeta(bannerMeta);
    p.getInventory().setItemInMainHand(item);
}

Video: https://youtu.be/k93NWKhxX8E?si=x2NJHBXrjSTJJe8x

Handle packet

Give a banner with a custom pattern (from the data pack "/give @s minecraft:black_banner[minecraft:banner_patterns=[{pattern:'mmb:anchor',color:'red'}]]") Move the item in the inventory. Video: https://www.youtube.com/watch?v=JO2bKsEw5FA

Paper version

version [13:49:34 INFO]: Checking version, please wait... [13:49:34 INFO]: This server is running Paper version git-Paper-53 (MC: 1.20.6) (Implementing API version 1.20.6-R0.1-SNAPSHOT) (Git: 5729b29) You are running the latest version

Other

No response

david85258 avatar May 09 '24 12:05 david85258

From the looks of this, this is generally down to spigot not properly adopting upstream changes for the past 10 years, this is fixable in the long run, but not really sure of a good short term solution here which isn't just replacing this API

electronicboy avatar May 09 '24 12:05 electronicboy

The crashes have been mitigated however the custom pattern is lost when the item meta conversion happen.

Lulu13022002 avatar May 26 '24 17:05 Lulu13022002

Fixed in 77a5779e24b55fd900d337ac071a7e4327d735bf i will remove the leftover later.

Lulu13022002 avatar Aug 10 '24 12:08 Lulu13022002