Skip to content

Commit

Permalink
Use getCollidingBoxes() in JesusHack
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Oct 30, 2023
1 parent 2a97c58 commit b20fd68
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/main/java/net/wurstclient/hacks/JesusHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.PacketOutputListener;
Expand Down Expand Up @@ -157,25 +156,21 @@ public boolean isOverLiquid()
{
boolean foundLiquid = false;
boolean foundSolid = false;
ClientPlayerEntity player = MC.player;
Box box = player.getBoundingBox().offset(0, -0.5, 0);

// check collision boxes below player
ArrayList<Box> blockCollisions = IMC.getWorld()
.getBlockCollisionsStream(MC.player,
MC.player.getBoundingBox().offset(0, -0.5, 0))
.map(VoxelShape::getBoundingBox)
ArrayList<Block> blockCollisions = IMC.getWorld()
.getCollidingBoxes(player, box)
.map(bb -> BlockUtils.getBlock(BlockPos.ofFloored(bb.getCenter())))
.collect(Collectors.toCollection(ArrayList::new));

for(Box bb : blockCollisions)
{
BlockPos pos = BlockPos.ofFloored(bb.getCenter());
Block block = BlockUtils.getBlock(pos);

for(Block block : blockCollisions)
if(block instanceof FluidBlock)
foundLiquid = true;
else if(!(block instanceof AirBlock))
foundSolid = true;
}


return foundLiquid && !foundSolid;
}

Expand Down

0 comments on commit b20fd68

Please sign in to comment.