2016-12-28 08:25:35 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
2019-07-24 05:12:40 +02:00
|
|
|
Date: Wed, 28 Dec 2016 07:18:33 +0100
|
2016-12-28 08:25:35 +01:00
|
|
|
Subject: [PATCH] Firework API's
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java
|
|
|
|
+++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java
|
|
|
|
@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase {
|
|
|
|
return GameProfileSerializer.a(this.get(s));
|
|
|
|
}
|
|
|
|
|
|
|
|
+ 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/net/minecraft/world/entity/projectile/EntityFireworks.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class EntityFireworks extends IProjectile {
|
2019-12-12 00:43:22 +01:00
|
|
|
public static final DataWatcherObject<Boolean> SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
|
2016-12-28 08:25:35 +01:00
|
|
|
private int ticksFlown;
|
|
|
|
public int expectedLifespan;
|
2019-04-27 08:26:04 +02:00
|
|
|
- private EntityLiving ridingEntity;
|
2020-08-02 07:39:36 +02:00
|
|
|
+ public EntityLiving ridingEntity; // Paper - public
|
2020-06-25 14:04:34 +02:00
|
|
|
+ public java.util.UUID spawningEntity; // Paper
|
2016-12-28 08:25:35 +01:00
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
|
|
|
|
super(entitytypes, world);
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class EntityFireworks extends IProjectile {
|
2016-12-28 08:25:35 +01:00
|
|
|
}
|
2018-09-01 00:56:57 +02:00
|
|
|
|
2019-12-12 00:43:22 +01:00
|
|
|
nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.SHOT_AT_ANGLE));
|
2016-12-28 08:25:35 +01:00
|
|
|
+ // Paper start
|
2019-04-27 08:26:04 +02:00
|
|
|
+ if (this.spawningEntity != null) {
|
|
|
|
+ nbttagcompound.setUUID("SpawningEntity", this.spawningEntity);
|
2016-12-28 08:25:35 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
@Override
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class EntityFireworks extends IProjectile {
|
2019-04-27 08:26:04 +02:00
|
|
|
if (nbttagcompound.hasKey("ShotAtAngle")) {
|
2019-12-12 00:43:22 +01:00
|
|
|
this.datawatcher.set(EntityFireworks.SHOT_AT_ANGLE, nbttagcompound.getBoolean("ShotAtAngle"));
|
2016-12-28 08:25:35 +01:00
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // Paper start
|
|
|
|
+ if (nbttagcompound.hasUUID("SpawningEntity")) {
|
2019-04-27 08:26:04 +02:00
|
|
|
+ this.spawningEntity = nbttagcompound.getUUID("SpawningEntity");
|
2016-12-28 08:25:35 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
@Override
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemCrossbow.java b/src/main/java/net/minecraft/world/item/ItemCrossbow.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/ItemCrossbow.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemCrossbow.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
|
2019-07-24 05:12:40 +02:00
|
|
|
|
|
|
|
if (flag1) {
|
2020-06-25 14:04:34 +02:00
|
|
|
object = new EntityFireworks(world, itemstack1, entityliving, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true);
|
2019-07-24 05:12:40 +02:00
|
|
|
+ ((EntityFireworks) object).spawningEntity = entityliving.getUniqueID(); // Paper
|
|
|
|
} else {
|
|
|
|
object = a(world, entityliving, itemstack, itemstack1);
|
|
|
|
if (flag || f3 != 0.0F) {
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
2016-12-28 08:25:35 +01:00
|
|
|
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
|
2020-01-22 03:02:07 +01:00
|
|
|
Vec3D vec3d = itemactioncontext.getPos();
|
2019-12-12 00:43:22 +01:00
|
|
|
EnumDirection enumdirection = itemactioncontext.getClickedFace();
|
2020-06-25 14:04:34 +02: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 08:26:04 +02:00
|
|
|
+ entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2016-12-28 08:25:35 +01:00
|
|
|
world.addEntity(entityfireworks);
|
2018-07-17 22:32:05 +02:00
|
|
|
itemstack.subtract(1);
|
2016-12-28 08:25:35 +01:00
|
|
|
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
|
2019-04-27 08:26:04 +02:00
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2016-12-28 08:25:35 +01:00
|
|
|
if (!world.isClientSide) {
|
2019-04-27 08:26:04 +02: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
|
2016-12-28 08:25:35 +01:00
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
2019-04-27 08:26:04 +02:00
|
|
|
itemstack.subtract(1);
|
|
|
|
}
|
2016-12-28 08:25:35 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2016-12-28 08:25:35 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
2021-03-16 16:50:45 +01:00
|
|
|
@@ -0,0 +0,0 @@
|
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
+import net.minecraft.world.entity.EntityLiving;
|
|
|
|
import net.minecraft.world.entity.projectile.EntityFireworks;
|
|
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
import net.minecraft.world.item.Items;
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class CraftFirework extends CraftProjectile implements Firework {
|
2019-08-05 18:35:40 +02:00
|
|
|
public void setShotAtAngle(boolean shotAtAngle) {
|
2019-12-12 00:43:22 +01:00
|
|
|
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
|
2016-12-28 08:25:35 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
2020-06-25 14:04:34 +02:00
|
|
|
+ public java.util.UUID getSpawningEntity() {
|
2016-12-28 08:25:35 +01:00
|
|
|
+ return getHandle().spawningEntity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2020-06-25 14:04:34 +02:00
|
|
|
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
|
2021-03-16 16:50:45 +01:00
|
|
|
+ EntityLiving boostedEntity = getHandle().ridingEntity;
|
2020-06-25 14:04:34 +02:00
|
|
|
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
|
2016-12-28 08:25:35 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|