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
|
2022-12-07 19:52:24 +01:00
|
|
|
index 4abcdc515411372006ff5d33510bdd64092c186a..5406925cd66f46ab8744123c670d72cea7bfc3a1 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
|
2021-06-16 00:24:12 +02:00
|
|
|
@@ -39,6 +39,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);
|
2022-03-01 06:43:03 +01:00
|
|
|
@@ -318,6 +319,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
|
2022-03-01 06:43:03 +01:00
|
|
|
@@ -334,7 +340,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
|
2022-12-07 19:52:24 +01:00
|
|
|
index 4b8ad27c8682f112c4964849d9bdfcf4c355701f..48626d564c9fb4630b51858edd124b56af2d7ca0 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
|
2022-06-07 22:12:48 +02:00
|
|
|
@@ -220,6 +220,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
|
2022-12-07 19:52:24 +01:00
|
|
|
index 1d99d03c1ce0a647b053e8b7bd1e2da58805c4f8..854856ca742dff800ac5d7bf0af4f79cf631540b 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
|
2022-12-07 19:52:24 +01:00
|
|
|
@@ -45,6 +45,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);
|
|
|
|
}
|
2022-12-07 19:52:24 +01:00
|
|
|
@@ -58,6 +59,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
|
2022-09-12 13:31:45 +02:00
|
|
|
index 59d5c314711b4ec239e5bcb4272b11ed72705c5a..c242f654c88ca1773429348939d3bb2ffae3768c 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
|
2022-09-12 13:31:45 +02:00
|
|
|
@@ -135,4 +135,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
|
|
|
|
}
|