2021-06-11 14:02:28 +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-11 14:02:28 +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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
2021-06-12 11:01:04 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
2021-06-11 14:02:28 +02:00
|
|
|
public int lifetime;
|
2021-06-12 11:01:04 +02:00
|
|
|
@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-11 14:02:28 +02:00
|
|
|
|
|
|
|
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
|
|
|
|
super(type, world);
|
2021-06-12 11:01:04 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 11:01:04 +02:00
|
|
|
nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE));
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ if (this.spawningEntity != null) {
|
2021-06-17 23:39:36 +02:00
|
|
|
+ nbt.putUUID("SpawningEntity", this.spawningEntity);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-06-12 11:01:04 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
|
|
|
if (nbt.contains("ShotAtAngle")) {
|
|
|
|
this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle"));
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // Paper start
|
2021-06-12 11:01:04 +02:00
|
|
|
+ if (nbt.hasUUID("SpawningEntity")) {
|
|
|
|
+ this.spawningEntity = nbt.getUUID("SpawningEntity");
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+ // 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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
|
|
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
|
|
|
|
|
|
|
if (flag1) {
|
|
|
|
object = new FireworkRocketEntity(world, projectile, shooter, shooter.getX(), shooter.getEyeY() - 0.15000000596046448D, shooter.getZ(), true);
|
|
|
|
+ ((FireworkRocketEntity) object).spawningEntity = shooter.getUUID(); // Paper
|
|
|
|
} else {
|
2021-06-12 11:01:04 +02:00
|
|
|
object = CrossbowItem.getArrow(world, shooter, crossbow, projectile);
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
|
|
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item {
|
2024-04-12 21:14:06 +02:00
|
|
|
vec3.z + direction.getStepZ() * 0.15,
|
|
|
|
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);
|
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item {
|
2021-06-12 11:01:04 +02:00
|
|
|
ItemStack itemStack = user.getItemInHand(hand);
|
2021-06-11 14:02:28 +02:00
|
|
|
if (!world.isClientSide) {
|
2021-06-12 11:01:04 +02:00
|
|
|
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user);
|
|
|
|
+ fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper
|
|
|
|
world.addFreshEntity(fireworkRocketEntity);
|
|
|
|
if (!user.getAbilities().instabuild) {
|
|
|
|
itemStack.shrink(1);
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
|
|
@@ -0,0 +0,0 @@ public class CraftFirework extends CraftProjectile implements Firework {
|
|
|
|
public void setShotAtAngle(boolean shotAtAngle) {
|
2021-06-12 11:01:04 +02:00
|
|
|
this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, shotAtAngle);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public java.util.UUID getSpawningEntity() {
|
|
|
|
+ return getHandle().spawningEntity;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|