geforkt von Mirrors/Paper
4cdbb0c86c
Upstream has released updates that appear 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: 044d4ee9 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning 57b73d57 PR-913: Deprecate Projectile#doesBounce() and #setBounce() 43373c44 PR-904: Update FeatureFlag for 1.20.2 a7bbbf0c PR-911: Expand DataPack API with 1.20.2 pack version methods 0341e3a0 SPIGOT-7489: Add TeleportDuration to Display Entity bcd8d2aa PR-912: Update Minecraft Wiki URLs CraftBukkit Changes: 99aafc222 Increase outdated build delay dab849f08 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning 041b29ae3 Upgrade specialsource-maven-plugin 851a32cff PR-1263: Remove unused implementation of AbstractProjectile#doesBounce() and #setBounce() 251af0da3 PR-1261: Expand DataPack API with 1.20.2 pack version methods 46e4ba627 Upgrade specialsource-maven-plugin df3738a24 SPIGOT-7489: Add TeleportDuration to Display Entity 8d0fea457 PR-1262: Update Minecraft Wiki URLs e62905aab SPIGOT-7490: Fix entity equipment updates Spigot Changes: a0f3d486 Rebuild patches
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 c9fdcda4d86a8419852d7acc0e85fe51656a829b..943736891bf58e620c47391b37c1d00610f68744 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -130,6 +130,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 a6f9fb065a9e3e56b86ce5f606f86e681a90d7e6..962989e74a66dadab2a8951ccc85ef0c49f8da6b 100644
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
|
@@ -834,5 +834,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|
* @return players in tracking range
|
|
*/
|
|
@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
|
|
}
|