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
|
2023-06-07 21:19:26 +02:00
|
|
|
index b16add0be6ac782a7e40be0cdeea4c1829a19d4e..288910fb168ddc5d3a61971778b8038a56772fa8 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
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -38,6 +38,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;
|
2021-06-12 11:01:04 +02:00
|
|
|
+ public java.util.UUID spawningEntity; // Paper
|
|
|
|
|
|
|
|
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
|
|
|
|
super(type, world);
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -317,6 +318,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
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -333,7 +339,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
|
2023-09-22 19:59:56 +02:00
|
|
|
index 5cafb6f0b507127665393741b372286da098d603..7c627d27300247db9122ab2081049345ef306073 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
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -46,6 +46,7 @@ public class FireworkRocketItem extends Item {
|
2021-06-12 11:01:04 +02:00
|
|
|
Vec3 vec3 = context.getClickLocation();
|
|
|
|
Direction direction = context.getClickedFace();
|
|
|
|
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, context.getPlayer(), vec3.x + (double)direction.getStepX() * 0.15D, vec3.y + (double)direction.getStepY() * 0.15D, vec3.z + (double)direction.getStepZ() * 0.15D, itemStack);
|
|
|
|
+ fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper
|
|
|
|
level.addFreshEntity(fireworkRocketEntity);
|
|
|
|
itemStack.shrink(1);
|
|
|
|
}
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -59,6 +60,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-08-14 01:32:51 +02:00
|
|
|
index 437fd93bf0de2b4fd74b5f94d0b931ed10f2b6ec..7417e3d51497fe7e62e108d83ee4b70942972144 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
|
|
|
|
}
|