Make corrections to RayTrace modifications
@@ -173,14 +173,14 @@ public class CoordUtils {
int lookZ = MathHelper.floor(vantage.z);
BlockPos lookPos = new BlockPos(lookX, lookY, lookZ);
IBlockState lookState = safeBounds.inBounds(lookPos, false) ? world.getBlockState(lookPos) : Blocks.AIR.getDefaultState();
- Block block = lookState.getBlock();
+ Block lookBlock = lookState.getBlock();
AxisAlignedBB colBB1 = safeBounds.inBounds(lookPos, false) ? lookState.getCollisionBoundingBox(world, lookPos) : Block.NULL_AABB;
//This is used in case the Passable Leaves mod has changed the expected behavior of the getCollisionBoundingBox() member function
- boolean specialRayTraceCollision = block instanceof IRayTraceCollision ? ((IRayTraceCollision) block).isRayTraceCollidable() : false;
+ boolean specialRayTraceCollision = lookBlock instanceof IRayTraceCollision ? ((IRayTraceCollision) lookBlock).isRayTraceCollidable() : false;
- if (specialRayTraceCollision || ((!ignoreBlockWithoutBoundingBox || colBB1 != Block.NULL_AABB) && block.canCollideCheck(lookState, stopOnLiquid))) {
+ if (specialRayTraceCollision || ((!ignoreBlockWithoutBoundingBox || colBB1 != Block.NULL_AABB) && lookBlock.canCollideCheck(lookState, stopOnLiquid))) {
RayTraceResult raytraceresult = lookState.collisionRayTrace(world, lookPos, vantage, lookingAt);
if (raytraceresult != null) {
@@ -282,14 +282,17 @@ public class CoordUtils {
lookY = MathHelper.floor(vantage.y) - (enumfacing == EnumFacing.UP ? 1 : 0);
lookZ = MathHelper.floor(vantage.z) - (enumfacing == EnumFacing.SOUTH ? 1 : 0);
lookPos = new BlockPos(lookX, lookY, lookZ);
- IBlockState iblockstate1 = safeBounds.inBounds(lookPos, false) ? world.getBlockState(lookPos) : Blocks.AIR.getDefaultState();
- Block block1 = iblockstate1.getBlock();
+ IBlockState lookState2 = safeBounds.inBounds(lookPos, false) ? world.getBlockState(lookPos) : Blocks.AIR.getDefaultState();
+ Block lookBlock2 = lookState2.getBlock();
- AxisAlignedBB colBB2 = safeBounds.inBounds(lookPos, false) ? iblockstate1.getCollisionBoundingBox(world, lookPos) : Block.NULL_AABB;
+ AxisAlignedBB colBB2 = safeBounds.inBounds(lookPos, false) ? lookState2.getCollisionBoundingBox(world, lookPos) : Block.NULL_AABB;
- if (!ignoreBlockWithoutBoundingBox || iblockstate1.getMaterial() == Material.PORTAL || colBB2 != Block.NULL_AABB) {
- if (block1.canCollideCheck(iblockstate1, stopOnLiquid)) {
- RayTraceResult raytraceresult1 = iblockstate1.collisionRayTrace(world, lookPos, vantage, lookingAt);
+ //This is used in case the Passable Leaves mod has changed the expected behavior of the getCollisionBoundingBox() member function
+ specialRayTraceCollision = lookBlock2 instanceof IRayTraceCollision ? ((IRayTraceCollision) lookBlock2).isRayTraceCollidable() : false;
+
+ if (specialRayTraceCollision || !ignoreBlockWithoutBoundingBox || lookState2.getMaterial() == Material.PORTAL || colBB2 != Block.NULL_AABB) {
+ if (specialRayTraceCollision || lookBlock2.canCollideCheck(lookState2, stopOnLiquid)) {
+ RayTraceResult raytraceresult1 = lookState2.collisionRayTrace(world, lookPos, vantage, lookingAt);
if (raytraceresult1 != null) {
return raytraceresult1;
}
