net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket Java Examples

The following examples show how to use net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerCrash.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	for (int i = 0; i < getSettings().get(0).toSlider().getValue(); i++) {
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket(Math.random() >= 0.5));
		mc.player.networkHandler.sendPacket(new KeepAliveC2SPacket((int) (Math.random() * 8)));
	}
}
 
Example #2
Source File: ServerPlayNetworkHandler_tickMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Inject(method = "onPlayerMove",  at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/network/ServerPlayerEntity;isSleeping()Z",
        shift = At.Shift.BEFORE
))
private void checkMove(PlayerMoveC2SPacket p, CallbackInfo ci)
{
    double movedBy = player.getPos().squaredDistanceTo(lastTickX, lastTickY, lastTickZ);
    if (movedBy == 0.0D) return;
    // corrective tick
    if (movedBy < 0.0009 && lastMoved > 0.0009 && Math.abs(player.getServer().getTicks()-lastMovedTick-20)<2)
    {
        //CarpetSettings.LOG.error("Corrective movement packet");
        return;
    }
    if (movedBy > 0.0D)
    {
        //CarpetSettings.LOG.error(String.format(
        //        "moved by %.6f at %d",
        //        player.getPos().squaredDistanceTo(lastTickX, lastTickY, lastTickZ),
        //        player.getServer().getTicks()-lastMovedTick
        //));
        lastMoved = movedBy;
        lastMovedTick = player.getServer().getTicks();
        TickSpeed.reset_player_active_timeout();
    }
}
 
Example #3
Source File: Criticals.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
private void doCritical() {
    if (!mc.player.onGround) return;
    if (mc.player.isInLava() || mc.player.isTouchingWater()) return;
    double posX = mc.player.getX();
    double posY = mc.player.getY();
    double posZ = mc.player.getZ();
    mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY + 0.0625, posZ, true));
    mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY, posZ, false));
}
 
Example #4
Source File: ServerPlayNetworkHandler_scarpetEventsMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Inject(method = "onPlayerMove", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/network/ServerPlayerEntity;jump()V"
))
private void onJump(PlayerMoveC2SPacket playerMoveC2SPacket_1, CallbackInfo ci)
{
    PLAYER_JUMPS.onPlayerEvent(player);
}
 
Example #5
Source File: Step.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	if (!WorldUtils.NONSOLID_BLOCKS.contains(
			mc.world.getBlockState(mc.player.getBlockPos().add(0, mc.player.getHeight()+1, 0)).getBlock())) return;
	
	if (getSettings().get(0).toMode().mode == 0) {
		mc.player.stepHeight = 1.065F;
	} else if (getSettings().get(0).toMode().mode == 1) {
		
		if (!mc.player.horizontalCollision && flag) {
			mc.player.setVelocity(mc.player.getVelocity().x, -0.1, mc.player.getVelocity().z);
		} else if (mc.player.horizontalCollision) {
			mc.player.setVelocity(mc.player.getVelocity().x, 1, mc.player.getVelocity().z);
			mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket(true));
			mc.player.jump();
			flag = true;
		}
		
		if (!mc.player.horizontalCollision) flag = false;
		
	} else if (getSettings().get(0).toMode().mode == 2) {
		
		if (mc.player.horizontalCollision && mc.player.onGround) {
			pos = mc.player.getY();
			mc.player.jump();
			flag = true;
		}
		
		if (flag && pos + 1.065 < mc.player.getY()) {
			mc.player.setVelocity(mc.player.getVelocity().x, -0.1, mc.player.getVelocity().z);
			flag = false;
		}
	}
}
 
Example #6
Source File: OffhandCrash.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	for (int i = 0; i < getSettings().get(0).toSlider().getValue(); i++) {
		mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(Action.SWAP_HELD_ITEMS, BlockPos.ORIGIN, Direction.UP));
		if (getSettings().get(1).toToggle().state) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket(true));
	}
}
 
