Clear firework item properly (#10793)

This commit is contained in:
Lulu13022002
2024-05-26 19:57:38 +02:00
parent 37155664bb
commit fff2347845
2 changed files with 8 additions and 8 deletions

View File

@@ -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);