| 189 | } |
| 190 | |
| 191 | public static Position capBy(Position position, Position cap) { |
| 192 | if (position == null || cap == null) { |
| 193 | Loggger.warn("Position null"); |
| 194 | return null; |
| 195 | } |
| 196 | Position target = position.copy(); |
| 197 | if (target.getX() > cap.getX()) { |
| 198 | target.x = cap.x; |
| 199 | } |
| 200 | if (target.getY() > cap.getY()) { |
| 201 | target.y = cap.y; |
| 202 | } |
| 203 | if (target.getZ() > cap.getZ()) { |
| 204 | target.z = cap.z; |
| 205 | } |
| 206 | return target; |
| 207 | } |
| 208 | |
| 209 | public static Position capBelow(Position position, Position cap) { |
| 210 | if (position == null || cap == null) { |