Java Code Examples for net.minecraft.client.options.KeyBinding#setPressed()

The following examples show how to use net.minecraft.client.options.KeyBinding#setPressed() . 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: SneakHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onPreMotion()
{
	KeyBinding sneakKey = MC.options.keySneak;
	
	switch(mode.getSelected())
	{
		case LEGIT:
		sneakKey.setPressed(true);
		break;
		
		case PACKET:
		sneakKey.setPressed(((IKeyBinding)sneakKey).isActallyPressed());
		sendSneakPacket(Mode.PRESS_SHIFT_KEY);
		sendSneakPacket(Mode.RELEASE_SHIFT_KEY);
		break;
	}
}
 
Example 2
Source File: AutoWalkHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDisable()
{
	EVENTS.remove(UpdateListener.class, this);
	
	KeyBinding forwardKey = MC.options.keyForward;
	forwardKey.setPressed(((IKeyBinding)forwardKey).isActallyPressed());
}
 
Example 3
Source File: FreecamHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onEnable()
{
	EVENTS.add(UpdateListener.class, this);
	EVENTS.add(PacketOutputListener.class, this);
	EVENTS.add(IsPlayerInWaterListener.class, this);
	EVENTS.add(PlayerMoveListener.class, this);
	EVENTS.add(CameraTransformViewBobbingListener.class, this);
	EVENTS.add(IsNormalCubeListener.class, this);
	EVENTS.add(SetOpaqueCubeListener.class, this);
	EVENTS.add(RenderListener.class, this);
	
	fakePlayer = new FakePlayerEntity();
	
	GameOptions gs = MC.options;
	KeyBinding[] bindings = {gs.keyForward, gs.keyBack, gs.keyLeft,
		gs.keyRight, gs.keyJump, gs.keySneak};
	
	for(KeyBinding binding : bindings)
		binding.setPressed(((IKeyBinding)binding).isActallyPressed());
	
	playerBox = GL11.glGenLists(1);
	GL11.glNewList(playerBox, GL11.GL_COMPILE);
	Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEndList();
}
 
Example 4
Source File: TunnellerHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	HackList hax = WURST.getHax();
	Hack[] incompatibleHax = {hax.autoToolHack, hax.autoWalkHack,
		hax.blinkHack, hax.flightHack, hax.nukerHack,
		// TODO:
		// hax.nukerLegitHack,
		// hax.speedNukerHack,
		hax.sneakHack};
	for(Hack hack : incompatibleHax)
		hack.setEnabled(false);
	
	if(hax.freecamHack.isEnabled())
		return;
	
	GameOptions gs = MC.options;
	KeyBinding[] bindings = {gs.keyForward, gs.keyBack, gs.keyLeft,
		gs.keyRight, gs.keyJump, gs.keySneak};
	for(KeyBinding binding : bindings)
		binding.setPressed(false);
	
	for(Task task : tasks)
	{
		if(!task.canRun())
			continue;
		
		task.run();
		break;
	}
}
 
Example 5
Source File: MileyCyrusHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDisable()
{
	EVENTS.remove(UpdateListener.class, this);
	
	KeyBinding sneak = MC.options.keySneak;
	sneak.setPressed(((IKeyBinding)sneak).isActallyPressed());
}
 
Example 6
Source File: PathProcessor.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
public static final void lockControls()
{
	// disable keys
	for(KeyBinding key : CONTROLS)
		key.setPressed(false);
	
	// disable sprinting
	WurstClient.MC.player.setSprinting(false);
}
 
Example 7
Source File: TunnellerHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void run()
{
	BlockPos player = new BlockPos(MC.player.getPos());
	KeyBinding forward = MC.options.keyForward;
	
	Vec3d diffVec = Vec3d.of(player.subtract(start));
	Vec3d dirVec = Vec3d.of(direction.getVector());
	double dotProduct = diffVec.dotProduct(dirVec);
	
	BlockPos pos1 = start.offset(direction, (int)dotProduct);
	if(!player.equals(pos1))
	{
		WURST.getRotationFaker()
			.faceVectorClientIgnorePitch(toVec3d(pos1));
		forward.setPressed(true);
		return;
	}
	
	BlockPos pos2 = start.offset(direction, Math.max(0, length - 10));
	if(!player.equals(pos2))
	{
		WURST.getRotationFaker()
			.faceVectorClientIgnorePitch(toVec3d(pos2));
		forward.setPressed(true);
		MC.player.setSprinting(true);
		return;
	}
	
	BlockPos pos3 = start.offset(direction, length + 1);
	WURST.getRotationFaker().faceVectorClientIgnorePitch(toVec3d(pos3));
	forward.setPressed(false);
	MC.player.setSprinting(false);
	
	if(disableTimer > 0)
	{
		disableTimer--;
		return;
	}
	
	setEnabled(false);
}
 
Example 8
Source File: PathProcessor.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
public static final void releaseControls()
{
	// reset keys
	for(KeyBinding key : CONTROLS)
		key.setPressed(((IKeyBinding)key).isActallyPressed());
}