testserver/Spigot-Server-Patches/0132-Firework-API-s.patch

117 lines
6.0 KiB
Diff
Raw Normal View History

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/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 46b315036bbe576b2bf9938db73d9c5931003cc1..a646dc9f030ad1f76ba2b7bb1bc7897cd34b648c 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
2020-06-25 12:04:34 +00:00
@@ -13,7 +13,8 @@ public class EntityFireworks extends IProjectile {
2019-12-11 23:43:22 +00:00
public static final DataWatcherObject<Boolean> SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
private int ticksFlown;
public int expectedLifespan;
2019-04-27 06:26:04 +00:00
- private EntityLiving ridingEntity;
+ public EntityLiving ridingEntity; // Paper - public
2020-06-25 12:04:34 +00:00
+ public java.util.UUID spawningEntity; // Paper
2019-04-27 06:26:04 +00:00
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
super(entitytypes, world);
@@ -260,6 +261,11 @@ public class EntityFireworks extends IProjectile {
}
2019-12-11 23:43:22 +00:00
nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.SHOT_AT_ANGLE));
+ // Paper start
2019-04-27 06:26:04 +00:00
+ if (this.spawningEntity != null) {
+ nbttagcompound.setUUID("SpawningEntity", this.spawningEntity);
+ }
+ // Paper end
}
2019-04-27 06:26:04 +00:00
@Override
@@ -276,7 +282,11 @@ public class EntityFireworks extends IProjectile {
2019-04-27 06:26:04 +00:00
if (nbttagcompound.hasKey("ShotAtAngle")) {
2019-12-11 23:43:22 +00:00
this.datawatcher.set(EntityFireworks.SHOT_AT_ANGLE, nbttagcompound.getBoolean("ShotAtAngle"));
}
-
+ // Paper start
+ if (nbttagcompound.hasUUID("SpawningEntity")) {
2019-04-27 06:26:04 +00:00
+ this.spawningEntity = nbttagcompound.getUUID("SpawningEntity");
+ }
+ // Paper end
}
2019-04-27 06:26:04 +00:00
@Override
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
index 9e17a002218ce82c0e1033f3487f878463970d17..14c0e7382292b3d39858d4d957df8016c301c712 100644
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
2020-06-25 12:04:34 +00:00
@@ -183,6 +183,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
if (flag1) {
2020-06-25 12:04:34 +00:00
object = new EntityFireworks(world, itemstack1, entityliving, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true);
+ ((EntityFireworks) object).spawningEntity = entityliving.getUniqueID(); // Paper
} else {
object = a(world, entityliving, itemstack, itemstack1);
if (flag || f3 != 0.0F) {
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
2020-06-25 12:04:34 +00:00
index 12ae2d9b747b69533fab2487ad55626c50c1d620..6cc243025f5bdac9be39f8a88a018893a9941dba 100644
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
2019-12-11 23:43:22 +00:00
@@ -18,6 +18,7 @@ public class ItemFireworks extends Item {
Vec3D vec3d = itemactioncontext.getPos();
2019-12-11 23:43:22 +00:00
EnumDirection enumdirection = itemactioncontext.getClickedFace();
2020-06-25 12:04:34 +00:00
EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
2019-04-27 06:26:04 +00:00
+ entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 03:15:55 +00:00
world.addEntity(entityfireworks);
2018-07-17 20:32:05 +00:00
itemstack.subtract(1);
2019-12-11 23:43:22 +00:00
@@ -32,7 +33,11 @@ public class ItemFireworks extends Item {
2019-04-27 06:26:04 +00:00
ItemStack itemstack = entityhuman.b(enumhand);
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 03:15:55 +00:00
if (!world.isClientSide) {
2019-04-27 06:26:04 +00:00
- world.addEntity(new EntityFireworks(world, itemstack, entityhuman));
+ // Paper start
+ final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
+ entityfireworks.spawningEntity = entityhuman.getUniqueID();
+ world.addEntity(entityfireworks);
+ // Paper end
if (!entityhuman.abilities.canInstantlyBuild) {
2019-04-27 06:26:04 +00:00
itemstack.subtract(1);
}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
2020-06-25 12:04:34 +00:00
index c16ff6723d3fd191b990002d40dc021d7870555d..9c445902e6adc05773497bc4444203ca364e4f5c 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
2020-06-25 12:04:34 +00:00
@@ -145,6 +145,7 @@ public class NBTTagCompound implements NBTBase {
return GameProfileSerializer.a(this.get(s));
}
2020-06-25 12:04:34 +00:00
+ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER
public boolean b(String s) {
NBTBase nbtbase = this.get(s);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index d984a7a78e9f8536abf7c30df9aa59dbfc7984ce..f3066e6c781bcee72c235abcef5060fb080892d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
2020-06-25 12:04:34 +00:00
@@ -78,4 +78,17 @@ public class CraftFirework extends CraftProjectile implements Firework {
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2415) * fixup patch and rebuild * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears 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: bde198c9 SPIGOT-5246: PlayerQuitEvent.get/setQuitMessage() is incorrectly marked as NotNull 24ad5a79 SPIGOT-5240: Vector.angle not valid for angles very close to each other a143db9a SPIGOT-5231: ShotAtAngle API for Fireworks 10db5c3d SPIGOT-5226: Update Javadoc of PlayerDeathEvent CraftBukkit Changes: 1ec1b05e SPIGOT-5245: Unneeded cast to WorldNBTStorage in CraftWorld#getWorldFolder e5e8eec2 SPIGOT-5241: setAttributeModifiers does not work on untouched stack 803eaa31 SPIGOT-5231: ShotAtAngle API for Fireworks 7881d2ae SPIGOT-5237: Horses, pigs do not drop their inventory 06efc9ec Don't accept connections until all plugins have enabled da62a66a SPIGOT-5225: World handle isn't closed if world is unloaded without saving 104b3831 SPIGOT-5222: Cannot get Long values from Entity memory f0b3fe43 SPIGOT-5220: Server CPU usage reaches 100% when stdin is null Spigot Changes: e5b1b5db SPIGOT-5235: Destroy expired area effect clouds / fireworks that are inactive cbcc8e87 Make region files more reliable to write to 8887c5f4 Remove redundant late-bind option dac29063 Rebuild patches * Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper * Fix some issues with the death event - Entities potentially entering a glitched state to the client where they appear to be falling over - Donkeys losing their chest if the event was cancelled (only an issue since the upstream merge) - Some wither death logic running for an entity killed by a wither
2019-08-05 16:35:40 +00:00
public void setShotAtAngle(boolean shotAtAngle) {
2019-12-11 23:43:22 +00:00
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
}
+
+ // Paper start
+ @Override
2020-06-25 12:04:34 +00:00
+ public java.util.UUID getSpawningEntity() {
+ return getHandle().spawningEntity;
+ }
+
+ @Override
2020-06-25 12:04:34 +00:00
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
+ net.minecraft.server.EntityLiving boostedEntity = getHandle().ridingEntity;
2020-06-25 12:04:34 +00:00
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
+ }
+ // Paper end
}