is happen on paper 1.20 build 169 teleportation is a bit below vanilla

This commit is contained in:
MidnightTale 2023-08-29 17:33:07 +07:00
commit f301f159e6
3 changed files with 10 additions and 6 deletions

View file

@ -18,7 +18,7 @@ public class FoliaFlow extends JavaPlugin {
public static double horizontalCoefficient; public static double horizontalCoefficient;
public static double verticalCoefficient; public static double verticalCoefficient;
public static double spawnHeight; public static double spawnHeight;
public static double foliaOffset; public static double TeleportOffset;
@Override @Override
public void onEnable() { public void onEnable() {
@ -51,6 +51,10 @@ public class FoliaFlow extends JavaPlugin {
double horizontalCoefficient = isFolia ? 1.499 : 1.3; double horizontalCoefficient = isFolia ? 1.499 : 1.3;
config.set("horizontal_coefficient", horizontalCoefficient); config.set("horizontal_coefficient", horizontalCoefficient);
} }
if (!config.contains("teleport_offset")) {
double telportCoefficient = isFolia ? 0.5 : 6;
config.set("teleport_offset", telportCoefficient);
}
try { try {
config.save(configFile); config.save(configFile);
} catch (IOException e) { } catch (IOException e) {
@ -64,7 +68,7 @@ public class FoliaFlow extends JavaPlugin {
horizontalCoefficient = getConfig().getDouble("horizontal_coefficient"); horizontalCoefficient = getConfig().getDouble("horizontal_coefficient");
verticalCoefficient = getConfig().getDouble("vertical_coefficient"); verticalCoefficient = getConfig().getDouble("vertical_coefficient");
spawnHeight = getConfig().getDouble("spawn_height"); spawnHeight = getConfig().getDouble("spawn_height");
foliaOffset = getConfig().getDouble("folia_offset"); TeleportOffset = getConfig().getDouble("teleport_offset");
} }
private void register() { private void register() {

View file

@ -38,8 +38,8 @@ public class PortalWatcher implements Listener {
// Add vector seems vanilla. // Add vector seems vanilla.
SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance, () -> { SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance, () -> {
// Portal teleportation on Folia is a bit below vanilla, so we teleport it above // Portal teleportation is a bit below vanilla, so we teleport it above (happen on paper 1.20 b169)
if (SchedulerUtil.isFolia()) dummy.teleportAsync(dummy.getLocation().add(0, FoliaFlow.foliaOffset, 0)); dummy.teleportAsync(dummy.getLocation().add(0, FoliaFlow.TeleportOffset, 0));
dummy.setVelocity(dummyVel); dummy.setVelocity(dummyVel);
}, },
2 2

View file

@ -6,7 +6,7 @@
# Optimize value for horizontal_coefficient # Optimize value for horizontal_coefficient
# - Folia (1.499) # - Folia (1.499)
# - Paper (1.3) # - Paper (1.3)
horizontal_coefficient: 1.499 horizontal_coefficient: 1.3
vertical_coefficient: -1.7 vertical_coefficient: -1.7
spawn_height: 0.08 spawn_height: 0.08
folia_offset: -1 teleport_offset: 0.5