Example #7
Source File: Flight.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	float speed = (float) getSettings().get(1).toSlider().getValue();
	
	if (mc.player.age % 20 == 0 && getSettings().get(2).toMode().mode == 3 && !(getSettings().get(0).toMode().mode == 2)) {
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(mc.player.getX(), mc.player.getY() - 0.06, mc.player.getZ(), false));
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(mc.player.getX(), mc.player.getZ() + 0.06, mc.player.getZ(), true));
	}
	
	if (getSettings().get(0).toMode().mode == 0) {
		mc.player.abilities.setFlySpeed(speed / 10);
		mc.player.abilities.allowFlying = true;
		mc.player.abilities.flying = true;
	} else if (getSettings().get(0).toMode().mode == 1) {
		if (getSettings().get(2).toMode().mode == 0 || getSettings().get(2).toMode().mode == 3) mc.player.setVelocity(0, 0, 0);
		else if (getSettings().get(2).toMode().mode == 1 && WorldUtils.NONSOLID_BLOCKS.contains(mc.world.getBlockState(new BlockPos(mc.player.getPosVector().getX(), mc.player.getPosVector().getY() - 0.069, mc.player.getPosVector().getZ())).getBlock())) mc.player.setVelocity(0, mc.player.age % 20 == 0 ? -0.069 : 0, 0);
		else if (getSettings().get(2).toMode().mode == 2) mc.player.setVelocity(0, mc.player.age % 40 == 0 ? (WorldUtils.NONSOLID_BLOCKS.contains(mc.world.getBlockState(new BlockPos(mc.player.getPosVector().getX(), mc.player.getPosVector().getY() + 1.15, mc.player.getPosVector().getZ())).getBlock()) ? 0.15 : 0) : mc.player.age % 20 == 0 ? (WorldUtils.NONSOLID_BLOCKS.contains(mc.world.getBlockState(new BlockPos(mc.player.getPosVector().getX(), mc.player.getPosVector().getY() - 0.15, mc.player.getPosVector().getZ())).getBlock()) ? -0.15 : 0) : 0, 0);
		Vec3d forward = new Vec3d(0, 0, speed).rotateY(-(float) Math.toRadians(mc.player.yaw));
		Vec3d strafe = forward.rotateY((float) Math.toRadians(90));
		
		if (mc.options.keyJump.isPressed()) mc.player.setVelocity(mc.player.getVelocity().add(0, speed, 0));
		if (mc.options.keySneak.isPressed()) mc.player.setVelocity(mc.player.getVelocity().add(0, -speed, 0));
		if (mc.options.keyBack.isPressed()) mc.player.setVelocity(mc.player.getVelocity().add(-forward.x, 0, -forward.z));
		if (mc.options.keyForward.isPressed()) mc.player.setVelocity(mc.player.getVelocity().add(forward.x, 0, forward.z));
		if (mc.options.keyLeft.isPressed()) mc.player.setVelocity(mc.player.getVelocity().add(strafe.x, 0, strafe.z));
		if (mc.options.keyRight.isPressed()) mc.player.setVelocity(mc.player.getVelocity().add(-strafe.x, 0, -strafe.z));

	} else if (getSettings().get(0).toMode().mode == 2) {
		if (!mc.options.keyJump.isPressed()) return;
		mc.player.setVelocity(mc.player.getVelocity().x, speed / 3, mc.player.getVelocity().z);
	}
}
 
Example #8
Source File: FakeLag.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
   public void sendPacket(EventSendPacket event) {
	if (!(event.getPacket() instanceof PlayerMoveC2SPacket
			|| event.getPacket() instanceof PlayerMoveC2SPacket.PositionOnly
			|| event.getPacket() instanceof PlayerMoveC2SPacket.LookOnly
			|| event.getPacket() instanceof PlayerMoveC2SPacket.Both)) return;
	queue.add((PlayerMoveC2SPacket) event.getPacket());
	event.setCancelled(true);
}
 
Example #9
Source File: FakeLag.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public void sendPackets() {
	for (PlayerMoveC2SPacket p: new ArrayList<>(queue)) {
		if (p instanceof PlayerMoveC2SPacket.LookOnly) continue;
		mc.player.networkHandler.sendPacket(p);
	}
	queue.clear();
}
 
Example #10
Source File: PotionSaverHack.java    From Wurst7 with GNU General Public License v3.0 3 votes vote down vote up
@Override
public void onSentPacket(PacketOutputEvent event)
{
	if(event.getPacket() instanceof PlayerMoveC2SPacket)
		event.cancel();
}
 
