BlockIterator Start End Locations

XMLWordPrintable

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • This server is running CraftBukkit version 3360-Spigot-f65de01-c2e0bbd (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT)
    • Yes

      I propose more BlockIterator constructors which define start and end locations/blocks/entities. This is often interesting if you want to create some sort of geometry (e.g. visually connect two blocks), in which case, in order to use BlockIterator, you would need to get the position of block 1, do a vector calculation to get the direction and then calculate the distance between those two locations. That is a lot of code that is often slow and verbose and not at all needed for the actual usecase (just wanting all blocks on a line between two locations).

       

      This is a thread I found that has exactly this topic: https://www.spigotmc.org/threads/get-blocks-between-two-locations.190233/

       

      In general, either one could implement some sort of world block bulk query to do that, or implement a new BlockIterator constructor that does the hard stuff. Also, the explicit information could speed up the implementation of BlockIterator well as e.g. no hypot/sqrt would be calculated for distance if it is guaranteed that the end block is interated over.

            Assignee:
            Unassigned
            Reporter:
            Photon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: