Package net.minestom.server.utils.block
Class BlockIterator
java.lang.Object
net.minestom.server.utils.block.BlockIterator
This class performs ray tracing and iterates along blocks on a line
-
Constructor Summary
ConstructorDescriptionBlockIterator
(@NotNull Pos pos) Constructs the BlockIterator.BlockIterator
(@NotNull Pos pos, double yOffset) Constructs the BlockIterator.BlockIterator
(@NotNull Pos pos, double yOffset, int maxDistance) Constructs the BlockIterator.BlockIterator
(@NotNull Vec start, @NotNull Vec direction, double yOffset, double maxDistance) Constructs the BlockIterator.BlockIterator
(@NotNull Vec start, @NotNull Vec direction, double yOffset, double maxDistance, boolean smooth) Constructs the BlockIterator.BlockIterator
(@NotNull Entity entity) Constructs the BlockIterator.BlockIterator
(@NotNull Entity entity, int maxDistance) Constructs the BlockIterator. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
BlockIterator
public BlockIterator(@NotNull @NotNull Vec start, @NotNull @NotNull Vec direction, double yOffset, double maxDistance, boolean smooth) Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
start
- A Vector giving the initial position for the tracedirection
- A Vector pointing in the direction for the traceyOffset
- The trace begins vertically offset from the start vector by this valuemaxDistance
- 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 limitsmooth
- A boolean indicating whether the cast should be smooth. Smooth casts will only include one block when intersecting multiple axis lines.
-
BlockIterator
public BlockIterator() -
BlockIterator
public BlockIterator(@NotNull @NotNull Vec start, @NotNull @NotNull Vec direction, double yOffset, double maxDistance) Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
start
- A Vector giving the initial position for the tracedirection
- A Vector pointing in the direction for the traceyOffset
- The trace begins vertically offset from the start vector by this valuemaxDistance
- 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
Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
pos
- The position for the start of the ray traceyOffset
- The trace begins vertically offset from the start vector by this valuemaxDistance
- 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
Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
pos
- The position for the start of the ray traceyOffset
- The trace begins vertically offset from the start vector by this value
-
BlockIterator
Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
pos
- The position for the start of the ray trace
-
BlockIterator
Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
entity
- Information from the entity is used to set up the tracemaxDistance
- 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
Constructs the BlockIterator.This considers all blocks as 1x1x1 in size.
- Parameters:
entity
- Information from the entity is used to set up the trace
-
-
Method Details
-
reset
-
hasNext
public boolean hasNext()Returns true if the iteration has more elements -
remove
public void remove() -
next
Returns the next BlockPosition in the trace
-