Solved How to calculate cone of visibility like in SethBling's see through nether portals?

Discussion in 'Plugin Development' started by WhiteHoleGaming, Oct 20, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    WhiteHoleGaming

    I need a see-through portal, and SethBling's method looks like it would work, but he doesn't explain how to calculate the cone of visibility. I think his method would work really well with bukkit.
     
    Last edited: Oct 20, 2016
  2. Offline

    Zombie_Striker

    @WhiteHoleGaming
    Here is how you would achieve this:
    1. Create an arraylist of blocks. These are the blocks that have to be "re-updated" for the player (will discuss later.)
    2. Either use PlayerMoveEvent or a repeating task.
    3. Get the player's location.
    4. Get the location of both corners of the portal.
    5. Create two vectors which relates to the player's location and one of the portal corners.
    6. For loop through all the blocks in the direction the player is looking.
    7. If the block is within those two vectors, that is a block that will be "in the nether". Store this block in the array from before.
    8. If it is not within those two vectors, and it is also in the arraylist from #1, then remove it from the arraylist and update it for the player (setting the block so it is back to the "overworld")
     
  3. Offline

    WhiteHoleGaming

    That makes sense, thank you. I am a bukkit plugin noob though, so don't expect the plugin soon.
     
  4. Offline

    Zombie_Striker

    @WhiteHoleGaming
    If you have any other issues creating the plugin, please make a new thread. If your current problem has been solved, mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page