Fixes some things regarding vehicle teleportation

Adds extra space between the portal and the vehicle if the destination portal is always on
Fixes a bug causing vehicles not being detected soon enough
Fixes boats facing into the portal rather than out from the portal
Fixes boats spawning inside water rather than on top of it if water is in front of a portal
This commit is contained in:
2021-02-27 22:34:10 +01:00
parent ba64572254
commit da32cf11d1
6 changed files with 45 additions and 17 deletions

View File

@ -18,10 +18,20 @@ public final class EntityHelper {
* contain the entity.</p>
*
* @param entity <p>The entity to get max size for</p>
* @return <p></p>
* @return <p>The max size of the entity</p>
*/
public static int getEntityMaxSizeInt(Entity entity) {
return (int) Math.ceil((float) getEntityMaxSize(entity));
}
/**
* Gets the max size of an entity along its x and z axis
*
* @param entity <p>The entity to get max size for</p>
* @return <p>The max size of the entity</p>
*/
public static double getEntityMaxSize(Entity entity) {
return Math.ceil((float) Math.max(entity.getBoundingBox().getWidthX(), entity.getBoundingBox().getWidthZ()));
return Math.max(entity.getBoundingBox().getWidthX(), entity.getBoundingBox().getWidthZ());
}
}