2021-11-11 03:53:27 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Mariell Hoversholm <proximyst@proximyst.com>
|
|
|
|
Date: Sun, 24 Oct 2021 16:19:26 -0400
|
|
|
|
Subject: [PATCH] Add Raw Byte Entity Serialization
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
2024-04-06 21:53:39 +02:00
|
|
|
index ca0b126bff245ed3fe69bc49c28499f7a7aa9556..6426d8585bba71b3e998b1eb078ac0fc67076d65 100644
|
2021-11-11 03:53:27 +01:00
|
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
2024-04-06 21:53:39 +02:00
|
|
|
@@ -158,6 +158,14 @@ public interface UnsafeValues {
|
2021-11-11 03:53:27 +01:00
|
|
|
|
|
|
|
ItemStack deserializeItem(byte[] data);
|
|
|
|
|
|
|
|
+ byte[] serializeEntity(org.bukkit.entity.Entity entity);
|
|
|
|
+
|
|
|
|
+ default org.bukkit.entity.Entity deserializeEntity(byte[] data, World world) {
|
|
|
|
+ return deserializeEntity(data, world, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ org.bukkit.entity.Entity deserializeEntity(byte[] data, World world, boolean preserveUUID);
|
|
|
|
+
|
|
|
|
/**
|
2023-02-15 23:10:14 +01:00
|
|
|
* Creates and returns the next EntityId available.
|
|
|
|
* <p>
|
2021-11-11 03:53:27 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
2024-04-06 21:53:39 +02:00
|
|
|
index 578c22b0aef9c89a3c33b75c33bcdc60bdab6b49..621ee3fd49ee96143df2f24889e9aef74448a544 100644
|
2021-11-11 03:53:27 +01:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
2024-03-23 22:26:17 +01:00
|
|
|
@@ -925,5 +925,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
2021-11-11 03:53:27 +01:00
|
|
|
*/
|
2023-10-03 13:55:12 +02:00
|
|
|
@Deprecated
|
2021-11-11 03:53:27 +01:00
|
|
|
@NotNull Set<Player> getTrackedPlayers();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Spawns the entity in the world at the given {@link Location} with the default spawn reason.
|
|
|
|
+ * <p>
|
|
|
|
+ * This will not spawn the entity if the entity is already spawned or has previously been despawned.
|
|
|
|
+ * <p>
|
|
|
|
+ * Also, this method will fire the same events as a normal entity spawn.
|
|
|
|
+ *
|
|
|
|
+ * @param location The location to spawn the entity at.
|
|
|
|
+ * @return Whether the entity was successfully spawned.
|
|
|
|
+ */
|
|
|
|
+ public default boolean spawnAt(@NotNull Location location) {
|
|
|
|
+ return spawnAt(location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Spawns the entity in the world at the given {@link Location} with the reason given.
|
|
|
|
+ * <p>
|
|
|
|
+ * This will not spawn the entity if the entity is already spawned or has previously been despawned.
|
|
|
|
+ * <p>
|
|
|
|
+ * Also, this method will fire the same events as a normal entity spawn.
|
|
|
|
+ *
|
|
|
|
+ * @param location The location to spawn the entity at.
|
|
|
|
+ * @param reason The reason for the entity being spawned.
|
|
|
|
+ * @return Whether the entity was successfully spawned.
|
|
|
|
+ */
|
|
|
|
+ public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason);
|
|
|
|
// Paper end
|
|
|
|
}
|