Java Code Examples for net.minecraft.entity.player.EntityPlayer.setVelocity()

The following are Jave code examples for showing how to use setVelocity() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Infernum   File: SpellGhastlyPulse.java   Source Code and License Vote up 6 votes
@Override
public void onCast(World world, EntityPlayer player, ItemStack stack) {

	if (consumePower(player)) {
		if (world.isRemote) {
			Vec3d lookVector = player.getLookVec();
			if (!player.isSneaking()) {
				player.setVelocity(lookVector.xCoord * 1.2, lookVector.yCoord * 1.2, lookVector.zCoord * 1.2);
			} else {
				player.setVelocity(lookVector.xCoord * -1.2, lookVector.yCoord * -1.2, lookVector.zCoord * -1.2);
			}
			player.fallDistance = 0;
			player.velocityChanged = true;
		} else if (!world.isRemote) {
			player.fallDistance = 0;
			if (world instanceof WorldServer) {
				((WorldServer) world).spawnParticle(EnumParticleTypes.CLOUD, true, player.posX, player.posY,
						player.posZ, world.rand.nextInt(12) + 8, 0.5, 0.5, 0.5, 0.5);
			}
		}

	}

}