1.8.8 BlockIterator Bug

Discussion in 'Spigot Plugin Development' started by VytskaLT, Jul 2, 2021.

  1. There is a rare bug with BlockIterator that throws this exception when calling the constructor:
    Code (Java):
    java.lang.IllegalStateException: Start block missed in BlockIterator
    This issue is 10 years old and still hasn't been fixed! This is the oldest post I could find about it: https://bukkit.org/threads/getlineofsight-start-block-missed-in-blockiterator.44528/
    And this is code with hard coded values that always reproduces the issue:
    Code (Java):
    BlockIterator iterator = new BlockIterator(player.getWorld(),
                    new Vector(-20.5, 98.0, 1.0), // start vector
                    new Vector(0.9943788200017947, 0.09470274476207569, -0.04735137238103784), // direction
                    0, // y offset
                    (int) Math.floor(Math.sqrt(422))); // max distance
    BlockIterator source: https://hub.spigotmc.org/stash/proj...n/java/org/bukkit/util/BlockIterator.java#171

    I marked this thread with the 1.8.8 version, but it should work for the newest release too because the BlockIterator class has not been changed in that time.

    Does anybody know a workaround to fix this?