Example #11
Source File: BuildRandomHack.java    From Wurst7 with GNU General Public License v3.0 3 votes vote down vote up
private boolean placeBlockLegit(BlockPos pos)
{
	Vec3d eyesPos = RotationUtils.getEyesPos();
	Vec3d posVec = Vec3d.ofCenter(pos);
	double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
	
	for(Direction side : Direction.values())
	{
		BlockPos neighbor = pos.offset(side);
		
		// check if neighbor can be right clicked
		if(!BlockUtils.canBeClicked(neighbor))
			continue;
		
		Vec3d dirVec = Vec3d.of(side.getVector());
		Vec3d hitVec = posVec.add(dirVec.multiply(0.5));
		
		// check if hitVec is within range (4.25 blocks)
		if(eyesPos.squaredDistanceTo(hitVec) > 18.0625)
			continue;
		
		// check if side is visible (facing away from player)
		if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec)))
			continue;
		
		// check line of sight
		if(MC.world
			.rayTrace(new RayTraceContext(eyesPos, hitVec,
				RayTraceContext.ShapeType.COLLIDER,
				RayTraceContext.FluidHandling.NONE, MC.player))
			.getType() != HitResult.Type.MISS)
			continue;
		
		// face block
		Rotation rotation = RotationUtils.getNeededRotations(hitVec);
		PlayerMoveC2SPacket.LookOnly packet =
			new PlayerMoveC2SPacket.LookOnly(rotation.getYaw(),
				rotation.getPitch(), MC.player.isOnGround());
		MC.player.networkHandler.sendPacket(packet);
		
		// place block
		IMC.getInteractionManager().rightClickBlock(neighbor,
			side.getOpposite(), hitVec);
		MC.player.swingHand(Hand.MAIN_HAND);
		IMC.setItemUseCooldown(4);
		
		return true;
	}
	
	return false;
}
 
Example #12
Source File: AutoPotionHack.java    From Wurst7 with GNU General Public License v3.0 3 votes vote down vote up
@Override
public void onUpdate()
{
	// search potion in hotbar
	int potionInHotbar = findPotion(0, 9);
	
	// check if any potion was found
	if(potionInHotbar != -1)
	{
		// check timer
		if(timer > 0)
		{
			timer--;
			return;
		}
		
		// check health
		if(MC.player.getHealth() > health.getValueF() * 2F)
			return;
		
		// save old slot
		int oldSlot = MC.player.inventory.selectedSlot;
		
		// throw potion in hotbar
		MC.player.inventory.selectedSlot = potionInHotbar;
		MC.player.networkHandler
			.sendPacket(new PlayerMoveC2SPacket.LookOnly(MC.player.yaw, 90,
				MC.player.isOnGround()));
		IMC.getInteractionManager().rightClickItem();
		
		// reset slot and rotation
		MC.player.inventory.selectedSlot = oldSlot;
		MC.player.networkHandler
			.sendPacket(new PlayerMoveC2SPacket.LookOnly(MC.player.yaw,
				MC.player.pitch, MC.player.isOnGround()));
		
		// reset timer
		timer = 10;
		
		return;
	}
	
	// search potion in inventory
	int potionInInventory = findPotion(9, 36);
	
	// move potion in inventory to hotbar
	if(potionInInventory != -1)
		IMC.getInteractionManager()
			.windowClick_QUICK_MOVE(potionInInventory);
}
 
Example #13
Source File: RemoteViewHack.java    From Wurst7 with GNU General Public License v3.0 3 votes vote down vote up
@Override
public void onSentPacket(PacketOutputEvent event)
{
	if(event.getPacket() instanceof PlayerMoveC2SPacket)
		event.cancel();
}
 
Example #14
Source File: FreecamHack.java    From Wurst7 with GNU General Public License v3.0 3 votes vote down vote up
@Override
public void onSentPacket(PacketOutputEvent event)
{
	if(event.getPacket() instanceof PlayerMoveC2SPacket)
		event.cancel();
}
 
Example #15
Source File: AutoBuildHack.java    From Wurst7 with GNU General Public License v3.0 3 votes vote down vote up
private boolean tryToPlace(BlockPos pos, Vec3d eyesPos, double rangeSq)
{
	Vec3d posVec = Vec3d.ofCenter(pos);
	double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
	
	for(Direction side : Direction.values())
	{
		BlockPos neighbor = pos.offset(side);
		
		// check if neighbor can be right clicked
		if(!BlockUtils.canBeClicked(neighbor)
			|| BlockUtils.getState(neighbor).getMaterial().isReplaceable())
			continue;
		
		Vec3d dirVec = Vec3d.of(side.getVector());
		Vec3d hitVec = posVec.add(dirVec.multiply(0.5));
		
		// check if hitVec is within range
		if(eyesPos.squaredDistanceTo(hitVec) > rangeSq)
			continue;
		
		// check if side is visible (facing away from player)
		if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec)))
			continue;
		
		// check line of sight
		if(checkLOS.isChecked() && MC.world
			.rayTrace(new RayTraceContext(eyesPos, hitVec,
				RayTraceContext.ShapeType.COLLIDER,
				RayTraceContext.FluidHandling.NONE, MC.player))
			.getType() != HitResult.Type.MISS)
			continue;
		
		// face block
		Rotation rotation = RotationUtils.getNeededRotations(hitVec);
		PlayerMoveC2SPacket.LookOnly packet =
			new PlayerMoveC2SPacket.LookOnly(rotation.getYaw(),
				rotation.getPitch(), MC.player.isOnGround());
		MC.player.networkHandler.sendPacket(packet);
		
		// place block
		IMC.getInteractionManager().rightClickBlock(neighbor,
			side.getOpposite(), hitVec);
		MC.player.swingHand(Hand.MAIN_HAND);
		IMC.setItemUseCooldown(4);
		return true;
	}
	
	return false;
}
 
Example #16
Source File: BlinkHack.java    From Wurst7 with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void onSentPacket(PacketOutputEvent event)
{
	if(!(event.getPacket() instanceof PlayerMoveC2SPacket))
		return;
	
	event.cancel();
	
	PlayerMoveC2SPacket packet = (PlayerMoveC2SPacket)event.getPacket();
	PlayerMoveC2SPacket prevPacket = packets.peekLast();
	
	if(prevPacket != null && packet.isOnGround() == prevPacket.isOnGround()
		&& packet.getYaw(-1) == prevPacket.getYaw(-1)
		&& packet.getPitch(-1) == prevPacket.getPitch(-1)
		&& packet.getX(-1) == prevPacket.getX(-1)
		&& packet.getY(-1) == prevPacket.getY(-1)
		&& packet.getZ(-1) == prevPacket.getZ(-1))
		return;
	
	packets.addLast(packet);
}
 
Example #17
Source File: Criticals.java    From bleachhack-1.14 with GNU General Public License v3.0 2 votes vote down vote up
private void doCritical() {
    if (!mc.player.isOnGround()) return;
    if (mc.player.isInLava() || mc.player.isTouchingWater()) return;
    double posX = mc.player.getX();
    double posY = mc.player.getY();
    double posZ = mc.player.getZ();
    mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY + 0.0625, posZ, true));
    mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY, posZ, false));
}
 
Example #18
Source File: HeadRollHack.java    From Wurst7 with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void onUpdate()
{
	float timer = MC.player.age % 20 / 10F;
	float pitch = MathHelper.sin(timer * (float)Math.PI) * 90F;
	
	MC.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(
		MC.player.yaw, pitch, MC.player.isOnGround()));
}
 
Example #19
Source File: PacketFly.java    From bleachhack-1.14 with GNU General Public License v3.0 1 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	double hspeed = getSettings().get(1).toSlider().getValue();
	double vspeed = getSettings().get(2).toSlider().getValue();
	
	if (!mc.player.isAlive()) return;
	timer++;
	
	Entity target = mc.player.getVehicle() == null ? mc.player : mc.player.getVehicle();
	if (getSettings().get(0).toMode().mode == 0) {
		if (mc.options.keyJump.isPressed()) posY += vspeed;
		if (mc.options.keySneak.isPressed()) posY -= vspeed;
		
		Vec3d forward = new Vec3d(0,0,hspeed).rotateY(-(float) Math.toRadians(mc.player.yaw));
		Vec3d strafe = forward.rotateY((float) Math.toRadians(90));
		if (mc.options.keyForward.isPressed()) { posX += forward.x; posZ += forward.z; }
		if (mc.options.keyBack.isPressed()) { posX -= forward.x; posZ -= forward.z; }
		if (mc.options.keyLeft.isPressed()) { posX += strafe.x; posZ += strafe.z; }
		if (mc.options.keyRight.isPressed()) { posX -= strafe.x; posZ -= strafe.z; }
		
		if (timer > getSettings().get(3).toSlider().getValue()) {
			posY -= 0.2;
			timer = 0;
		}
		
		
		target.noClip = true;
		target.updatePositionAndAngles(posX, posY, posZ, mc.player.yaw, mc.player.pitch);
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY, posZ, false));
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY - 0.01, posZ, true));
		mc.player.networkHandler.sendPacket(new TeleportConfirmC2SPacket(timer));
		
	} else if (getSettings().get(0).toMode().mode == 1) {
		double mX = 0; double mY = 0; double mZ = 0;
		if (mc.player.headYaw != mc.player.yaw) {
			mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(
					mc.player.headYaw, mc.player.pitch, mc.player.isOnGround()));
			return;
		}
		
		if (mc.options.keyJump.isPressed()) mY = 0.062;
		if (mc.options.keySneak.isPressed()) mY = -0.062;
		
		if (mc.options.keyForward.isPressed()) {
			if (mc.player.getMovementDirection().equals(Direction.NORTH)) mZ = -0.275;
			if (mc.player.getMovementDirection().equals(Direction.EAST)) mX = 0.275;
			if (mc.player.getMovementDirection().equals(Direction.SOUTH)) mZ = 0.275;
			if (mc.player.getMovementDirection().equals(Direction.WEST)) mX = -0.275;
		}
		
		if (timer > getSettings().get(3).toSlider().getValue()) {
			mX = 0;
			mZ = 0;
			mY = -0.062;
			timer = 0;
		}
		
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(
				mc.player.getX() + mX, mc.player.getY() + mY, mc.player.getZ() + mZ, false));
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(
				mc.player.getX() + mX, mc.player.getY() - 420.69, mc.player.getZ() + mZ, true));
		
	}
}
 
