SPIGOT-5804: Cannot launch Entity Firework

This commit is contained in:
md_5 2020-06-25 12:57:58 +10:00
parent 76d2add0bb
commit b136f8430d
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11
2 changed files with 9 additions and 2 deletions

View file

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

View file

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