mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Improve NukerLegitHack
- Aims more accurately at small blocks - Faster at nuking blocks that break instantly
This commit is contained in:
parent
21b999621a
commit
c003f44d14
@ -18,16 +18,17 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.RaycastContext;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.wurstclient.Category;
|
||||
import net.wurstclient.SearchTags;
|
||||
import net.wurstclient.events.LeftClickListener;
|
||||
@ -202,13 +203,31 @@ public final class NukerLegitHack extends Hack
|
||||
|
||||
private boolean breakBlockExtraLegit(BlockPos pos)
|
||||
{
|
||||
Vec3d eyesPos = RotationUtils.getEyesPos();
|
||||
Vec3d posVec = Vec3d.ofCenter(pos);
|
||||
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
|
||||
Direction[] sides = Direction.values();
|
||||
|
||||
for(Direction side : Direction.values())
|
||||
BlockState state = BlockUtils.getState(pos);
|
||||
VoxelShape shape = state.getOutlineShape(MC.world, pos);
|
||||
if(shape.isEmpty())
|
||||
return false;
|
||||
|
||||
Vec3d eyesPos = RotationUtils.getEyesPos();
|
||||
Vec3d relCenter = shape.getBoundingBox().getCenter();
|
||||
Vec3d center = Vec3d.of(pos).add(relCenter);
|
||||
|
||||
Vec3d[] hitVecs = new Vec3d[sides.length];
|
||||
for(int i = 0; i < sides.length; i++)
|
||||
{
|
||||
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
|
||||
Vec3i dirVec = sides[i].getVector();
|
||||
Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(),
|
||||
relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ());
|
||||
hitVecs[i] = center.add(relHitVec);
|
||||
}
|
||||
|
||||
double distanceSqToCenter = eyesPos.squaredDistanceTo(center);
|
||||
|
||||
for(Direction side : sides)
|
||||
{
|
||||
Vec3d hitVec = hitVecs[side.ordinal()];
|
||||
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
|
||||
|
||||
// check if hitVec is within range (4.25 blocks)
|
||||
@ -216,15 +235,12 @@ public final class NukerLegitHack extends Hack
|
||||
continue;
|
||||
|
||||
// check if side is facing towards player
|
||||
if(distanceSqHitVec >= distanceSqPosVec)
|
||||
if(distanceSqHitVec >= distanceSqToCenter)
|
||||
continue;
|
||||
|
||||
// check line of sight
|
||||
if(MC.world
|
||||
.raycast(new RaycastContext(eyesPos, hitVec,
|
||||
RaycastContext.ShapeType.COLLIDER,
|
||||
RaycastContext.FluidHandling.NONE, MC.player))
|
||||
.getType() != HitResult.Type.MISS)
|
||||
if(MC.world.raycastBlock(eyesPos, hitVec, pos, shape,
|
||||
state) != null)
|
||||
continue;
|
||||
|
||||
// face block
|
||||
@ -233,8 +249,11 @@ public final class NukerLegitHack extends Hack
|
||||
if(currentBlock != null)
|
||||
WURST.getHax().autoToolHack.equipIfEnabled(currentBlock);
|
||||
|
||||
// if attack key is down but nothing happens, release it for one
|
||||
// tick
|
||||
if(!MC.interactionManager.isBreakingBlock())
|
||||
MC.interactionManager.attackBlock(pos, side);
|
||||
|
||||
// if attack key is down but nothing happens,
|
||||
// release it for one tick
|
||||
if(MC.options.attackKey.isPressed()
|
||||
&& !MC.interactionManager.isBreakingBlock())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user