org.bukkit.util
Class BlockIterator

java.lang.Object
  extended by org.bukkit.util.BlockIterator
All Implemented Interfaces:
Iterator<Block>

public class BlockIterator
extends Object
implements Iterator<Block>

This class performs ray tracing and iterates along blocks on a line


Constructor Summary
BlockIterator(LivingEntity entity)
          Constructs the BlockIterator.
BlockIterator(LivingEntity entity, int maxDistance)
          Constructs the BlockIterator.
BlockIterator(Location loc)
          Constructs the BlockIterator.
BlockIterator(Location loc, double yOffset)
          Constructs the BlockIterator.
BlockIterator(Location loc, double yOffset, int maxDistance)
          Constructs the BlockIterator
BlockIterator(World world, Vector start, Vector direction, double yOffset, int maxDistance)
          Constructs the BlockIterator
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements
 Block next()
          Returns the next Block in the trace
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockIterator

public BlockIterator(World world,
                     Vector start,
                     Vector direction,
                     double yOffset,
                     int maxDistance)
Constructs the BlockIterator

Parameters:
world - The world to use for tracing
start - A Vector giving the initial location for the trace
direction - A Vector pointing in the direction for the trace
yOffset - The trace begins vertically offset from the start vector by this value
maxDistance - This is the maximum distance in blocks for the trace. Setting this value above 140 may lead to problems with unloaded chunks. A value of 0 indicates no limit

BlockIterator

public BlockIterator(Location loc,
                     double yOffset,
                     int maxDistance)
Constructs the BlockIterator

Parameters:
loc - The location for the start of the ray trace
yOffset - The trace begins vertically offset from the start vector by this value
maxDistance - This is the maximum distance in blocks for the trace. Setting this value above 140 may lead to problems with unloaded chunks. A value of 0 indicates no limit

BlockIterator

public BlockIterator(Location loc,
                     double yOffset)
Constructs the BlockIterator.

Parameters:
loc - The location for the start of the ray trace
yOffset - The trace begins vertically offset from the start vector by this value

BlockIterator

public BlockIterator(Location loc)
Constructs the BlockIterator.

Parameters:
loc - The location for the start of the ray trace

BlockIterator

public BlockIterator(LivingEntity entity,
                     int maxDistance)
Constructs the BlockIterator.

Parameters:
entity - Information from the entity is used to set up the trace
maxDistance - This is the maximum distance in blocks for the trace. Setting this value above 140 may lead to problems with unloaded chunks. A value of 0 indicates no limit

BlockIterator

public BlockIterator(LivingEntity entity)
Constructs the BlockIterator.

Parameters:
entity - Information from the entity is used to set up the trace
Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements

Specified by:
hasNext in interface Iterator<Block>

next

public Block next()
Returns the next Block in the trace

Specified by:
next in interface Iterator<Block>
Returns:
the next Block in the trace

remove

public void remove()
Specified by:
remove in interface Iterator<Block>


Copyright © 2013. All Rights Reserved.