Paper/patches/server/0481-Player-elytra-boost-API.patch
Jake Potrebic 41e6f20420
Updated Upstream (Bukkit/CraftBukkit) (#9342)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fdff0cd4 PR-869: Add Enderman#teleport and Enderman#teleportTowards
dfd86ee7 Improve sendSignChange and related documentation
beced2b2 PR-867: Add Player#sendBlockUpdate to send tile entity updates

CraftBukkit Changes:
ad6d0cffb SPIGOT-7394: Fix another issue with sendSignChange
66c5ce4c7 SPIGOT-7391: Preserve vanilla sign json where not modified by event
ae3824f94 PR-1204: Add Enderman#teleport and Enderman#teleportTowards
5863a2eae Fix sendSignChange not working
4a7eadc97 PR-1201: Add Player#sendBlockUpdate to send tile entity updates
789324e30 Work around issue placing decorated pots
2023-06-16 11:28:31 +01:00

32 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
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 7eb629519f1604d76a20c9ac468b8e2697980de4..c67161842ad149cd0958520d9528fbedf42e3fe1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -617,6 +617,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
throw new RuntimeException("Unknown settings type");
}
+
+ @Override
+ public org.bukkit.entity.Firework boostElytra(ItemStack firework) {
+ Preconditions.checkState(this.isGliding(), "Player must be gliding");
+ Preconditions.checkArgument(firework != null, "firework == null");
+ Preconditions.checkArgument(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();
+ net.minecraft.world.entity.projectile.FireworkRocketEntity entity = new net.minecraft.world.entity.projectile.FireworkRocketEntity(world, item, getHandle());
+ return world.addFreshEntity(entity)
+ ? (org.bukkit.entity.Firework) entity.getBukkitEntity()
+ : null;
+ }
// Paper end
@Override