Merge pull request #15 from KaiijuMC/master
Vanilla parity fix on Folia
This commit is contained in:
commit
964c9c192e
2 changed files with 7 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ public class SchedulerUtil {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean isFolia() {
|
public static Boolean isFolia() {
|
||||||
if (IS_FOLIA == null) IS_FOLIA = tryFolia();
|
if (IS_FOLIA == null) IS_FOLIA = tryFolia();
|
||||||
return IS_FOLIA;
|
return IS_FOLIA;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public class PortalWatcher implements Listener {
|
||||||
Vector vel = entity.getVelocity();
|
Vector vel = entity.getVelocity();
|
||||||
Block movingTo = getBlockMovingTo(loc, vel);
|
Block movingTo = getBlockMovingTo(loc, vel);
|
||||||
|
|
||||||
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
|
if(movingTo.getType() == Material.END_PORTAL){
|
||||||
Location spawnLoc = movingTo.getLocation();
|
Location spawnLoc = movingTo.getLocation();
|
||||||
spawnLoc.add(0.5, 0.5, 0.5);
|
spawnLoc.add(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
|
|
@ -37,8 +37,11 @@ public class PortalWatcher implements Listener {
|
||||||
dummy.setVelocity(dummyVel);
|
dummy.setVelocity(dummyVel);
|
||||||
|
|
||||||
// Add vector seems vanilla.
|
// Add vector seems vanilla.
|
||||||
SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance,
|
SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance, () -> {
|
||||||
() -> dummy.setVelocity(dummyVel.add(new Vector(0, 0.45, 0))),
|
// 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
|
2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue