getLineOfSight - Start block missed in BlockIterator

Discussion in 'Plugin Development' started by matejdro, Nov 6, 2011.

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

    matejdro

    What am I doing wrong here?

    Code:
    04:16:29 [WARNING] Task of 'EnderSMP' generated an exception
    java.lang.IllegalStateException: Start block missed in BlockIterator
    at org.bukkit.util.BlockIterator.<init>(BlockIterator.java:167)
    at org.bukkit.util.BlockIterator.<init>(BlockIterator.java:254)
    at org.bukkit.util.BlockIterator.<init>(BlockIterator.java:289)
    at org.bukkit.craftbukkit.entity.CraftLivingEntity.getLineOfSight(CraftLivingEntity.java:94)
    at org.bukkit.craftbukkit.entity.CraftLivingEntity.getLineOfSight(CraftLivingEntity.java:116)
    at com.matejdro.bukkit.endersmp.EnderSMP$1.run(EnderSMP.java:36)
    at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Code:java
    1.  
    2. for (Player player : getServer().getOnlinePlayers())
    3. {
    4. List<Block> sight = player.getLineOfSight(null, 40); //This is line 36
    5.  

    Using bukkit 953.
     
  2. Offline

    Evangon

    o.o....................................................................
    You are way outdated.
    Use 1337.
     
  3. Offline

    matejdro

    This is bukkit build, not CB.
     
  4. o.o.....................
    What? You make no sense...

    As for your error, I have no clue... Can you paste the whole run method?
     
  5. Offline

    nisovin

    Is this happening all the time, or just occasionally? I'm able to duplicate this by trying to use a BlockIterator on a player who is currently falling into the void.
     
  6. Offline

    desht

    I've seen player.getTargetBlock() throw this on several occasions. The situation @nisovin described is one. You can also trigger it by standing at the highest possible point in a world (y = 127) and looking up.

    As far as I can tell, the exception is harmless and can be safely caught. Just treat it as if the player has nothing useful targeted.

    (Update: I noticed you're talking about getLineOfSight() rather than getTargetBlock(), but it's the same BlockIterator code which does the work in the background, so the same principles apply).
     
  7. Offline

    Sleaker

    BlockIterator needs some work imo - if you use it in the void or if it is iterating over void blocks it should be able to return null values for them.. the BlockIterator also has constructor issues - as attempting to create an identical blockiterator can simply fail at times.
     
Thread Status:
Not open for further replies.

Share This Page