From 803eaa31693ccb4a35547278b941dc371771f55e Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 2 Aug 2019 19:32:10 +1000 Subject: [PATCH] SPIGOT-5231: ShotAtAngle API for Fireworks --- nms-patches/EntityFireworks.patch | 9 ++++++++- .../org/bukkit/craftbukkit/entity/CraftFirework.java | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/nms-patches/EntityFireworks.patch b/nms-patches/EntityFireworks.patch index 7255b84a96..ae3b56acf6 100644 --- a/nms-patches/EntityFireworks.patch +++ b/nms-patches/EntityFireworks.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityFireworks.java +++ b/net/minecraft/server/EntityFireworks.java -@@ -3,6 +3,7 @@ +@@ -3,12 +3,13 @@ import java.util.Iterator; import java.util.List; import java.util.OptionalInt; @@ -8,6 +8,13 @@ public class EntityFireworks extends Entity implements IProjectile { + public static final DataWatcherObject FIREWORK_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.g); + private static final DataWatcherObject c = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.r); +- private static final DataWatcherObject d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); ++ public static final DataWatcherObject d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); // PAIL + private int ticksFlown; + public int expectedLifespan; + private EntityLiving ridingEntity; @@ -133,7 +134,11 @@ } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 6b69be7421..d3cbad9a5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -68,4 +68,14 @@ public class CraftFirework extends CraftEntity implements Firework { public void detonate() { getHandle().expectedLifespan = 0; } + + @Override + public boolean isShotAtAngle() { + return getHandle().i(); + } + + @Override + public void setShotAtAngle(boolean shotAtAngle) { + getHandle().getDataWatcher().set(EntityFireworks.d, shotAtAngle); + } }