Skip to content

Commit

Permalink
Fix blocks between with negative y-coordinate (#4647)
Browse files Browse the repository at this point in the history
  • Loading branch information
AyhamAl-Ali authored Mar 8, 2022
1 parent 8fc314d commit 31bc6c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/ch/njol/skript/util/BlockLineIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package ch.njol.skript.util;

import ch.njol.skript.bukkitutil.WorldUtils;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.util.BlockIterator;
Expand Down Expand Up @@ -85,7 +86,7 @@ public BlockLineIterator(final Block start, final Vector dir, final double dist)
private static Vector fitInWorld(final Location l, final Vector dir) {
if (0 <= l.getBlockY() && l.getBlockY() < l.getWorld().getMaxHeight())
return l.toVector();
final double y = Math2.fit(0, l.getY(), l.getWorld().getMaxHeight());
final double y = Math2.fit(WorldUtils.getWorldMinHeight(l.getWorld()), l.getY(), l.getWorld().getMaxHeight());
if (Math.abs(dir.getY()) < Skript.EPSILON)
return new Vector(l.getX(), y, l.getZ());
final double dy = y - l.getY();
Expand Down

0 comments on commit 31bc6c4

Please sign in to comment.