Example #20
Source File: TiredHack.java    From Wurst7 with GNU General Public License v3.0 1 votes vote down vote up
@Override
public void onUpdate()
{
	MC.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(
		MC.player.yaw, MC.player.age % 100, MC.player.isOnGround()));
}
 
Example #21
Source File: JesusHack.java    From Wurst7 with GNU General Public License v3.0 1 votes vote down vote up
@Override
public void onSentPacket(PacketOutputEvent event)
{
	// check packet type
	if(!(event.getPacket() instanceof PlayerMoveC2SPacket))
		return;
	
	PlayerMoveC2SPacket packet = (PlayerMoveC2SPacket)event.getPacket();
	
	// check if packet contains a position
	if(!(packet instanceof PlayerMoveC2SPacket.PositionOnly
		|| packet instanceof PlayerMoveC2SPacket.Both))
		return;
	
	// check inWater
	if(MC.player.isTouchingWater())
		return;
	
	// check fall distance
	if(MC.player.fallDistance > 3F)
		return;
	
	if(!isOverLiquid())
		return;
	
	// if not actually moving, cancel packet
	if(MC.player.input == null)
	{
		event.cancel();
		return;
	}
	
	// wait for timer
	packetTimer++;
	if(packetTimer < 4)
		return;
	
	// cancel old packet
	event.cancel();
	
	// get position
	double x = packet.getX(0);
	double y = packet.getY(0);
	double z = packet.getZ(0);
	
	// offset y
	if(bypass.isChecked() && MC.player.age % 2 == 0)
		y -= 0.05;
	else
		y += 0.05;
	
	// create new packet
	Packet<?> newPacket;
	if(packet instanceof PlayerMoveC2SPacket.PositionOnly)
		newPacket = new PlayerMoveC2SPacket.PositionOnly(x, y, z, true);
	else
		newPacket = new PlayerMoveC2SPacket.Both(x, y, z, packet.getYaw(0),
			packet.getPitch(0), true);
	
	// send new packet
	MC.player.networkHandler.getConnection().send(newPacket);
}
 
Example #22
Source File: Nofall.java    From bleachhack-1.14 with GNU General Public License v3.0 1 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	if (mc.player.fallDistance > 2f && getSettings().get(0).toMode().mode == 0) {
		if (mc.player.isFallFlying()) return;
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket(true));
	}
	
	if (mc.player.fallDistance > 2f && getSettings().get(0).toMode().mode == 1 &&
			mc.world.getBlockState(mc.player.getBlockPos().add(
					0,-1.5+(mc.player.getVelocity().y*0.1),0)).getBlock() != Blocks.AIR) {
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket(false));
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(
				mc.player.getX(), mc.player.getY() - 420.69, mc.player.getZ(), true));
		mc.player.fallDistance = 0;
	}
}
 
