Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
f17519338b
* Expose server build information * squash patches * final tweaks --------- Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: masmc05 <masmc05@gmail.com>
63 Zeilen
2.7 KiB
Diff
63 Zeilen
2.7 KiB
Diff
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
|
|
index 891204af265ac4ef1f654407421e9962c0ff549b..20ddbfdad6856135a4c6a4778f81caee953f0fb4 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -167,6 +167,14 @@ public interface UnsafeValues {
|
|
|
|
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);
|
|
+
|
|
/**
|
|
* Creates and returns the next EntityId available.
|
|
* <p>
|
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
|
index 795e799fec7cfd65a0e08bb3f941148d85ff4c3b..461a48f8aa049e9b9e13acca3d54978212d9688c 100644
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
|
@@ -942,5 +942,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|
*/
|
|
@Deprecated
|
|
@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
|
|
}
|