2021-06-12 11:01:04 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 28 Dec 2016 07:18:33 +0100
|
|
|
|
Subject: [PATCH] Firework API's
|
|
|
|
|
2022-11-20 00:53:20 +01:00
|
|
|
== AT ==
|
|
|
|
public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity
|
2021-06-12 11:01:04 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
2024-04-12 21:14:06 +02:00
|
|
|
index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd3654346c71f13c 100644
|
2021-06-12 11:01:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -40,6 +40,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
2021-06-12 11:01:04 +02:00
|
|
|
public int lifetime;
|
|
|
|
@Nullable
|
2022-12-07 19:52:24 +01:00
|
|
|
public LivingEntity attachedToEntity;
|
2024-04-12 21:14:06 +02:00
|
|
|
+ @Nullable public java.util.UUID spawningEntity; // Paper
|
2021-06-12 11:01:04 +02:00
|
|
|
|
|
|
|
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
|
|
|
|
super(type, world);
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -315,6 +316,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
2021-06-12 11:01:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE));
|
|
|
|
+ // Paper start
|
|
|
|
+ if (this.spawningEntity != null) {
|
2021-06-17 23:39:36 +02:00
|
|
|
+ nbt.putUUID("SpawningEntity", this.spawningEntity);
|
2021-06-12 11:01:04 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -331,7 +337,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
2021-06-12 11:01:04 +02:00
|
|
|
if (nbt.contains("ShotAtAngle")) {
|
|
|
|
this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle"));
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // Paper start
|
|
|
|
+ if (nbt.hasUUID("SpawningEntity")) {
|
|
|
|
+ this.spawningEntity = nbt.getUUID("SpawningEntity");
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
2023-08-06 02:21:59 +02:00
|
|
|
index ac7371882d15746e9353865635d0bb716f890c53..ba570f1c9654e1004e068a1efe2118f36c954505 100644
|
2021-06-12 11:01:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
2023-08-06 02:21:59 +02:00
|
|
|
@@ -217,6 +217,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
2021-06-12 11:01:04 +02:00
|
|
|
|
|
|
|
if (flag1) {
|
|
|
|
object = new FireworkRocketEntity(world, projectile, shooter, shooter.getX(), shooter.getEyeY() - 0.15000000596046448D, shooter.getZ(), true);
|
|
|
|
+ ((FireworkRocketEntity) object).spawningEntity = shooter.getUUID(); // Paper
|
|
|
|
} else {
|
|
|
|
object = CrossbowItem.getArrow(world, shooter, crossbow, projectile);
|
|
|
|
if (creative || simulated != 0.0F) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
2024-04-16 21:44:59 +02:00
|
|
|
index b342d23692ffd38b6eec66838162e9012f29ac09..3749cfca8f007973d1a2206d8f2ba15283a550e1 100644
|
2021-06-12 11:01:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -53,6 +53,7 @@ public class FireworkRocketItem extends Item {
|
2024-04-16 21:44:59 +02:00
|
|
|
vec3.z + (double)direction.getStepZ() * 0.15,
|
2024-04-12 21:14:06 +02:00
|
|
|
itemStack
|
|
|
|
);
|
2021-06-12 11:01:04 +02:00
|
|
|
+ fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper
|
|
|
|
level.addFreshEntity(fireworkRocketEntity);
|
|
|
|
itemStack.shrink(1);
|
|
|
|
}
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -66,6 +67,7 @@ public class FireworkRocketItem extends Item {
|
2021-06-12 11:01:04 +02:00
|
|
|
ItemStack itemStack = user.getItemInHand(hand);
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user);
|
|
|
|
+ fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper
|
|
|
|
world.addFreshEntity(fireworkRocketEntity);
|
|
|
|
if (!user.getAbilities().instabuild) {
|
|
|
|
itemStack.shrink(1);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
2023-12-05 18:20:55 +01:00
|
|
|
index 5ae87c370e47c545cef27a36e40da137e1ec656b..c9e15a9d82dee935293b2e7e233f5b9b2d822448 100644
|
2021-06-12 11:01:04 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
2023-08-14 01:32:51 +02:00
|
|
|
@@ -129,4 +129,11 @@ public class CraftFirework extends CraftProjectile implements Firework {
|
2021-06-12 11:01:04 +02:00
|
|
|
public void setShotAtAngle(boolean shotAtAngle) {
|
|
|
|
this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, shotAtAngle);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public java.util.UUID getSpawningEntity() {
|
|
|
|
+ return getHandle().spawningEntity;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|