Example #23
Source File: ScaffoldWalkHack.java    From Wurst7 with GNU General Public License v3.0 1 votes vote down vote up
private boolean placeBlock(BlockPos pos)
{
	Vec3d eyesPos = new Vec3d(MC.player.getX(),
		MC.player.getY() + MC.player.getEyeHeight(MC.player.getPose()),
		MC.player.getZ());
	
	for(Direction side : Direction.values())
	{
		BlockPos neighbor = pos.offset(side);
		Direction side2 = side.getOpposite();
		
		// check if side is visible (facing away from player)
		if(eyesPos.squaredDistanceTo(Vec3d.ofCenter(pos)) >= eyesPos
			.squaredDistanceTo(Vec3d.ofCenter(neighbor)))
			continue;
		
		// check if neighbor can be right clicked
		if(!BlockUtils.canBeClicked(neighbor))
			continue;
		
		Vec3d hitVec = Vec3d.ofCenter(neighbor)
			.add(Vec3d.of(side2.getVector()).multiply(0.5));
		
		// check if hitVec is within range (4.25 blocks)
		if(eyesPos.squaredDistanceTo(hitVec) > 18.0625)
			continue;
		
		// place block
		Rotation rotation = RotationUtils.getNeededRotations(hitVec);
		PlayerMoveC2SPacket.LookOnly packet =
			new PlayerMoveC2SPacket.LookOnly(rotation.getYaw(),
				rotation.getPitch(), MC.player.isOnGround());
		MC.player.networkHandler.sendPacket(packet);
		IMC.getInteractionManager().rightClickBlock(neighbor, side2,
			hitVec);
		MC.player.swingHand(Hand.MAIN_HAND);
		IMC.setItemUseCooldown(4);
		
		return true;
	}
	
	return false;
}
 
Example #24
Source File: Protocol_1_11_2.java    From multiconnect with MIT License votes vote down vote up
@Override
public List<PacketInfo<?>> getServerboundPackets() {
    List<PacketInfo<?>> packets = super.getServerboundPackets();
    remove(packets, PlaceRecipeC2SPacket_1_12.class);
    remove(packets, PlayerMoveC2SPacket.class);
    insertAfter(packets, PlayerMoveC2SPacket.LookOnly.class, PacketInfo.of(PlayerMoveC2SPacket.class, PlayerMoveC2SPacket::new));
    remove(packets, RecipeBookDataC2SPacket.class);
    remove(packets, AdvancementTabC2SPacket.class);
    insertAfter(packets, ClientStatusC2SPacket.class, PacketInfo.of(ClientStatusC2SPacket_1_11_2.class, ClientStatusC2SPacket_1_11_2::new));
    remove(packets, ClientStatusC2SPacket.class);
    return packets;
}
 
Example #25
Source File: AutoLeaveHack.java    From Wurst7 with GNU General Public License v3.0 votes vote down vote up
@Override
public void onUpdate()
{
	// check gamemode
	if(MC.player.abilities.creativeMode)
		return;
	
	// check for other players
	if(MC.isInSingleplayer()
		&& MC.player.networkHandler.getPlayerList().size() == 1)
		return;
	
	// check health
	if(MC.player.getHealth() > health.getValueF() * 2F)
		return;
	
	// leave server
	switch(mode.getSelected())
	{
		case QUIT:
		MC.world.disconnect();
		break;
		
		case CHARS:
		MC.player.networkHandler
			.sendPacket(new ChatMessageC2SPacket("\u00a7"));
		break;
		
		case TELEPORT:
		MC.player.networkHandler.sendPacket(
			new PlayerMoveC2SPacket.PositionOnly(3.1e7, 100, 3.1e7, false));
		break;
		
		case SELFHURT:
		MC.player.networkHandler
			.sendPacket(new PlayerInteractEntityC2SPacket(MC.player,
				MC.player.isSneaking()));
		break;
	}
	
	// disable
	setEnabled(false);
}
 
Example #26
Source File: DerpHack.java    From Wurst7 with GNU General Public License v3.0 votes vote down vote up
@Override
public void onUpdate()
{
	float yaw = MC.player.yaw + random.nextFloat() * 360F - 180F;
	float pitch = random.nextFloat() * 180F - 90F;
	
	MC.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(
		yaw, pitch, MC.player.isOnGround()));
}
 
Example #27
Source File: ClickAuraHack.java    From Wurst7 with GNU General Public License v3.0 votes vote down vote up
private void attack()
{
	// set entity
	ClientPlayerEntity player = MC.player;
	ClientWorld world = MC.world;
	
	if(player.getAttackCooldownProgress(0) < 1)
		return;
	
	double rangeSq = Math.pow(range.getValue(), 2);
	Stream<LivingEntity> stream = StreamSupport
		.stream(MC.world.getEntities().spliterator(), true)
		.filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e)
		.filter(e -> !e.removed && e.getHealth() > 0)
		.filter(e -> player.squaredDistanceTo(e) <= rangeSq)
		.filter(e -> e != player)
		.filter(e -> !(e instanceof FakePlayerEntity))
		.filter(e -> !WURST.getFriends().contains(e.getEntityName()));
	
	if(filterPlayers.isChecked())
		stream = stream.filter(e -> !(e instanceof PlayerEntity));
	
	if(filterSleeping.isChecked())
		stream = stream.filter(e -> !(e instanceof PlayerEntity
			&& ((PlayerEntity)e).isSleeping()));
	
	if(filterFlying.getValue() > 0)
		stream = stream.filter(e -> {
			
			if(!(e instanceof PlayerEntity))
				return true;
			
			Box box = e.getBoundingBox();
			box = box.union(box.offset(0, -filterFlying.getValue(), 0));
			return world.doesNotCollide(box);
		});
	
	if(filterMonsters.isChecked())
		stream = stream.filter(e -> !(e instanceof Monster));
	
	if(filterPigmen.isChecked())
		stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity));
	
	if(filterEndermen.isChecked())
		stream = stream.filter(e -> !(e instanceof EndermanEntity));
	
	if(filterAnimals.isChecked())
		stream = stream.filter(
			e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity
				|| e instanceof WaterCreatureEntity));
	
	if(filterBabies.isChecked())
		stream = stream.filter(e -> !(e instanceof PassiveEntity
			&& ((PassiveEntity)e).isBaby()));
	
	if(filterPets.isChecked())
		stream = stream
			.filter(e -> !(e instanceof TameableEntity
				&& ((TameableEntity)e).isTamed()))
			.filter(e -> !(e instanceof HorseBaseEntity
				&& ((HorseBaseEntity)e).isTame()));
	
	if(filterVillagers.isChecked())
		stream = stream.filter(e -> !(e instanceof VillagerEntity));
	
	if(filterGolems.isChecked())
		stream = stream.filter(e -> !(e instanceof GolemEntity));
	
	if(filterInvisible.isChecked())
		stream = stream.filter(e -> !e.isInvisible());
	
	LivingEntity target =
		stream.min(priority.getSelected().comparator).orElse(null);
	if(target == null)
		return;
	
	WURST.getHax().autoSwordHack.setSlot();
	
	// face entity
	Rotation rotation = RotationUtils
		.getNeededRotations(target.getBoundingBox().getCenter());
	PlayerMoveC2SPacket.LookOnly packet = new PlayerMoveC2SPacket.LookOnly(
		rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround());
	MC.player.networkHandler.sendPacket(packet);
	
	// attack entity
	MC.interactionManager.attackEntity(player, target);
	player.swingHand(Hand.MAIN_HAND);
}
 
Example #28
Source File: TpAuraHack.java    From Wurst7 with GNU General Public License v3.0 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	
	// set entity
	double rangeSq = Math.pow(range.getValue(), 2);
	Stream<LivingEntity> stream = StreamSupport
		.stream(MC.world.getEntities().spliterator(), true)
		.filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e)
		.filter(e -> !e.removed && e.getHealth() > 0)
		.filter(e -> player.squaredDistanceTo(e) <= rangeSq)
		.filter(e -> e != player)
		.filter(e -> !(e instanceof FakePlayerEntity))
		.filter(e -> !WURST.getFriends().contains(e.getEntityName()));
	
	if(filterPlayers.isChecked())
		stream = stream.filter(e -> !(e instanceof PlayerEntity));
	
	if(filterSleeping.isChecked())
		stream = stream.filter(e -> !(e instanceof PlayerEntity
			&& ((PlayerEntity)e).isSleeping()));
	
	if(filterFlying.getValue() > 0)
		stream = stream.filter(e -> {
			
			if(!(e instanceof PlayerEntity))
				return true;
			
			Box box = e.getBoundingBox();
			box = box.union(box.offset(0, -filterFlying.getValue(), 0));
			return MC.world.doesNotCollide(box);
		});
	
	if(filterMonsters.isChecked())
		stream = stream.filter(e -> !(e instanceof Monster));
	
	if(filterPigmen.isChecked())
		stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity));
	
	if(filterEndermen.isChecked())
		stream = stream.filter(e -> !(e instanceof EndermanEntity));
	
	if(filterAnimals.isChecked())
		stream = stream.filter(
			e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity
				|| e instanceof WaterCreatureEntity));
	
	if(filterBabies.isChecked())
		stream = stream.filter(e -> !(e instanceof PassiveEntity
			&& ((PassiveEntity)e).isBaby()));
	
	if(filterPets.isChecked())
		stream = stream
			.filter(e -> !(e instanceof TameableEntity
				&& ((TameableEntity)e).isTamed()))
			.filter(e -> !(e instanceof HorseBaseEntity
				&& ((HorseBaseEntity)e).isTame()));
	
	if(filterVillagers.isChecked())
		stream = stream.filter(e -> !(e instanceof VillagerEntity));
	
	if(filterGolems.isChecked())
		stream = stream.filter(e -> !(e instanceof GolemEntity));
	
	if(filterInvisible.isChecked())
		stream = stream.filter(e -> !e.isInvisible());
	
	Entity entity =
		stream.min(priority.getSelected().comparator).orElse(null);
	if(entity == null)
		return;
	
	WURST.getHax().autoSwordHack.setSlot();
	
	// teleport
	player.updatePosition(entity.getX() + random.nextInt(3) * 2 - 2,
		entity.getY(), entity.getZ() + random.nextInt(3) * 2 - 2);
	
	// check cooldown
	if(player.getAttackCooldownProgress(0) < 1)
		return;
	
	// attack entity
	RotationUtils.Rotation rotations = RotationUtils
		.getNeededRotations(entity.getBoundingBox().getCenter());
	WurstClient.MC.player.networkHandler
		.sendPacket(new PlayerMoveC2SPacket.LookOnly(rotations.getYaw(),
			rotations.getPitch(), MC.player.isOnGround()));
	
	MC.interactionManager.attackEntity(player, entity);
	player.swingHand(Hand.MAIN_HAND);
}
 
