Paper/Spigot-Server-Patches/0159-Firework-API-s.patch
Shane Freeder fb25dc17c6 Updated Upstream (Bukkit/CraftBukkit)
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:
da08d022 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
0cef14e4 Remove draft API from selectEntities

CraftBukkit Changes:
a46fdbc6 Remove outdated build delay.
3697519b SPIGOT-4708: Fix ExactChoice recipes neglecting material
9ead7009 SPIGOT-4677: Add minecraft.admin.command_feedback permission
c3749a23 Remove the Damage tag from items when it is 0.
f74c7b95 SPIGOT-4706: Can't interact with active item
494eef45 Mention requirement of JIRA ticket for bug fixes
51d62dec SPIGOT-4702: Exception when middle clicking certain slots
be557e69 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
2019-04-22 22:36:14 +01:00

135 Zeilen
5.4 KiB
Diff

From 9432bcdfe213cdd8fa3b301413db8e7b0bae3b3b 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 9b6d217df8..9764c76fba 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 68bd2af261..dbb422e9da 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 8c5d6c1d38..d4165f7e44 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 7b3b206823..b39e33f4f0 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.21.0