Un-does the outwards offset reduction for teleported entities

This commit is contained in:
Kristian Knarvik 2022-01-27 21:56:19 +01:00
parent f6438eb872
commit f70ba24e95
2 changed files with 8 additions and 3 deletions

View File

@ -401,7 +401,6 @@ portalInfoServer=Server: %server%
- Adds a config option to set the exit velocity of any players exiting a stargate - Adds a config option to set the exit velocity of any players exiting a stargate
- Adjusts vehicle teleportation a bit to prevent passengers' exit rotation from being wrong - Adjusts vehicle teleportation a bit to prevent passengers' exit rotation from being wrong
- Reduces the outwards offset of teleported entities
#### \[Version 0.9.3.1] EpicKnarvik97 fork #### \[Version 0.9.3.1] EpicKnarvik97 fork

View File

@ -13,6 +13,7 @@ import org.bukkit.Material;
import org.bukkit.block.data.Bisected; import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Slab; import org.bukkit.block.data.type.Slab;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -140,9 +141,14 @@ public abstract class Teleporter {
if (entitySize > 1) { if (entitySize > 1) {
double entityOffset; double entityOffset;
if (portal.getOptions().isAlwaysOn()) { if (portal.getOptions().isAlwaysOn()) {
entityOffset = (entityBoxSize / 2D) - 1; entityOffset = (entityBoxSize / 2D);
} else { } else {
entityOffset = (entitySize / 2D) - 2; entityOffset = (entitySize / 2D) - 1;
}
//If a horse has a player riding it, the player will spawn inside the roof of a standard portal unless it's
// moved one block out.
if (entity instanceof AbstractHorse) {
entityOffset += 1;
} }
exitLocation = DirectionHelper.moveLocation(exitLocation, 0, 0, entityOffset, portal.getYaw()); exitLocation = DirectionHelper.moveLocation(exitLocation, 0, 0, entityOffset, portal.getYaw());
} }