Example #29
Source File: PacketFly.java    From bleachhack-1.14 with GNU General Public License v3.0 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	double hspeed = getSettings().get(1).toSlider().getValue();
	double vspeed = getSettings().get(2).toSlider().getValue();
	
	if (!mc.player.isAlive()) return;
	timer++;
	
	Entity target = mc.player.getVehicle() == null ? mc.player : mc.player.getVehicle();
	if (getSettings().get(0).toMode().mode == 0) {
		if (mc.options.keyJump.isPressed()) posY += vspeed;
		if (mc.options.keySneak.isPressed()) posY -= vspeed;
		
		Vec3d forward = new Vec3d(0,0,hspeed).rotateY(-(float) Math.toRadians(mc.player.yaw));
		Vec3d strafe = forward.rotateY((float) Math.toRadians(90));
		if (mc.options.keyForward.isPressed()) { posX += forward.x; posZ += forward.z; }
		if (mc.options.keyBack.isPressed()) { posX -= forward.x; posZ -= forward.z; }
		if (mc.options.keyLeft.isPressed()) { posX += strafe.x; posZ += strafe.z; }
		if (mc.options.keyRight.isPressed()) { posX -= strafe.x; posZ -= strafe.z; }
		
		if (timer > getSettings().get(3).toSlider().getValue()) {
			posY -= 0.2;
			timer = 0;
		}
		
		
		target.noClip = true;
		target.updatePositionAndAngles(posX, posY, posZ, mc.player.yaw, mc.player.pitch);
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY, posZ, false));
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(posX, posY - 0.01, posZ, true));
		mc.player.networkHandler.sendPacket(new TeleportConfirmC2SPacket(timer));
		
	} else if (getSettings().get(0).toMode().mode == 1) {
		double mX = 0; double mY = 0; double mZ = 0;
		if (mc.player.headYaw != mc.player.yaw) {
			mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(
					mc.player.headYaw, mc.player.pitch, mc.player.onGround));
			return;
		}
		
		if (mc.options.keyJump.isPressed()) mY = 0.062;
		if (mc.options.keySneak.isPressed()) mY = -0.062;
		
		if (mc.options.keyForward.isPressed()) {
			if (mc.player.getMovementDirection().equals(Direction.NORTH)) mZ = -0.275;
			if (mc.player.getMovementDirection().equals(Direction.EAST)) mX = 0.275;
			if (mc.player.getMovementDirection().equals(Direction.SOUTH)) mZ = 0.275;
			if (mc.player.getMovementDirection().equals(Direction.WEST)) mX = -0.275;
		}
		
		if (timer > getSettings().get(3).toSlider().getValue()) {
			mX = 0;
			mZ = 0;
			mY = -0.062;
			timer = 0;
		}
		
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(
				mc.player.getX() + mX, mc.player.getY() + mY, mc.player.getZ() + mZ, false));
		mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionOnly(
				mc.player.getX() + mX, mc.player.getY() - 420.69, mc.player.getZ() + mZ, true));
		
	}
}
 
Example #30
Source File: OffhandCrash.java    From bleachhack-1.14 with GNU General Public License v3.0 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	for (int i = 0; i < getSettings().get(0).toSlider().getValue(); i++) {
		mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ORIGIN, Direction.UP));
		if (getSettings().get(1).toToggle().state) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket(true));
	}
}