geforkt von Mirrors/Paper
ef0e5a642d
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: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
92 Zeilen
5.0 KiB
Diff
92 Zeilen
5.0 KiB
Diff
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
|
|
|
|
|
|
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 ba13507263d78d34eb8d3038c437229c0469d476..61252ef8a79bac0ea2d3d231ec6b12166f39d072 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
|
@@ -39,6 +39,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
|
public int lifetime;
|
|
@Nullable
|
|
public LivingEntity attachedToEntity; // PAIL private -> public
|
|
+ public java.util.UUID spawningEntity; // Paper
|
|
|
|
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
|
|
super(type, world);
|
|
@@ -318,6 +319,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
|
}
|
|
|
|
nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE));
|
|
+ // Paper start
|
|
+ if (this.spawningEntity != null) {
|
|
+ nbt.putUUID("SpawningEntity", this.spawningEntity);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
@@ -334,7 +340,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
|
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
|
|
index 17b797a036ac0f58b58f627dc61ac503c8f321db..d86ec8c4c1c3e7974463a545d80ed9744de0fbbb 100644
|
|
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
@@ -220,6 +220,7 @@ 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 {
|
|
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
|
|
index cdf35c5873f68245891241c0efa3bcf5658c3f6d..766af1f45b14654d3655a06ae0bfb0d4cfbdff7a 100644
|
|
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
@@ -44,6 +44,7 @@ public class FireworkRocketItem extends Item {
|
|
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);
|
|
}
|
|
@@ -57,6 +58,7 @@ public class FireworkRocketItem extends Item {
|
|
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
|
|
index 59d5c314711b4ec239e5bcb4272b11ed72705c5a..c242f654c88ca1773429348939d3bb2ffae3768c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
@@ -135,4 +135,11 @@ public class CraftFirework extends CraftProjectile implements Firework {
|
|
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
|
|
}
|