From f36bb597399b9b9b632caa4f938c28ca137583f5 Mon Sep 17 00:00:00 2001 From: booky10 <53302036+booky10@users.noreply.github.com> Date: Wed, 4 Oct 2023 03:29:44 +0200 Subject: [PATCH] Fix entity data not updated for firework attached to entity (#9783) --- patches/server/0123-Firework-API-s.patch | 2 +- ...ta-when-attaching-firework-to-entity.patch | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 patches/server/1035-Update-entity-data-when-attaching-firework-to-entity.patch diff --git a/patches/server/0123-Firework-API-s.patch b/patches/server/0123-Firework-API-s.patch index b5fa1b6e64..2ce62771da 100644 --- a/patches/server/0123-Firework-API-s.patch +++ b/patches/server/0123-Firework-API-s.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Firework API's public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index b16add0be6ac782a7e40be0cdeea4c1829a19d4e..288910fb168ddc5d3a61971778b8038a56772fa8 100644 +index 36f096001d2df5e3cae921cf1f08473e51e91a19..b2f08889139dc447f7071f1c81456035bf8de31e 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -38,6 +38,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { diff --git a/patches/server/1035-Update-entity-data-when-attaching-firework-to-entity.patch b/patches/server/1035-Update-entity-data-when-attaching-firework-to-entity.patch new file mode 100644 index 0000000000..de60d2ea6f --- /dev/null +++ b/patches/server/1035-Update-entity-data-when-attaching-firework-to-entity.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: booky10 +Date: Sun, 27 Aug 2023 16:11:31 +0200 +Subject: [PATCH] Update entity data when attaching firework to entity + +== AT == +public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ATTACHED_TO_TARGET + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +index 68c5af9b67a2834ee6e2f80ceefa19c3a982b8ed..1605ac0e726accdbd7953ffb95a302c2a21d64ce 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +@@ -69,6 +69,10 @@ public class CraftFirework extends CraftProjectile implements Firework { + } + + this.getHandle().attachedToEntity = (entity != null) ? ((CraftLivingEntity) entity).getHandle() : null; ++ // Paper start - update entity data ++ this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_ATTACHED_TO_TARGET, ++ entity != null ? java.util.OptionalInt.of(entity.getEntityId()) : java.util.OptionalInt.empty()); ++ // Paper end + return true; + } +