3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/Spigot-Server-Patches/0160-Firework-API-s.patch
Shane Freeder b68b282439
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:29:51 +00:00

135 Zeilen
5.4 KiB
Diff

From d3c8e46af030489991d076c9e2cc636b93013f8f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 28 Dec 2016 01:18:33 -0500
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 9b6d217df..9764c76fb 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
+
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends Entity {
@@ -10,7 +12,8 @@ public class EntityFireworks extends Entity {
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.b);
private int ticksFlown;
public int expectedLifespan;
- private EntityLiving e;
+ public UUID spawningEntity; // Paper
+ private EntityLiving e;public EntityLiving getBoostedEntity() { return e; } // Paper - OBFHELPER
public EntityFireworks(World world) {
super(EntityTypes.FIREWORK_ROCKET, world);
@@ -197,6 +200,12 @@ public class EntityFireworks extends Entity {
nbttagcompound.set("FireworksItem", itemstack.save(new NBTTagCompound()));
}
+ // Paper start
+ if (spawningEntity != null) {
+ nbttagcompound.setUUID("SpawningEntity", spawningEntity);
+ }
+ // Paper end
+
}
public void a(NBTTagCompound nbttagcompound) {
@@ -207,7 +216,11 @@ public class EntityFireworks extends Entity {
if (!itemstack.isEmpty()) {
this.datawatcher.set(EntityFireworks.FIREWORK_ITEM, itemstack);
}
-
+ // Paper start
+ if (nbttagcompound.hasUUID("SpawningEntity")) {
+ spawningEntity = nbttagcompound.getUUID("SpawningEntity");
+ }
+ // Paper end
}
public boolean bk() {
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
index 68bd2af26..dbb422e9d 100644
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
@@ -16,6 +16,7 @@ public class ItemFireworks extends Item {
BlockPosition blockposition = itemactioncontext.getClickPosition();
ItemStack itemstack = itemactioncontext.getItemStack();
EntityFireworks entityfireworks = new EntityFireworks(world, (double) ((float) blockposition.getX() + itemactioncontext.m()), (double) ((float) blockposition.getY() + itemactioncontext.n()), (double) ((float) blockposition.getZ() + itemactioncontext.o()), itemstack);
+ entityfireworks.spawningEntity = itemactioncontext.b.getUniqueID(); // Paper
world.addEntity(entityfireworks);
itemstack.subtract(1);
@@ -30,6 +31,7 @@ public class ItemFireworks extends Item {
if (!world.isClientSide) {
EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
+ entityfireworks.spawningEntity = entityhuman.getUniqueID(); // Paper
world.addEntity(entityfireworks);
if (!entityhuman.abilities.canInstantlyBuild) {
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index 8c5d6c1d3..d4165f7e4 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -107,7 +107,7 @@ public class NBTTagCompound implements NBTBase {
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
}
- public boolean b(String s) {
+ public boolean hasUUID(String s) { return b(s); } public boolean b(String s) { // Paper - OBFHELPER
return this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 7b3b20682..b39e33f4f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityFireworks;
+import net.minecraft.server.EntityLiving;
import net.minecraft.server.ItemStack;
import net.minecraft.server.Items;
@@ -9,9 +10,11 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.meta.FireworkMeta;
import java.util.Random;
+import java.util.UUID;
public class CraftFirework extends CraftEntity implements Firework {
@@ -70,4 +73,18 @@ public class CraftFirework extends CraftEntity implements Firework {
public void detonate() {
getHandle().expectedLifespan = 0;
}
+
+ // Paper start
+
+ @Override
+ public UUID getSpawningEntity() {
+ return getHandle().spawningEntity;
+ }
+
+ @Override
+ public LivingEntity getBoostedEntity() {
+ EntityLiving boostedEntity = getHandle().getBoostedEntity();
+ return boostedEntity != null ? (LivingEntity) boostedEntity.getBukkitEntity() : null;
+ }
+ // Paper end
}
--
2.20.1