From fff23478450e2afc3d02e26e1903f8505b2b1500 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 26 May 2024 19:57:38 +0200 Subject: [PATCH] Clear firework item properly (#10793) --- patches/server/General-ItemMeta-fixes.patch | 10 +++++----- patches/server/More-Projectile-API.patch | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/patches/server/General-ItemMeta-fixes.patch b/patches/server/General-ItemMeta-fixes.patch index 0a86251afb..3e4f93b47a 100644 --- a/patches/server/General-ItemMeta-fixes.patch +++ b/patches/server/General-ItemMeta-fixes.patch @@ -527,7 +527,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ); - private Color color = DEFAULT_LEATHER_COLOR; -+ private Integer color; // Paper - keep color component consistent with vanilla (top bytes are ignored) ++ private Integer color; // Paper - keep color component consistent with vanilla (top byte is ignored) CraftMetaColorableArmor(CraftMetaItem meta) { super(meta); @@ -688,7 +688,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int color : colors) { - effect.withColor(Color.fromRGB(color)); -+ effect.withColor(Color.fromRGB(color & 0xFFFFFF)); // Paper - try to keep color component consistent with vanilla (top bytes are ignored), this will however change the color component for out of bound color ++ effect.withColor(Color.fromRGB(color & 0xFFFFFF)); // Paper - try to keep color component consistent with vanilla (top byte is ignored), this will however change the color component for out of bound color } for (int color : explosion.fadeColors()) { @@ -1113,7 +1113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 static final ItemMetaKeyType COLOR = new ItemMetaKeyType<>(DataComponents.DYED_COLOR, "color"); - private Color color = DEFAULT_LEATHER_COLOR; -+ private Integer color; // Paper - keep color component consistent with vanilla (top bytes are ignored) ++ private Integer color; // Paper - keep color component consistent with vanilla (top byte is ignored) CraftMetaLeatherArmor(CraftMetaItem meta) { super(meta); @@ -1219,7 +1219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private Integer mapId; private byte scaling = CraftMetaMap.SCALING_EMPTY; - private Color color; -+ private Integer color; // Paper - keep color component consistent with vanilla (top bytes are ignored) ++ private Integer color; // Paper - keep color component consistent with vanilla (top byte is ignored) CraftMetaMap(CraftMetaItem meta) { super(meta); @@ -1285,7 +1285,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private PotionType type; private List customEffects; - private Color color; -+ private Integer color; // Paper - keep color component consistent with vanilla (top bytes are ignored) ++ private Integer color; // Paper - keep color component consistent with vanilla (top byte is ignored) CraftMetaPotion(CraftMetaItem meta) { super(meta); diff --git a/patches/server/More-Projectile-API.patch b/patches/server/More-Projectile-API.patch index 82d47d7c8a..c85cfc6ab9 100644 --- a/patches/server/More-Projectile-API.patch +++ b/patches/server/More-Projectile-API.patch @@ -168,7 +168,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - this.getHandle().projectileSource = shooter; - } -+ // Paper - moved to AbstractProjectil ++ // Paper - moved to AbstractProjectile @Override public boolean isInBlock() { @@ -270,7 +270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (this.item.getType() != Material.FIREWORK_ROCKET) { - this.item.setType(Material.FIREWORK_ROCKET); - } -+// Paper start - Expose firework item directly ++ // Paper start - Expose firework item directly +// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM); +// +// if (item.isEmpty()) { @@ -316,7 +316,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void setItem(org.bukkit.inventory.ItemStack itemStack) { + FireworkMeta meta = getFireworkMeta(); -+ ItemStack nmsItem = itemStack == null ? ItemStack.EMPTY : CraftItemStack.asNMSCopy(itemStack); ++ ItemStack nmsItem = itemStack == null ? FireworkRocketEntity.getDefaultItem() : CraftItemStack.asNMSCopy(itemStack); + this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM, nmsItem); + + applyFireworkEffect(meta);