Vanilla parity fix on Folia
This commit is contained in:
parent
276c1b2191
commit
cfa36f99e5
2 changed files with 7 additions and 5 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);
|
||||||
|
|
||||||
|
|
@ -33,12 +33,14 @@ public class PortalWatcher implements Listener {
|
||||||
Vector dummyVel = vel.clone();
|
Vector dummyVel = vel.clone();
|
||||||
dummyVel.setY(-dummyVel.getY());
|
dummyVel.setY(-dummyVel.getY());
|
||||||
dummyVel.multiply(1.3); // This seems vanilla.
|
dummyVel.multiply(1.3); // This seems vanilla.
|
||||||
dummyVel.add(new Vector(0, -0.2, 0));
|
|
||||||
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);
|
||||||
|
},
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue