Skip to content

Commit

Permalink
fix reaper tp
Browse files Browse the repository at this point in the history
  • Loading branch information
Furgl committed Sep 2, 2017
1 parent 4dfe560 commit 061b4ca
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void onItemLeftClick(ItemStack stack, World world, EntityPlayer player, E
private Vec3d getTeleportPos(EntityPlayer player) {
try {
RayTraceResult result = player.world.rayTraceBlocks(player.getPositionEyes(1),
player.getLookVec().scale(Integer.MAX_VALUE), false, false, true);
player.getLookVec().scale(Integer.MAX_VALUE), true, true, true);
if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK && result.hitVec != null) {
BlockPos pos = new BlockPos(result.hitVec.xCoord, result.getBlockPos().getY(), result.hitVec.zCoord);

Expand All @@ -97,11 +97,13 @@ private Vec3d getTeleportPos(EntityPlayer player) {

pos = pos.add(adjustX, 0, adjustZ);
IBlockState state = player.world.getBlockState(pos);
IBlockState state1 = player.world.getBlockState(pos.up());
IBlockState state2 = player.world.getBlockState(pos.up(2));

if ((state.getBlock().getCollisionBoundingBox(state, player.world, pos.up()) == null ||
state.getBlock().getCollisionBoundingBox(state, player.world, pos.up()) == Block.NULL_AABB) &&
(state.getBlock().getCollisionBoundingBox(state, player.world, pos.up(2)) == null ||
state.getBlock().getCollisionBoundingBox(state, player.world, pos.up(2)) == Block.NULL_AABB) &&
if ((player.world.isAirBlock(pos.up()) || state1.getBlock().getCollisionBoundingBox(state1, player.world, pos.up()) == null ||
state1.getBlock().getCollisionBoundingBox(state1, player.world, pos.up()) == Block.NULL_AABB) &&
(player.world.isAirBlock(pos.up(2)) || state2.getBlock().getCollisionBoundingBox(state2, player.world, pos.up(2)) == null ||
state2.getBlock().getCollisionBoundingBox(state2, player.world, pos.up(2)) == Block.NULL_AABB) &&
!player.world.isAirBlock(pos) &&
state.getBlock().getCollisionBoundingBox(state, player.world, pos) != null &&
state.getBlock().getCollisionBoundingBox(state, player.world, pos) != Block.NULL_AABB &&
Expand Down

0 comments on commit 061b4ca

Please sign in to comment.