Adjusts height to get above slabs to an entire block as empty minecarts clipped through single slab layers

This commit is contained in:
Kristian Knarvik 2021-10-12 03:48:13 +02:00
parent e14007380f
commit 0709c18e30

View File

@ -750,14 +750,15 @@ public class Portal {
*/ */
private Location adjustExitLocation(Location traveller, Location exitLocation) { private Location adjustExitLocation(Location traveller, Location exitLocation) {
if (exitLocation != null) { if (exitLocation != null) {
//Prevent traveller from spawning inside a slab
BlockData blockData = getWorld().getBlockAt(exitLocation).getBlockData(); BlockData blockData = getWorld().getBlockAt(exitLocation).getBlockData();
if ((blockData instanceof Bisected && ((Bisected) blockData).getHalf() == Bisected.Half.BOTTOM) || if ((blockData instanceof Bisected && ((Bisected) blockData).getHalf() == Bisected.Half.BOTTOM) ||
(blockData instanceof Slab) && ((Slab) blockData).getType() == Slab.Type.BOTTOM) { (blockData instanceof Slab) && ((Slab) blockData).getType() == Slab.Type.BOTTOM) {
Stargate.debug("adjustExitLocation", "Added half a block to get above a slab"); //Prevent traveller from spawning inside a slab
exitLocation.add(0, 0.5, 0); Stargate.debug("adjustExitLocation", "Added a block to get above a slab");
exitLocation.add(0, 1, 0);
} else if (blockData.getMaterial() == Material.WATER) { } else if (blockData.getMaterial() == Material.WATER) {
//If there's water outside, go one up to allow for boat teleportation //If there's water outside, go one up to allow for boat teleportation
Stargate.debug("adjustExitLocation", "Added a block to get above a block of water");
exitLocation.add(0, 1, 0); exitLocation.add(0, 1, 0);
} }