From 4bf2fc878208caea140b44d6a51bca0368d5a985 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 18 Nov 2016 10:11:19 +1100 Subject: [PATCH] SPIGOT-2786: Restore some fireworks code lost in update --- .../org/bukkit/craftbukkit/entity/CraftFirework.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index e97037f60f..99746b3c2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -1,6 +1,8 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityFireworks; +import net.minecraft.server.ItemStack; +import net.minecraft.server.Items; import org.bukkit.Material; import org.bukkit.craftbukkit.CraftServer; @@ -18,7 +20,15 @@ public class CraftFirework extends CraftEntity implements Firework { public CraftFirework(CraftServer server, EntityFireworks entity) { super(server, entity); - this.item = CraftItemStack.asCraftMirror(getHandle().getDataWatcher().get(EntityFireworks.FIREWORK_ITEM)); + + ItemStack item = getHandle().getDataWatcher().get(EntityFireworks.FIREWORK_ITEM); + + if (item.isEmpty()) { + item = new ItemStack(Items.FIREWORKS); + getHandle().getDataWatcher().set(EntityFireworks.FIREWORK_ITEM, item); + } + + this.item = CraftItemStack.asCraftMirror(item); // Ensure the item is a firework... if (this.item.getType() != Material.FIREWORK) {