9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00

Some changes to optimizations and api (#172)

* Add faster random generator for Entity random

* Option for replace worldgen random with L64X128MixRandomSource & Cleanup

* Allocate 1 thread for AsyncLocator by default

* Rename to worldgen

* Add config option for backed random generator

* Add SplittableGenerator check

* Cache random generator

* Revert cache
Caching RNGs will cause some issues during worldgen

* Set to final & cleanup

* LevelChunkMixin

* Filter null values

* Use Xoroshiro128PlusPlus by default

* Benchmark results

* Revert changes

* Better smooth teleport api

* Set seed to 0
This commit is contained in:
Kobe ⑧
2024-11-29 07:26:03 +08:00
committed by GitHub
parent a3f3dbab2f
commit 2c4d9d40d1
12 changed files with 455 additions and 94 deletions

View File

@@ -6,25 +6,41 @@ Subject: [PATCH] Slice: Smooth Teleports
Original license: MIT
Original project: https://github.com/Cryptite/Slice
Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d5df69a2e5b228545dfaaaa98ce88ec0da806315..a6d43ac0ee1b4bac6efc3283c7eea643a45e2d93 100644
index f96ca62d81db8362a9f74f00ff54b151f96c04fe..f1d9f17b3ef15e2db5dabe563f7c56fa9c1be651 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3691,6 +3691,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -3691,6 +3691,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
String getClientBrandName();
// Paper end
+ /**
+ * This abuses some of how Minecraft works and allows teleporting a player to another world without
+ * This abuses some of how Minecraft works and attempts to teleport a player to another world without
+ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still
+ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world,
+ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
+ *
+ * @param location New location to teleport this Player to
+ * @deprecated use {@link #teleportWithoutRespawnOptionally(Location)}
+ */
+ // Slice start
+ @org.jetbrains.annotations.ApiStatus.Experimental
+ @Deprecated(since = "1.21.1", forRemoval = true)
+ void teleportWithoutRespawn(@NotNull Location location);
+
+ /**
+ * This abuses some of how Minecraft works and attempts to teleport a player to another world without
+ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still
+ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world,
+ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
+ *
+ * @param location New location to teleport this Player to
+ * @return Whether the teleport was successful
+ */
+ @org.jetbrains.annotations.ApiStatus.Experimental
+ boolean teleportWithoutRespawnOptionally(@NotNull Location location);
+ // Slice end
+
// Paper start - Teleport API