From b136f8430d42b723f89274004d04adcd577b6756 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 25 Jun 2020 12:57:58 +1000 Subject: [PATCH] SPIGOT-5804: Cannot launch Entity Firework --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 4 ++-- .../org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index e5130bf609..cac3427001 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1493,6 +1493,8 @@ public class CraftWorld implements World { } else if (LlamaSpit.class.isAssignableFrom(clazz)) { entity = EntityTypes.LLAMA_SPIT.a(world); entity.setPositionRotation(x, y, z, yaw, pitch); + } else if (Firework.class.isAssignableFrom(clazz)) { + entity = new EntityFireworks(world, x, y, z, net.minecraft.server.ItemStack.b); } } else if (Minecart.class.isAssignableFrom(clazz)) { if (PoweredMinecart.class.isAssignableFrom(clazz)) { @@ -1760,8 +1762,6 @@ public class CraftWorld implements World { entity = new EntityExperienceOrb(world, x, y, z, 0); } else if (LightningStrike.class.isAssignableFrom(clazz)) { entity = EntityTypes.LIGHTNING_BOLT.a(world); - } else if (Firework.class.isAssignableFrom(clazz)) { - entity = new EntityFireworks(world, x, y, z, net.minecraft.server.ItemStack.b); } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) { entity = new EntityAreaEffectCloud(world, x, y, z); } else if (EvokerFangs.class.isAssignableFrom(clazz)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 28151d1537..8f16b27123 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -15,6 +15,7 @@ import net.minecraft.server.EntityDragonFireball; import net.minecraft.server.EntityEgg; import net.minecraft.server.EntityEnderPearl; import net.minecraft.server.EntityFireball; +import net.minecraft.server.EntityFireworks; import net.minecraft.server.EntityFishingHook; import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityInsentient; @@ -58,6 +59,7 @@ import org.bukkit.entity.EnderPearl; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Fireball; +import org.bukkit.entity.Firework; import org.bukkit.entity.FishHook; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.LingeringPotion; @@ -437,6 +439,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { launch = new EntityShulkerBullet(world, getHandle(), null, null); launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + } else if (Firework.class.isAssignableFrom(projectile)) { + Location location = getEyeLocation(); + + launch = new EntityFireworks(world, net.minecraft.server.ItemStack.b, getHandle()); + launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); } Validate.notNull(launch, "Projectile not supported");