Constructs the BlockIterator. This considers all blocks as 1x1x1 in size. @param world The world to use for tracing @param start A Vector giving the initial location for the trace @param direction A Vector pointing in the direction for the trace @param yOffset The trace begins vertically offset
(@NotNull World world, @NotNull Vector start, @NotNull Vector direction, double yOffset, int maxDistance)
| 53 | * |
| 54 | */ |
| 55 | public BlockIterator(@NotNull World world, @NotNull Vector start, @NotNull Vector direction, double yOffset, int maxDistance) { |
| 56 | this.world = world; |
| 57 | this.maxDistance = maxDistance; |
| 58 | |
| 59 | Vector startClone = start.clone(); |
| 60 | |
| 61 | startClone.setY(startClone.getY() + yOffset); |
| 62 | |
| 63 | currentDistance = 0; |
| 64 | |
| 65 | double mainDirection = 0; |
| 66 | double secondDirection = 0; |
| 67 | double thirdDirection = 0; |
| 68 | |
| 69 | double mainPosition = 0; |
| 70 | double secondPosition = 0; |
| 71 | double thirdPosition = 0; |
| 72 | |
| 73 | Block startBlock = this.world.getBlockAt(floor(startClone.getX()), floor(startClone.getY()), floor(startClone.getZ())); |
| 74 | |
| 75 | if (getXLength(direction) > mainDirection) { |
| 76 | mainFace = getXFace(direction); |
| 77 | mainDirection = getXLength(direction); |
| 78 | mainPosition = getXPosition(direction, startClone, startBlock); |
| 79 | |
| 80 | secondFace = getYFace(direction); |
| 81 | secondDirection = getYLength(direction); |
| 82 | secondPosition = getYPosition(direction, startClone, startBlock); |
| 83 | |
| 84 | thirdFace = getZFace(direction); |
| 85 | thirdDirection = getZLength(direction); |
| 86 | thirdPosition = getZPosition(direction, startClone, startBlock); |
| 87 | } |
| 88 | if (getYLength(direction) > mainDirection) { |
| 89 | mainFace = getYFace(direction); |
| 90 | mainDirection = getYLength(direction); |
| 91 | mainPosition = getYPosition(direction, startClone, startBlock); |
| 92 | |
| 93 | secondFace = getZFace(direction); |
| 94 | secondDirection = getZLength(direction); |
| 95 | secondPosition = getZPosition(direction, startClone, startBlock); |
| 96 | |
| 97 | thirdFace = getXFace(direction); |
| 98 | thirdDirection = getXLength(direction); |
| 99 | thirdPosition = getXPosition(direction, startClone, startBlock); |
| 100 | } |
| 101 | if (getZLength(direction) > mainDirection) { |
| 102 | mainFace = getZFace(direction); |
| 103 | mainDirection = getZLength(direction); |
| 104 | mainPosition = getZPosition(direction, startClone, startBlock); |
| 105 | |
| 106 | secondFace = getXFace(direction); |
| 107 | secondDirection = getXLength(direction); |
| 108 | secondPosition = getXPosition(direction, startClone, startBlock); |
| 109 | |
| 110 | thirdFace = getYFace(direction); |
| 111 | thirdDirection = getYLength(direction); |
| 112 | thirdPosition = getYPosition(direction, startClone, startBlock); |
nothing calls this directly
no test coverage detected