From c9a8159ea8ccc2f8dc07b4b673cd0d842f199e9c Mon Sep 17 00:00:00 2001 From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:41:22 +0300 Subject: [PATCH] Configurable FoliaOffset --- src/main/java/xyz/hynse/foliaflow/FoliaFlow.java | 2 ++ src/main/java/xyz/hynse/foliaflow/watcher/PortalWatcher.java | 2 +- src/main/resources/config.yml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/xyz/hynse/foliaflow/FoliaFlow.java b/src/main/java/xyz/hynse/foliaflow/FoliaFlow.java index 3807b86..b66955b 100644 --- a/src/main/java/xyz/hynse/foliaflow/FoliaFlow.java +++ b/src/main/java/xyz/hynse/foliaflow/FoliaFlow.java @@ -11,6 +11,7 @@ public class FoliaFlow extends JavaPlugin { public static double horizontalCoefficient; public static double verticalCoefficient; public static double spawnHeight; + public static double foliaOffset; @Override public void onEnable() { @@ -25,6 +26,7 @@ public class FoliaFlow extends JavaPlugin { horizontalCoefficient = getConfig().getDouble("horizontal_coefficient"); verticalCoefficient = getConfig().getDouble("vertical_coefficient"); spawnHeight = getConfig().getDouble("spawn_height"); + foliaOffset = getConfig().getDouble("folia_offset"); } private void register() { diff --git a/src/main/java/xyz/hynse/foliaflow/watcher/PortalWatcher.java b/src/main/java/xyz/hynse/foliaflow/watcher/PortalWatcher.java index 5e0f8f8..7626f53 100644 --- a/src/main/java/xyz/hynse/foliaflow/watcher/PortalWatcher.java +++ b/src/main/java/xyz/hynse/foliaflow/watcher/PortalWatcher.java @@ -39,7 +39,7 @@ public class PortalWatcher implements Listener { // Add vector seems vanilla. SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance, () -> { // Portal teleportation on Folia is a bit below vanilla, so we teleport it above - if (SchedulerUtil.isFolia()) dummy.teleportAsync(dummy.getLocation().add(0, 0.5, 0)); + if (SchedulerUtil.isFolia()) dummy.teleportAsync(dummy.getLocation().add(0, FoliaFlow.foliaOffset, 0)); dummy.setVelocity(dummyVel); }, 2 diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c8e1daf..2d26684 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -6,3 +6,4 @@ vertical_coefficient: -1.7 horizontal_coefficient: 1.46 spawn_height: 0.08 +folia_offset: 0.08