From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Trigary Date: Tue, 14 Apr 2020 12:05:22 +0200 Subject: [PATCH] Player elytra boost API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 7aae63d22167dc1b3ec7e8bc8672855c2038007e..94240b70e245bdc3dda60420f5787f8d5dcc1958 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -67,6 +67,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeMap; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; @@ -2281,6 +2282,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } throw new RuntimeException("Unknown settings type"); } + + @Override + public org.bukkit.entity.Firework boostElytra(ItemStack firework) { + Validate.isTrue(isGliding(), "Player must be gliding"); + Validate.isTrue(firework != null, "firework == null"); + Validate.isTrue(firework.getType() == Material.FIREWORK_ROCKET, "Firework must be Material.FIREWORK_ROCKET"); + + net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework); + net.minecraft.world.level.Level world = ((CraftWorld) getWorld()).getHandle(); + FireworkRocketEntity entity = new FireworkRocketEntity(world, item, getHandle()); + return world.addFreshEntity(entity) + ? (org.bukkit.entity.Firework) entity.getBukkitEntity() + : null; + } // Paper end // Spigot start