Java Code Examples for net.minecraft.client.network.ClientPlayerEntity#setVelocity()

The following examples show how to use net.minecraft.client.network.ClientPlayerEntity#setVelocity() . 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: FreecamHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDisable()
{
	EVENTS.remove(UpdateListener.class, this);
	EVENTS.remove(PacketOutputListener.class, this);
	EVENTS.remove(IsPlayerInWaterListener.class, this);
	EVENTS.remove(PlayerMoveListener.class, this);
	EVENTS.remove(CameraTransformViewBobbingListener.class, this);
	EVENTS.remove(IsNormalCubeListener.class, this);
	EVENTS.remove(SetOpaqueCubeListener.class, this);
	EVENTS.remove(RenderListener.class, this);
	
	fakePlayer.resetPlayerPosition();
	fakePlayer.despawn();
	
	ClientPlayerEntity player = MC.player;
	player.setVelocity(Vec3d.ZERO);
	
	MC.worldRenderer.reload();
	
	GL11.glDeleteLists(playerBox, 1);
	playerBox = 0;
}
 
Example 2
Source File: FreecamHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	player.setVelocity(Vec3d.ZERO);
	
	player.setOnGround(false);
	player.flyingSpeed = speed.getValueF();
	Vec3d velcity = player.getVelocity();
	
	if(MC.options.keyJump.isPressed())
		player.setVelocity(velcity.add(0, speed.getValue(), 0));
	
	if(MC.options.keySneak.isPressed())
		player.setVelocity(velcity.subtract(0, speed.getValue(), 0));
}
 
Example 3
Source File: NoClipHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	
	player.noClip = true;
	player.fallDistance = 0;
	player.setOnGround(false);
	
	player.abilities.flying = false;
	player.setVelocity(0, 0, 0);
	
	float speed = 0.2F;
	player.flyingSpeed = speed;
	
	if(MC.options.keyJump.isPressed())
		player.addVelocity(0, speed, 0);
	if(MC.options.keySneak.isPressed())
		player.addVelocity(0, -speed, 0);
}
 
Example 4
Source File: FlightHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	
	player.abilities.flying = false;
	player.flyingSpeed = speed.getValueF();
	
	player.setVelocity(0, 0, 0);
	Vec3d velcity = player.getVelocity();
	
	if(MC.options.keyJump.isPressed())
		player.setVelocity(velcity.add(0, speed.getValue(), 0));
	
	if(MC.options.keySneak.isPressed())
		player.setVelocity(velcity.subtract(0, speed.getValue(), 0));
}
 
Example 5
Source File: DolphinHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	if(!player.isWet() || player.isSneaking())
		return;
	
	Vec3d velocity = player.getVelocity();
	player.setVelocity(velocity.x, velocity.y + 0.04, velocity.z);
}
 
Example 6
Source File: FastLadderHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	
	if(!player.isClimbing() || !player.horizontalCollision)
		return;
	
	if(player.input.movementForward == 0
		&& player.input.movementSideways == 0)
		return;
	
	Vec3d velocity = player.getVelocity();
	player.setVelocity(velocity.x, 0.2872, velocity.z);
}
 
Example 7
Source File: GlideHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	Vec3d v = player.getVelocity();
	
	if(player.isOnGround() || player.isTouchingWater() || player.isInLava()
		|| player.isClimbing() || v.y >= 0)
		return;
	
	if(minHeight.getValue() > 0)
	{
		Box box = player.getBoundingBox();
		box = box.union(box.offset(0, -minHeight.getValue(), 0));
		if(!MC.world.doesNotCollide(box))
			return;
		
		BlockPos min =
			new BlockPos(new Vec3d(box.minX, box.minY, box.minZ));
		BlockPos max =
			new BlockPos(new Vec3d(box.maxX, box.maxY, box.maxZ));
		Stream<BlockPos> stream = StreamSupport
			.stream(BlockUtils.getAllInBox(min, max).spliterator(), true);
		
		// manual collision check, since liquids don't have bounding boxes
		if(stream.map(BlockUtils::getState).map(BlockState::getMaterial)
			.anyMatch(Material::isLiquid))
			return;
	}
	
	player.setVelocity(v.x, Math.max(v.y, -fallSpeed.getValue()), v.z);
	player.flyingSpeed *= moveSpeed.getValueF();
}
 
Example 8
Source File: FishHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	if(!player.isWet() || player.isSneaking())
		return;
	
	Vec3d velocity = player.getVelocity();
	player.setVelocity(velocity.x, velocity.y + 0.005, velocity.z);
}
 
Example 9
Source File: SpiderHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	if(!player.horizontalCollision)
		return;
	
	Vec3d velocity = player.getVelocity();
	if(velocity.y >= 0.2)
		return;
	
	player.setVelocity(velocity.x, 0.2, velocity.z);
}