Merge pull request #15 from KaiijuMC/master

Vanilla parity fix on Folia
This commit is contained in:
Mid 2023-04-26 18:54:27 +07:00 • committed by GitHub
commit 964c9c192e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -16,7 +16,7 @@ public class SchedulerUtil {
return false;
}
private static Boolean isFolia() {
public static Boolean isFolia() {
if (IS_FOLIA == null) IS_FOLIA = tryFolia();
return IS_FOLIA;
}

View file

@ -25,7 +25,7 @@ public class PortalWatcher implements Listener {
Vector vel = entity.getVelocity();
Block movingTo = getBlockMovingTo(loc, vel);
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
if(movingTo.getType() == Material.END_PORTAL){
Location spawnLoc = movingTo.getLocation();
spawnLoc.add(0.5, 0.5, 0.5);
@ -37,8 +37,11 @@ public class PortalWatcher implements Listener {
dummy.setVelocity(dummyVel);
// Add vector seems vanilla.
SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance,
() -> dummy.setVelocity(dummyVel.add(new Vector(0, 0.45, 0))),
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));
dummy.setVelocity(dummyVel.add(new Vector(0, 0.2, 0)));
},
2
);
}