Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. @param start The start vector @param end The end vector
(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
| 703 | * @param end The end vector |
| 704 | */ |
| 705 | public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) |
| 706 | { |
| 707 | this.setBlockBoundsBasedOnState(worldIn, pos); |
| 708 | start = start.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); |
| 709 | end = end.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); |
| 710 | Vec3 vec3 = start.getIntermediateWithXValue(end, this.minX); |
| 711 | Vec3 vec31 = start.getIntermediateWithXValue(end, this.maxX); |
| 712 | Vec3 vec32 = start.getIntermediateWithYValue(end, this.minY); |
| 713 | Vec3 vec33 = start.getIntermediateWithYValue(end, this.maxY); |
| 714 | Vec3 vec34 = start.getIntermediateWithZValue(end, this.minZ); |
| 715 | Vec3 vec35 = start.getIntermediateWithZValue(end, this.maxZ); |
| 716 | |
| 717 | if (!this.isVecInsideYZBounds(vec3)) |
| 718 | { |
| 719 | vec3 = null; |
| 720 | } |
| 721 | |
| 722 | if (!this.isVecInsideYZBounds(vec31)) |
| 723 | { |
| 724 | vec31 = null; |
| 725 | } |
| 726 | |
| 727 | if (!this.isVecInsideXZBounds(vec32)) |
| 728 | { |
| 729 | vec32 = null; |
| 730 | } |
| 731 | |
| 732 | if (!this.isVecInsideXZBounds(vec33)) |
| 733 | { |
| 734 | vec33 = null; |
| 735 | } |
| 736 | |
| 737 | if (!this.isVecInsideXYBounds(vec34)) |
| 738 | { |
| 739 | vec34 = null; |
| 740 | } |
| 741 | |
| 742 | if (!this.isVecInsideXYBounds(vec35)) |
| 743 | { |
| 744 | vec35 = null; |
| 745 | } |
| 746 | |
| 747 | Vec3 vec36 = null; |
| 748 | |
| 749 | if (vec3 != null && (vec36 == null || start.squareDistanceTo(vec3) < start.squareDistanceTo(vec36))) |
| 750 | { |
| 751 | vec36 = vec3; |
| 752 | } |
| 753 | |
| 754 | if (vec31 != null && (vec36 == null || start.squareDistanceTo(vec31) < start.squareDistanceTo(vec36))) |
| 755 | { |
| 756 | vec36 = vec31; |
| 757 | } |
| 758 | |
| 759 | if (vec32 != null && (vec36 == null || start.squareDistanceTo(vec32) < start.squareDistanceTo(vec36))) |
| 760 | { |
| 761 | vec36 = vec32; |
| 762 | } |
no test coverage detected